제출 #477799

#제출 시각아이디문제언어결과실행 시간메모리
477799AdamGSLast supper (IOI12_supper)C++14
100 / 100
84 ms7256 KiB
#include "advisor.h" #include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=1e5+7; int kiedy[LIM], nxt[LIM], on[LIM], uzyte[2*LIM]; void ComputeAdvice(int *c, int n, int k, int m) { rep(i, n) kiedy[i]=n; for(int i=n-1; i>=0; --i) { nxt[i]=kiedy[c[i]]; kiedy[c[i]]=i; } priority_queue<pair<int,pair<int,int>>>q; rep(i, k) { on[i]=1; q.push({kiedy[i], {i, i}}); } rep(i, n) { if(!on[c[i]]) { int a=q.top().nd.st, b=q.top().nd.nd; q.pop(); uzyte[b]=1; on[a]=0; } on[c[i]]=1; q.push({nxt[i], {c[i], i+k}}); } rep(i, n+k) WriteAdvice(uzyte[i]); }
#include "assistant.h" #include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=1e5+7; int xd[LIM]; void Assist(unsigned char *A, int n, int k, int r) { queue<int>q; rep(i, k) { xd[i]=1; if(A[i]) q.push(i); } rep(i, n) { int a=GetRequest(); if(!xd[a]) { int p=q.front(); q.pop(); PutBack(p); xd[a]=1; xd[p]=0; } if(A[k+i]) q.push(a); } }
#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...