Submission #1021370

#TimeUsernameProblemLanguageResultExecution timeMemory
1021370WaelFountain Parks (IOI21_parks)C++17
5 / 100
158 ms23932 KiB
#include "parks.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; int construct_roads(vector<int> x, vector<int> y) { int n = x.size(); int N = 2e5; vector<map<int, int>> id(N + 1); for (int i = 0; i < n; ++i) { id[x[i]][y[i]] = i; } int cnt = 0; vector<int> u, v, a, b; for (int i = 0; i < n; ++i) { if (id[x[i]].count(y[i] + 2)) { u.push_back(i); v.push_back(id[x[i]][y[i] + 2]); a.push_back(x[i] + 1); b.push_back(y[i] + 1); ++cnt; } } if (cnt == n - 1) { build(u, v, a, b); return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...