Submission #1062878

#TimeUsernameProblemLanguageResultExecution timeMemory
1062878fv3Fountain Parks (IOI21_parks)C++17
5 / 100
53 ms10232 KiB
#include "parks.h" #include <bits/stdc++.h> using namespace std; int construct_roads(vector<int> x, vector<int> y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } // x[i] = 2 const int N = x.size(); vector<pair<int, int>> h(N); for (int i = 0; i < N; i++) h[i] = {y[i], i}; sort(h.begin(), h.end()); vector<int> u(N-1), v(N-1), a(N-1), b(N-1); for (int i = 0; i < N - 1; i++) { if (h[i].first + 2 != h[i+1].first) return 0; u[i] = h[i].second; v[i] = h[i+1].second; a[i] = x[0] - 1; b[i] = h[i].first + 1; } build(u, v, a, b); return 1; }
#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...