QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#628157 | #9266. Dynamic Traffic with MegaFon | ucup-team3474 | Compile Error | / | / | C++20 | 579b | 2024-10-10 18:57:06 | 2024-10-10 18:57:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m,k;
ll a[N],b[N];
int main(){
memset(tr1,-0x3f,sizeof tr1);
memset(tr2,-0x3f,sizeof tr2);
cin>>n;
for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
vector<ll> v;
for(int i=1;i<=n;i++){
if(a[i]>=0) v.push_back(a[i]);
else{
if(!v.size()||v.back()>=0) v.push_back(a[i]);
}
}
ll ans=0;
for(int i=1;i<v.size();i++) ans+=max(v[i],v[i-1]);
cout<<ans<<endl;
}
详细
answer.code: In function ‘int main()’: answer.code:12:12: error: ‘tr1’ was not declared in this scope 12 | memset(tr1,-0x3f,sizeof tr1); | ^~~ answer.code:13:12: error: ‘tr2’ was not declared in this scope 13 | memset(tr2,-0x3f,sizeof tr2); | ^~~ answer.code:15:32: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | for(int i=1;i<=n;i++) scanf("%lld",&a[i]); | ~~~~~^~~~~~~~~~~~~~