Submission #759467

#TimeUsernameProblemLanguageResultExecution timeMemory
759467drdilyorFountain Parks (IOI21_parks)C++17
5 / 100
47 ms7860 KiB
#include "parks.h" #include<bits/stdc++.h> using namespace std; int construct_roads(std::vector<int> x, std::vector<int> y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } int n = x.size(); std::vector<int> u, v, a, b; vector<int> ix(n); iota(ix.begin(), ix.end(), 0); sort(ix.begin(), ix.end(), [&](int a, int b) { return y[a] < y[b]; }); for (int i = 1; i <n; i++) { u.push_back(ix[i-1]); v.push_back(ix[i]); a.push_back(1); b.push_back(y[ix[i]]-1); if (i && y[ix[i]] != y[ix[i-1]]+2) return 0; } 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...