Submission #1097025

#TimeUsernameProblemLanguageResultExecution timeMemory
1097025idiotcomputerLast supper (IOI12_supper)C++11
0 / 100
51 ms6620 KiB
#include "advisor.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) (int) (x).size() #define pii pair<int,int> #define f first #define s second void ComputeAdvice(int *C, int N, int K, int M){ bool ci[N+K]; memset(ci,0,sizeof(ci)); bool vis[N]; memset(vis,0,sizeof(vis)); for (int i = N-1; i >= 0; i--){ if (vis[C[i]]) ci[K+i] = 1; vis[C[i]] = 1; } for (int i = K-1; i >= 0; i--) if (vis[i]) ci[i] = 1; for (int i = 0; i < N+K; i++) WriteAdvice(ci[i]); return; }
#include "assistant.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) (int) (x).size() #define pii pair<int,int> #define f first #define s second void Assist(unsigned char *A, int N, int K, int R){ stack<int> o; set<pii> all; bool vis[N]; int last[N]; memset(last,0,sizeof(last)); memset(vis,0,sizeof(vis)); for (int i = 0; i < K; i++){ vis[i] = 1; all.insert((pii) {0,i}); if (A[i] == 0) o.push(i); } int c,t; for (int i = 0; i < N; i++){ c = GetRequest(); // cout << c << ":\n"; if (vis[c]){ // cout << "in\n"; if (A[i+K] == 0) o.push(c); continue; } //cout << sz(o) << " "; if (sz(o)){ t = o.top(); o.pop(); } else { t = (*(all.begin())).s; } //cout << sz(all) << " " << t << '\n'; vis[t] = 0; PutBack(t); all.erase((pii) {last[t],t}); vis[c] = 1; last[c] = i+1; if (A[i+K] == 0) o.push(c); all.insert((pii) {i+1,c}); } }
#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...