# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92655 | 2019-01-04T09:34:48 Z | GioChkhaidze | Money (IZhO17_money) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; int n,a[1000006],f[1000006],fix[1000006],Ans; set < int > st; void go(int x,int idx) { int ko=0; Ans++; fix[x]=1; st.insert(x); for (int i=idx+1; i<=n; i++) { if (fix[a[i]] || a[i]<x) break; if (st.upper_bound(x)==st.end() || *st.upper_bound(x)<a[i]) { fix[a[i]]=1; st.insert(a[i]); x=a[i]; } else break; } } main () { ios::sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) { cin>>a[i]; f[a[i]]=i; } for (int i=1; i<=n; i++) if (!fix[i]) go(i,f[i]); cout<<Ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |