Submission #777166

#TimeUsernameProblemLanguageResultExecution timeMemory
777166GusterGoose27Seats (IOI18_seats)C++17
11 / 100
4064 ms40752 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int MAXN = 1e6+5; int h, w, n; pii points[MAXN]; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { h = H; w = W; n = h*w; for (int i = 0; i < n; i++) { points[i] = pii(R[i], C[i]); } } int swap_seats(int a, int b) { swap(points[a], points[b]); int l = h, r = 0, u = w, d = 0; int ans = 0; for (int i = 0; i < n; i++) { l = min(l, points[i].first); r = max(r, points[i].first); u = min(u, points[i].second); d = max(d, points[i].second); ans += ((r-l+1)*(d-u+1) == i+1); } return ans; }
#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...