Submission #814285

#TimeUsernameProblemLanguageResultExecution timeMemory
814285PixelCatFountain Parks (IOI21_parks)C++17
5 / 100
106 ms16332 KiB
#include "parks.h" #ifdef NYAOWO #include "grader.cpp" #endif #include <bits/stdc++.h> #define For(i, a, b) for(int i = a; i <= b; i++) #define Forr(i, a, b) for(int i = a; i >= b; i--) #define F first #define S second #define sz(x) ((int)x.size()) #define all(x) x.begin(), x.end() #define eb emplace_back // #define int LL using namespace std; using i32 = int32_t; using LL = long long; using pii = pair<int, int>; struct PT { int id, x, y; }; int construct_roads(std::vector<int> X, std::vector<int> Y) { if (sz(X) == 1) { build({}, {}, {}, {}); return 1; } int n = sz(X); vector<PT> v; For(i, 0, n - 1) { v.push_back({i, X[i], Y[i]}); } sort(all(v), [&](const PT &p1, const PT &p2) { return p1.y < p2.y; }); vector<int> U, V, A, B; For(i, 1, n - 1) { if(v[i].y - v[i - 1].y > 2) return 0; U.eb(v[i - 1].id); V.eb(v[i].id); A.eb(1); B.eb(v[i].y - 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...