Submission #126766

#TimeUsernameProblemLanguageResultExecution timeMemory
126766RockyBLast supper (IOI12_supper)C++17
0 / 100
328 ms28808 KiB
#include "advisor.h" #include <bits/stdc++.h> #define f first #define s second #define pb push_back #define pp pop_back #define sz(x) (int)x.size() #define rep(z, a, b) for (int z = (a); (z) <= (b); z++) #define per(z, a, b) for (int z = (a); (z) >= (b); z--) using namespace std; const int MAXN = (int)2e5 + 7; vector <int> nxt[MAXN]; void ComputeAdvice(int *C, int N, int K, int M) { per(i, N - 1, 0) nxt[i].pb(N); per(i, N - 1, 0) nxt[C[i]].pb(i); set < pair <int, int > > st; rep(i, 0, K - 1) st.insert({nxt[i].back(), i}); int Log = log2(K); rep(i, 0, N - 1) { while (sz(st) && st.begin() -> f <= i) { int x = st.begin() -> s; st.erase(st.begin()); nxt[x].pp(); st.insert({nxt[x].back(), x}); } if (st.count({nxt[C[i]].back(), C[i]})) { WriteAdvice(0); continue; } int del = st.rbegin() -> s; st.erase(--st.end()); st.insert({nxt[C[i]].back(), C[i]}); WriteAdvice(1); rep(j, 0, Log - 1) { WriteAdvice((del >> j) & 1); } } }
#include "assistant.h" #include <bits/stdc++.h> #define f first #define s second #define pb push_back #define pp pop_back #define sz(x) (int)x.size() #define rep(z, a, b) for (int z = (a); (z) <= (b); z++) #define per(z, a, b) for (int z = (a); (z) >= (b); z--) using namespace std; const int MAXN = (int)2e5 + 7; void Assist(unsigned char *A, int N, int K, int R) { int LOG = log2(K); for (int i = 0; i < R; ) { GetRequest(); if (A[i] == 0) { i++; continue; } else { i++; int val = 0; rep(j, 0, LOG - 1) { if (A[i + j] == 1) val |= 1 << j; } i += LOG ; // cerr << val << " -> " << endl; PutBack(val); } } }
#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...