Submission #272337

#TimeUsernameProblemLanguageResultExecution timeMemory
272337sjimedLast supper (IOI12_supper)C++14
0 / 100
230 ms141808 KiB
#include "advisor.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define all(v) (v).begin(), (v).end() #define em emplace #define eb emplace_back #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INF = 1e18; const int inf = 1e9; static queue<int> q[100010]; static set<pii> s; static bool ans[200010]; void ComputeAdvice(int *C, int N, int K, int M) { for(int i=0; i<N; i++) { q[C[i]].em(i); } for(int i=0; i<N; i++) q[i].em(N); for(int i=0; i<K; i++) { s.insert(mp(q[i].front(), i - K)); } for(int i=0; i<N; i++) { if(s.begin()->fi == i) { s.erase(s.begin()); q[C[i]].pop(); s.insert(mp(q[C[i]].front(), i)); } else { int x = prev(s.end())->se; ans[x + K] = true; s.erase(prev(s.end())); q[C[i]].pop(); s.insert(mp(q[C[i]].front(), i)); } } for(int i=0; i<N+K; i++) { WriteAdvice(ans[i]); } }
#include "assistant.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define all(v) (v).begin(), (v).end() #define em emplace #define eb emplace_back #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INF = 1e18; const int inf = 1e9; static int n; static set<int> t; static vector<int> v[100010], s; void Assist(unsigned char *A, int N, int K, int R) { n = N; for(int i=0; i<K; i++) { if(A[i]) s.eb(i); v[i].eb(i); } for(int i = K; i < N + K; i++) { int x = GetRequest(); if(A[i]) s.eb(i); if(v[x].size() && !A[v[x].back()]) { v[x].eb(i); continue; } int y = s.back(); PutBack(y); v[x].eb(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...