Submission #7617

#TimeUsernameProblemLanguageResultExecution timeMemory
7617baneling100Last supper (IOI12_supper)C++98
0 / 100
107 ms7648 KiB
#include "advisor.h" #include <algorithm> #include <queue> #define INF 0x7fffffff using namespace std; typedef pair <int,int> ppair; typedef pair <int,ppair> pppair; static priority_queue <pppair> Q; static int Time[200000], Check[100000], Out[200000]; void ComputeAdvice(int *C, int N, int K, int M) { int i, Temp1, Temp2; for(i=0 ; i<N ; i++) Check[i]=INF; for(i=N-1 ; i>=0 ; i--) { Time[K+i]=Check[C[i]]; Check[C[i]]=K+i; } for(i=K-1 ; i>=0 ; i--) Time[i]=Check[i]; for(i=0 ; i<N ; i++) Check[i]=0; for(i=0 ; i<K ; i++) { Q.push(make_pair(Time[i],make_pair(i,i))); Check[i]=1; } for(i=0 ; i<N ; i++) if(!Check[C[i]]) { Check[C[i]]=1; Temp1=Q.top().second.first; Temp2=Q.top().second.second; Q.pop(); Check[Temp1]=0; Out[Temp2]=1; Q.push(make_pair(Time[K+i],make_pair(C[i],K+i))); } for(i=0 ; i<N+K ; i++) WriteAdvice(Out[i]); }
#include "assistant.h" #include <algorithm> #include <queue> using namespace std; typedef pair <int,int> ppair; static priority_queue <ppair> Q; static int Check[100000]; void Assist(unsigned char *A, int N, int K, int R) { int i, Temp1, Temp2; for(i=0 ; i<K ; i++) { Q.push(make_pair(A[i],i)); Check[i]=1; } for(i=0 ; i<N ; i++) { Temp1=GetRequest(); if(!Check[Temp1]) { Check[Temp1]=1; Temp2=Q.top().second; Q.pop(); Check[Temp2]=0; PutBack(Temp2); Q.push(make_pair(A[K+i],Temp1)); } } }
#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...