Submission #894825

#TimeUsernameProblemLanguageResultExecution timeMemory
894825Faisal_SaqibFountain Parks (IOI21_parks)C++17
5 / 100
69 ms15868 KiB
#include <vector> #include <algorithm> using namespace std; void build(std::vector<int> u, std::vector<int> v, std::vector<int> a, std::vector<int> b); int construct_roads(std::vector<int> x, std::vector<int> y) { int n=x.size(); vector<int> u,v,a,b; vector<vector<int>> cp; for(int i=0;i<n;i++) cp.push_back({y[i],x[i],i}); sort(begin(cp),end(cp)); for(int i=0;(i+1)<n;i++) { // go from y[i] to y[i+1] if((cp[i+1][0]-cp[i][0]) != 2) return 0; u.push_back(cp[i][2]); v.push_back(cp[i+1][2]); a.push_back(cp[i][1]-1); b.push_back(cp[i][0]+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...