# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
556043 | 2022-05-02T08:54:58 Z | fuad27 | Graph (BOI20_graph) | C++17 | 1 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; struct edge { int u=0, v=0, type=0; }; const int MAXN = 6, MAXM = 15; int n, m; vector<edge> e(MAXM); vector<int> curr(MAXN); bool brute(int in) { if(in == n) { for(int i = 0;i<m;i++) { if(curr[e[i].u] + curr[e[i].v] != 2*e[i].type)return false; } return true; } else { bool check = true; for(int i = -4;i<=4;i++) { curr[in] = i; if(brute(in+1))return true; } } return false; } int main () { cin >> n >> m; for(int i = 0;i<m;i++) { cin >> e[i].u >> e[i].v >> e[i].type; e[i].u--, e[i].v--; } if(n <= 5 and m<=14) { if(!brute(0))cout << "NO\n"; else { cout << "YES\n"; for(int i = 0;i<n;i++) { cout << 0.5*curr[i] << " "; } cout << "\n"; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | answer = YES |
2 | Incorrect | 0 ms | 212 KB | participant answer is larger than the answer of jury |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | answer = YES |
2 | Incorrect | 0 ms | 212 KB | participant answer is larger than the answer of jury |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | answer = YES |
2 | Incorrect | 0 ms | 212 KB | participant answer is larger than the answer of jury |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | answer = YES |
2 | Incorrect | 0 ms | 212 KB | participant answer is larger than the answer of jury |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | answer = YES |
2 | Incorrect | 0 ms | 212 KB | participant answer is larger than the answer of jury |
3 | Halted | 0 ms | 0 KB | - |