# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363121 | 2021-02-05T05:29:41 Z | eric_xiao | Last supper (IOI12_supper) | C++14 | 1141 ms | 23560 KB |
#include<bits/stdc++.h> #include "advisor.h" #define ll long long #define pii pair<int,int> #define F first #define S second using namespace std; int st[100009],th[100009],in[100009],last[100009]; set<int> occ[100009]; set<pii> nw; const int inf = 1000000; void ComputeAdvice(int *C, int N, int K, int M) { int i,j,k; for(i = 0;i < N;i++) { occ[C[i]].insert(i); last[i] = -1; } for(i = 0;i < N;i++) { occ[i].insert(inf); } for(i = 0;i < K;i++) { in[i] = 1; nw.insert({*occ[i].begin(),i}); } for(i = 0;i < N;i++) { last[C[i]] = i; if(in[C[i]] == 1) { auto p = nw.lower_bound({i,C[i]}); pii t = {*occ[i].upper_bound(i),C[i]}; nw.erase(p); nw.insert(t); continue; } auto u = prev(nw.end()); if(last[u->S] == -1) { st[u->S] = 1; } else { th[last[u->S]] = 1; } pii t = {*occ[i].upper_bound(i),C[i]}; nw.erase(u); nw.insert(t); } for(auto x : nw) { if(last[x.S] == -1) { st[x.S] = 1; } else { th[last[x.S]] = 1; } } for(i = 0;i < N;i++) { if(st[i] == 0)WriteAdvice(0); else WriteAdvice(1); } for(i = 0;i < N;i++) { if(th[i] == 0)WriteAdvice(0); else WriteAdvice(1); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 5476 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 109 ms | 7228 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 914 ms | 19984 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 46 ms | 6560 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1113 ms | 22784 KB | Output isn't correct - not an optimal way |
2 | Incorrect | 1133 ms | 22976 KB | Output isn't correct - not an optimal way |
3 | Incorrect | 1097 ms | 23252 KB | Output isn't correct - not an optimal way |
4 | Incorrect | 1127 ms | 23252 KB | Output isn't correct - not an optimal way |
5 | Incorrect | 1141 ms | 23252 KB | Output isn't correct - not an optimal way |
6 | Incorrect | 1124 ms | 23276 KB | Output isn't correct - not an optimal way |
7 | Incorrect | 1113 ms | 23312 KB | Output isn't correct - not an optimal way |
8 | Incorrect | 1132 ms | 23384 KB | Output isn't correct - not an optimal way |
9 | Incorrect | 1119 ms | 23324 KB | Output isn't correct - not an optimal way |
10 | Incorrect | 1097 ms | 23560 KB | Output isn't correct - not an optimal way |