QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137991 | #6342. Security Guard | Rafi22# | Compile Error | / | / | C++14 | 746b | 2023-08-10 20:20:55 | 2024-07-04 01:33:39 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 01:33:39]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-08-10 20:20:55]
- 提交
answer
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=2000000007;
int mod=1000000007;
int mod1=998244353;
const int N=200007;
int a[N];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m,k;
cin>>n>>m>>k;
bool is=0;
int ans=0,mx=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(i>1) ans+=min(a[i],a[i-1]);
ans+=max(0LL,a[i]-a[i-1]);
mx=max(mx,a[i]);
}
ans+=mx-a[i];
cout<<ans;
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:37:15: error: ‘i’ was not declared in this scope; did you mean ‘is’? 37 | ans+=mx-a[i]; | ^ | is