Submission #1058957

#TimeUsernameProblemLanguageResultExecution timeMemory
1058957qwushaFountain Parks (IOI21_parks)C++17
5 / 100
34 ms9700 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second typedef long double ld; const ld eps = 1e-8; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const ll inf = 1e18; const ll mod = 1e9 + 7; #include "parks.h" int construct_roads(vector<int> x, vector<int> y) { bool fir = 1, sec = 1, thi = 1; int n = x.size(); for (int i = 0; i < n; i++) { if (x[i] != 2) fir = 0; } if (fir) { vector<pair<int, int>> s(n); for (int i = 0; i < n; i++) { s[i] = {y[i], i}; } sort(s.begin(), s.end()); vector<int> u(n - 1), v(n - 1), a(n - 1, 1), b(n - 1); bool ok = 1; for (int i = 1; i < n; i++) { if (s[i].fi != s[i - 1].fi + 2) { ok = 0; } u[i - 1] = s[i - 1].se; v[i - 1] = s[i].se; b[i - 1] = s[i - 1].fi + 1; } if (!ok) { return 0; } else { build(u,v,a,b); return 1; } } } /* int main() { vector<int> r = {0, 1, 1, 2, 2, 1, 2}, u = {0, 0, 1, 1, 2, 3, 3, 4, 4, 5}, v = {1, 2, 2, 3, 3, 4, 5, 5, 6, 6}, c = {0, 0, 1, 0, 0, 1, 2, 0, 2, 1}; auto res = find_reachable(r,u,v,c); for (int i = 0; i < r.size(); i++) { cout << res[i] << ' '; } } */

Compilation message (stderr)

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:16:19: warning: unused variable 'sec' [-Wunused-variable]
   16 |     bool fir = 1, sec = 1, thi = 1;
      |                   ^~~
parks.cpp:16:28: warning: unused variable 'thi' [-Wunused-variable]
   16 |     bool fir = 1, sec = 1, thi = 1;
      |                            ^~~
parks.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
#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...