Submission #819859

#TimeUsernameProblemLanguageResultExecution timeMemory
819859Marco_EscandonFountain Parks (IOI21_parks)C++17
0 / 100
1 ms340 KiB
#include "parks.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; ll cad[7][200004]={ }; int construct_roads(std::vector<int> x, std::vector<int> y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } ll n=x.size(); for(int i=0; i<n; i++) { cad[x[i]][y[i]]=i+1; } n=200001; std::vector<int> u, v, a, b; ll pl=0; ll pl2=0; for(int i=2; i<n; i+=2) { if(cad[2][i]==0&&cad[4][i]==0&&cad[6][i]==0) { if(pl==1) { if(pl==1) pl2=1; } } else pl=1; if(cad[2][i]!=0&&cad[2][i+2]!=0) { u.push_back(cad[2][i]-1); v.push_back(cad[2][i+2]-1); a.push_back(1); b.push_back(i+1); } if(cad[6][i]!=0&&cad[6][i+2]!=0) { u.push_back(cad[6][i]-1); v.push_back(cad[6][i+2]-1); a.push_back(7); b.push_back(i+1); } } for(int i=2; i<n; i+=2) { if(cad[4][i]!=0&&cad[4][i+2]==0) { if(cad[2][i]!=0) { u.push_back(cad[2][i]-1); v.push_back(cad[4][i]-1); a.push_back(3); b.push_back(i+1); } if(cad[6][i]!=0) { u.push_back(cad[4][i]-1); v.push_back(cad[6][i]-1); a.push_back(5); b.push_back(i+1); } } else if(cad[4][i]!=0&&cad[2][i+2]==0&&cad[2][i]!=0&&cad[6][i+2]==0&&cad[6][i]!=0) { u.push_back(cad[4][i]-1); v.push_back(cad[4][i+2]-1); a.push_back(3); b.push_back(i+1); u.push_back(cad[2][i]-1); v.push_back(cad[4][i]-1); a.push_back(3); b.push_back(i-1); u.push_back(cad[6][i]-1); v.push_back(cad[4][i]-1); a.push_back(5); b.push_back(i+1); } else if(cad[4][i]!=0&&cad[2][i+2]==0&&cad[2][i]!=0) { u.push_back(cad[4][i]-1); v.push_back(cad[4][i+2]-1); a.push_back(5); b.push_back(i+1); u.push_back(cad[2][i]); v.push_back(cad[4][i]); a.push_back(3); b.push_back(i+1); } else if(cad[4][i]!=0&&cad[6][i+2]==0&&cad[6][i]!=0) { u.push_back(cad[4][i]-1); v.push_back(cad[4][i+2]-1); a.push_back(3); b.push_back(i+1); u.push_back(cad[6][i]-1); v.push_back(cad[4][i]-1); a.push_back(5); b.push_back(i+1); } else if(cad[4][i]!=0&&cad[4][i+2]!=0) { u.push_back(cad[4][i]-1); v.push_back(cad[4][i+2]-1); a.push_back(5); b.push_back(i+1); } } /*for(int i=0; i<a.size(); i++) { cout<<u[i]<<" "<<v[i]<<" "<<a[i]<<" "<<b[i]<<"\n"; }*/ build(u, v, a, b); return 1; }

Compilation message (stderr)

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:19:8: warning: variable 'pl2' set but not used [-Wunused-but-set-variable]
   19 |     ll pl2=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...