| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 591992 | cheissmart | 최후의 만찬 (IOI12_supper) | C++14 | 180 ms | 9668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "advisor.h"
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define IO_OP ios::sync_with_stdio(0), cin.tie(0)
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7;
void ComputeAdvice(int *a, int n, int k, int m) {
vi next_occ(n, INF), nxt(n);
for(int i = n - 1; i >= 0; i--) {
nxt[i] = next_occ[a[i]];
next_occ[a[i]] = i;
}
set<pi> s;
set<int> tt;
for(int i = 0; i < k; i++) {
s.insert({next_occ[i], i});
tt.insert(i);
}
V<bool> must(n);
for(int i = 0; i < n; i++) {
if(tt.find(a[i]) != tt.end()) {
must[i] = true;
s.erase({i, a[i]});
s.insert({nxt[i], a[i]});
} else {
must[i] = false;
auto[pos, val] = *s.rbegin();
s.erase({pos, val});
tt.erase(val);
s.insert({nxt[i], a[i]});
tt.insert(a[i]);
}
}
V<bool> aux(n), send;
for(int i = n - 1; i >= 0; i--) {
send.PB(aux[a[i]]);
aux[a[i]] = must[i];
}
for(int i = k - 1; i >= 0; i--) {
send.PB(aux[i]);
}
reverse(ALL(send));
for(bool b:send)
WriteAdvice(b);
}
// WriteAdvice#include "assistant.h"
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define IO_OP ios::sync_with_stdio(0), cin.tie(0)
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7;
void Assist(unsigned char *a, int n, int k, int r) {
set<int> must, not_must;
for(int i = 0; i < k; i++) {
if(a[i]) must.insert(i);
else not_must.insert(i);
}
for(int i = 0; i < n; i++) {
int req = GetRequest();
if(must.count(req)) {
must.erase(req);
} else {
assert(not_must.size());
PutBack(*not_must.begin());
not_must.erase(not_must.begin());
}
if(a[i + k]) must.insert(req);
else not_must.insert(req);
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
