| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1355231 | kasamchi | Voltage 2 (JOI26_voltage) | C++20 | 10 ms | 896 KiB |
#include "voltage.h"
#include <bits/stdc++.h>
using namespace std;
bool solve(int N, int M) {
queue<int> quu;
vector<bool> vis(N);
for (int i = 0; i < N; i++) {
vector<int> x(N, 1), y(N, 1);
x[i] = 0;
if (query(x, y) == 0) {
quu.push(i), vis[i] = true;
}
}
while (!quu.empty()) {
int u = quu.front();
quu.pop();
cerr << "BFS: " << u << '\n';
vector<int> cands;
for (int i = 0; i < N; i++) {
if (!vis[i]) {
cands.push_back(i);
}
}
int ll = 0, rr = cands.size() + 1;
while (ll + 1 < rr) {
int mm = ll + (rr - ll) / 2;
vector<int> x(N, 1), y(N, 1);
for (int i = 0; i < mm; i++) {
x[cands[i]] = y[cands[i]] = 0;
}
for (int i = 0; i < N; i++) {
if (vis[i]) {
x[i] = y[i] = 0;
}
}
x[u] = 1;
if (query(x, y) == 0) {
ll = mm;
} else {
rr = mm;
}
}
if (rr < cands.size() + 1) {
int v = cands[rr - 1];
answer(u, v);
cerr << "answer(" << u << ',' << v << ")\n";
quu.push(v), vis[v] = true;
M--;
}
}
return (M == 0);
}
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
