Submission #635487

#TimeUsernameProblemLanguageResultExecution timeMemory
635487shafinalamLast supper (IOI12_supper)C++17
20 / 100
473 ms83204 KiB
#include <bits/stdc++.h> #include "advisor.h" using namespace std; string dectobin(int x, int mx) { string res = ""; for (int i = mx; i >= 0; i--) { if ((1 << i) & x) res += '1'; else res += '0'; } return res; } void ComputeAdvice(int *C, int N, int K, int M) { int mx = log2(N-1); for (int i = 0; i < N; i++) { string tmp = dectobin(C[i],mx); for (auto j : tmp) WriteAdvice(j-'0'); } }
#include <bits/stdc++.h> #define f first #define s second #include "assistant.h" using namespace std; int C[100005]; deque<int> pos[100005]; void Assist(unsigned char *A, int N, int K, int R) { int lg = log2(N-1)+1; for (int i = 0; i < R; i++) { C[i/lg] += (1 << (lg - i % lg - 1)) * A[i]; } for (int i = 0; i < N; i++) pos[C[i]].push_back(i); for (int i = 0; i < N; i++) pos[i].push_back(1e9); set<pair<int,int>> cur; for (int i = 0; i < K; i++) cur.insert({pos[i][0],i}); for (int i = 0; i < N; i++) { GetRequest(); if (cur.find({pos[C[i]][0],C[i]}) != cur.end()) { cur.erase({pos[C[i]][0],C[i]}); pos[C[i]].pop_front(); cur.insert({pos[C[i]][0],C[i]}); } else { pos[C[i]].pop_front(); PutBack((*cur.rbegin()).s); cur.erase(*cur.rbegin()); cur.insert({pos[C[i]][0],C[i]}); } } }
#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...