| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370401 | pcheloveks | Voltage 2 (JOI26_voltage) | C++20 | 27 ms | 676 KiB |
#include "voltage.h"
using namespace std;
bool checkIsLeaf(int val, int n, vector < int >& s) {
vector < int > a(n, 1), b(n, 0);
for(auto x: s) {
a[x] = 0;
}
a[val] = 0;
int tmp = query(a, b);
return (query(a, b) == 0);
}
bool solve(int N, int M) {
vector < int > s;
vector < bool > inSet(N, false);
vector < pair < int, int > > res;
while(s.size() != N) {
bool flag = false;
for(int i = 0; i < N; i++) {
if(inSet[i]) continue;
if(checkIsLeaf(i, N, s)) {
flag = true;
vector < int > prev(N, 1);
vector < int > curr(N, 1);
for(auto x: s) {
prev[x] = 0;
curr[x] = 0;
}
prev[i] = 0; curr[i] = 0;
for(int j = s.size() - 1; j >= 0; j--) {
curr[s[j]] = 1;
if(query(curr, prev) == -1) {
res.push_back({s[j], i});
}
prev = curr;
}
s.push_back(i);
inSet[i] = true;
}
}
if(!flag) return false;
}
for(auto x: res) answer(x.first, x.second);
return true;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
