#include<iostream>
using namespace std;
int size,size2;
int main(){
cin>>size>>size2;
cout<<size+size2;
return 0;
}
我在今天已经结束的校内比赛中,使用了size
作为全局变量名,因评测机使用C++17评测而CE。于是使用如上代码以C++11,C++14,C++14(GCC9),C++17,C++20语言各自提交一发,时间间隔不足30秒。请问:正常大型比赛编译方式是不是-std=c++14 -O2
?
如下是原代码
#include<iostream>
#include<stack>
using namespace std;
#define int long long
stack<int>lower;
stack<int>higher;
const int size=1e6+7;
int a[size];
signed main(){
int ans=0,n;
lower.push(2147483647);
higher.push(2147483647);
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
if(a[i]<lower.top())lower.push(a[i]);
ans=max(ans,lower.top()*i);
}
for(int i=n;i>=1;i--){
if(a[i]<higher.top())higher.push(a[i]);
ans=max(ans,higher.top()*(n-i+1));
}
cout<<ans;
return 0;
}