# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053118 | 2024-08-11T08:54:15 Z | vnm06 | Fountain Parks (IOI21_parks) | C++17 | 1 ms | 6744 KB |
#include "parks.h" #include<bits/stdc++.h> using namespace std; bool pos[200004]; int used[3][200004]; vector<int> gr[200004]; void dfs(int v) { pos[v]=1; int brs=gr[v].size(); for(int i=0; i<brs; i++) { int nv=gr[v][i]; if(!pos[nv]) dfs(nv); } } int construct_roads(std::vector<int> x, std::vector<int> y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } std::vector<int> u, v, a, b; for(int i=0; i<x.size(); i++) { used[x[i]/2-1][y[i]]=i+1; } for(int i=2; i<=200000; i+=2) { if(used[0][i] && used[0][i+2]) { u.push_back(used[0][i]-1); v.push_back(used[0][i+2]-1); a.push_back(1); b.push_back(i+1); } if(used[1][i] && used[1][i+2]) { u.push_back(used[1][i]-1); v.push_back(used[1][i+2]-1); a.push_back(5); b.push_back(i+1); } if(used[1][i] && used[0][i]) { u.push_back(used[1][i]-1); v.push_back(used[0][i]-1); a.push_back(3); b.push_back(i+1); } } for(int i=0; i<u.size(); i++) { gr[u[i]].push_back(v[i]); gr[v[i]].push_back(u[i]); } dfs(0); for(int i=0; i<x.size(); i++) if(!pos[i]) return 0; return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6744 KB | Output is correct |
2 | Incorrect | 1 ms | 6744 KB | Wrong answer detected in grader |
3 | Halted | 0 ms | 0 KB | - |