# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37561 | 2017-12-26T06:26:02 Z | Abelyan | Money (IZhO17_money) | C++14 | 0 ms | 10964 KB |
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; const int N=1000006; pair <int,int> a[N]; bool r[N]; int main(){ ios_base::sync_with_stdio(false); freopen("money.in","r",stdin); freopen("money.out","w",stdout); int n; cin>>n; for (int i = 0; i < n; i++){ int k; cin>>k; a[i].first=k; a[i].second=-i; } sort(a,a+n); int ans=1; r[-a[0].second+1]=true; for (int i = 1; i < n; i++){ if (r[-a[i].second]){ r[-a[i-1].second+1]=false; r[-a[i].second+1]=true; } else{ if (-a[i].second < -a[i - 1].second){ r[-a[i - 1].second + 1] = false; r[-a[i].second + 1] = true; } else{ r[-a[i].second + 1] = true; } ans++; } } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 10964 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 10964 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 10964 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 10964 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |