Submission #772699

#TimeUsernameProblemLanguageResultExecution timeMemory
772699kingfran1907Last supper (IOI12_supper)C++14
0 / 100
361 ms82920 KiB
#include "advisor.h" void ComputeAdvice(int *C, int N, int K, int M) { int x = 1; while (N > (1 << x)) x++; for (int i = 0; i < N; i++) { for (int j = 0; j < x; j++) { //printf("%c", '0' + !!(C[i] & (1 << j))); WriteAdvice(!!(C[i] & (1 << j))); } } //printf("\n"); }
#include <bits/stdc++.h> #include "assistant.h" #define X first #define Y second using namespace std; const int maxn = 1e5+10; queue< int > qs[maxn]; void Assist(unsigned char *A, int N, int K, int R) { int x = 1; while (N > (1 << x)) x++; int ptr = 0; vector< int > c; for (int i = 0; i < N; i++) { int ac = 0; for (int j = 0; j < x; j++) { //printf("pokusaj: %c\n", A[ptr]); if (A[ptr++] == 1) ac += (1 << j); } c.push_back(ac); } //printf("\n"); for (int i = 0; i < N; i++) qs[i].push(N + 1); for (int i = 0; i < N; i++) { qs[c[i]].push(i); } set< pair<int, int> > s; for (int i = 0; i < K; i++) { s.insert({qs[i].front(), i}); } for (int i = 0; i < N; i++) { int deb = GetRequest(); //printf("debug: %d %d\n", deb, c[i]); fflush(stdout); assert(c[i] == deb); int tr = c[i]; if (!s.count({qs[tr].front(), tr})) { int x = s.rbegin()->Y; PutBack(x); s.erase(--s.end()); qs[tr].pop(); s.insert({qs[tr].front(), tr}); } else { s.erase({qs[tr].front(), tr}); qs[tr].pop(); s.insert({qs[tr].front(), tr}); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...