Submission #573430

#TimeUsernameProblemLanguageResultExecution timeMemory
573430piOOERoads (CEOI20_roads)C++17
15 / 100
25 ms4328 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) ((int)size(x)) #define all(x) begin(x), end(x) #define trace(x) cout << #x << ": " << (x) << endl; typedef long long ll; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r) { return (int) ((ll) rnd() % (r - l + 1)) + l; } const int N = 200000, infI = 1e9 + 7; int X[N], Y[N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<int, int>> yy; map<int, vector<pair<int, int>>> mp; for (int i = 0; i < n; ++i) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; X[i << 1] = x1, Y[i << 1] = y1; X[i << 1 | 1] = x2, Y[i << 1 | 1] = y2; yy.emplace_back(x1, y1); yy.emplace_back(x2, y2); mp[x1].emplace_back(min(y1, y2), max(y1, y2)); } sort(all(yy)); auto get_idx = [&yy](int x, int y) { int it = lower_bound(all(yy), make_pair(x, y)) - begin(yy); if (it == sz(yy) || yy[it] != make_pair(x, y)) { return -1; } return it; }; pair<int, int> lst = {-infI, -infI}; for (auto [x, a]: mp) { sort(all(a)); if (lst.first != -infI) { cout << lst.first << " " << lst.second << " " << x << " " << a[0].first << '\n'; } lst = {x, a[0].first}; for (int i = 0; i < sz(a) - 1; ++i) { cout << x << " " << a[i].second << " " << x << " " << a[i + 1].first << '\n'; } } return 0; }

Compilation message (stderr)

roads.cpp: In function 'int main()':
roads.cpp:36:10: warning: variable 'get_idx' set but not used [-Wunused-but-set-variable]
   36 |     auto get_idx = [&yy](int x, int y) {
      |          ^~~~~~~
#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...