Submission #1059527

#TimeUsernameProblemLanguageResultExecution timeMemory
1059527pccFountain Parks (IOI21_parks)C++17
5 / 100
38 ms9384 KiB
#include "parks.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second int N; int construct_roads(std::vector<int> x, std::vector<int> y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } N = x.size(); vector<pii> v; for(int i = 0;i<N;i++)v.push_back(pii(x[i],y[i])); vector<int> perm(N);iota(perm.begin(),perm.end(),0); sort(perm.begin(),perm.end(),[&](int a,int b){return y[a]<y[b];}); for(int i = 1;i<perm.size();i++){ int now = perm[i],pre = perm[i-1]; if(y[pre]+2 != y[now])return 0; } vector<int> ans[4]; for(int i = 1;i<perm.size();i++){ int pre = perm[i-1],now = perm[i]; ans[0].push_back(pre); ans[1].push_back(now); ans[2].push_back(3); ans[3].push_back((y[now]+y[pre])>>1); } build(ans[0],ans[1],ans[2],ans[3]); return 1; }

Compilation message (stderr)

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:21:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 1;i<perm.size();i++){
      |                ~^~~~~~~~~~~~
parks.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i = 1;i<perm.size();i++){
      |                ~^~~~~~~~~~~~
#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...