# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
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
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |