# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92709 | 2019-01-04T10:56:35 Z | GioChkhaidze | Money (IZhO17_money) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> #define F first #define S second using namespace std; int n,a[1000006],fix[1000006],Ans; pair < int , int > p [1000006]; set < int > st; void go(int x,int idx) { int ko=0,ID=idx; Ans++; fix[idx]=1; for (int i=idx+1; i<=n; i++) { if (a[i]<x) break; if (st.upper_bound(x)==st.end() || a[i]<=*st.upper_bound(x)) { fix[i]=1; ID=i; x=a[i]; } else break; } for (int i=idx; i<=ID; i++) st.insert(a[i]); } main () { ios::sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) { cin>>a[i]; p[i].F=a[i]; p[i].S=i; } sort(p+1,p+n+1); for (int i=1; i<=n; i++) { if (!fix[p[i].S]) go(p[i].F,p[i].S); /* for (int j=1; j<=n; j++) cout<<fix[j]<<" "; cout<<endl;*/ } cout<<Ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 1 ms | 376 KB | Output is correct |
7 | Correct | 1 ms | 376 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 1 ms | 376 KB | Output is correct |
10 | Incorrect | 1 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 1 ms | 376 KB | Output is correct |
7 | Correct | 1 ms | 376 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 1 ms | 376 KB | Output is correct |
10 | Incorrect | 1 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 1 ms | 376 KB | Output is correct |
7 | Correct | 1 ms | 376 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 1 ms | 376 KB | Output is correct |
10 | Incorrect | 1 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 296 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 1 ms | 376 KB | Output is correct |
7 | Correct | 1 ms | 376 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 1 ms | 376 KB | Output is correct |
10 | Incorrect | 1 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |