Submission #102341

#TimeUsernameProblemLanguageResultExecution timeMemory
102341naoaiLast supper (IOI12_supper)C++14
0 / 100
82 ms6536 KiB
#include "advisor.h" #include <bits/stdc++.h> using namespace std; const int nmax = 1e5; int f[nmax + 1]; int lst[nmax + 1]; bool adv[2 * nmax + 1]; void ComputeAdvice(int *v, int N, int K, int M) { for (int i = 0; i < N; ++ i) lst[i] = 1 << 30; int ind = N - 1; int total = 0; for (int i = N - 1; i >= 0; -- i) { while (ind >= i && total > K) { -- f[v[ind]]; if (f[v[ind]] == 0) -- total; -- ind; } if (total == K && lst[v[i]] > ind) { adv[i + K] = 1; } if (f[v[i]] == 0) ++ total; ++ f[v[i]]; lst[v[i]] = i; } for (int i = K - 1; i >= 0; -- i) { while (ind >= i && total > K) { -- f[v[ind]]; if (f[v[ind]] == 0) -- total; -- ind; } if (total == K && lst[i] > ind) { adv[i] = 1; } } for (int i = 0; i < N + K; ++ i) { WriteAdvice(adv[i]); //cout << adv[i] << "\n"; } }
#include "assistant.h" #include <bits/stdc++.h> using namespace std; const int nmax = 1e5; bool viz[nmax + 1]; queue<int> q; void Assist(unsigned char *A, int N, int K, int R) { for (int i = 0; i < K; ++ i) { viz[i] = 1; if (A[i] == 1) q.push(i); } for (int i = 0; i < N; ++ i) { int c = GetRequest(); if (viz[c] == 0) { assert(q.size()); PutBack(q.front()); viz[q.front()] = 0; q.pop(); } viz[c] = 1; if (A[i + K] == 1) q.push(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...