# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171295 | 2019-12-28T08:43:25 Z | juggernaut | Money (IZhO17_money) | C++14 | 4 ms | 504 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; int n,i,nxt[1000001],prv[1000001],a[1000001],b[1000001],ans,x,y; main(){ scanf("%lld",&n); for(i=1;i<=n;i++){ scanf("%lld",&a[i]); b[i]=a[i]; } a[0]=1e15; sort(b+1,b+1+n); for(i=1;i<n;i++)nxt[b[i]]=b[i+1],prv[b[i+1]]=b[i]; i=n; while(i>1){ x=nxt[i]; while(prv[a[i]]==a[i-1])i--; prv[x]=prv[i]; nxt[i]=nxt[x]; ans++; i--; } printf("%lld",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |