Submission #1049101

#TimeUsernameProblemLanguageResultExecution timeMemory
1049101nisanduuFountain Parks (IOI21_parks)C++17
5 / 100
32 ms8340 KiB
#include "parks.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int construct_roads(std::vector<int> x, std::vector<int> y) { ll n = x.size(); vector<pair<int,int>> arr(n); for(int i=0;i<n;i++){ arr[i].first = y[i]; arr[i].second = i; } sort(arr.begin(),arr.end()); vector<int> u, v, a, b; bool f=1; for(ll i=0;i<n-1;i++){ if((arr[i+1].first - arr[i].first) != 2){ return 0; } u.push_back(arr[i+1].second); v.push_back(arr[i].second); a.push_back(1); b.push_back((arr[i+1].first+arr[i].first)/2); } 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:16:10: warning: unused variable 'f' [-Wunused-variable]
   16 |     bool f=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...