Submission #152847

#TimeUsernameProblemLanguageResultExecution timeMemory
152847qkxwsmLast supper (IOI12_supper)C++14
0 / 100
2581 ms7012 KiB
#include "advisor.h" #include <bits/stdc++.h> using namespace std; template<class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template<class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } #define MP make_pair #define PB push_back #define LB lower_bound #define UB upper_bound #define fi first #define se second #define FOR(i, a, b) for (auto i = (a); i < (b); i++) #define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--) #define SZ(x) ((int) ((x).size())) #define ALL(x) (x).begin(), (x).end() #define MAXN 1000013 typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpi; typedef vector<pll> vpl; int pos[MAXN]; bitset<MAXN> important; void ComputeAdvice(int *C, int N, int K, int M) { //some guys you get are "useless", some guys are not FOR(i, 0, N) pos[i] = -1; FOR(i, 0, K) pos[i] = i; FOR(i, 0, N) { int x = C[i]; //does this guy exist? if (pos[x] != -1) { important[pos[x]] = true; } pos[x] = i + K; } FOR(i, 0, N + K) { WriteAdvice((important[i] ? 1 : 0)); } }
#include "assistant.h" #include <bits/stdc++.h> using namespace std; template<class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template<class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } #define MP make_pair #define PB push_back #define LB lower_bound #define UB upper_bound #define fi first #define se second #define FOR(i, a, b) for (auto i = (a); i < (b); i++) #define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--) #define SZ(x) ((int) ((x).size())) #define ALL(x) (x).begin(), (x).end() #define MAXN 1000013 typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpi; typedef vector<pll> vpl; int arr[MAXN]; set<int> useful, useless; void Assist(unsigned char *A, int N, int K, int R) { FOR(i, 0, K) { arr[i] = i; if (A[i]) { useful.insert(i); } else { useless.insert(i); } } FOR(i, 0, N) { int cur = GetRequest(); arr[i + K] = cur; if (useful.find(cur) == useful.end()) { int x = *useless.begin(); useless.erase(useless.begin()); PutBack(x); } else { useful.erase(cur); } if (A[i + K]) { useful.insert(cur); } else { useless.insert(cur); } } }
#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...