Submission #807971

#TimeUsernameProblemLanguageResultExecution timeMemory
807971Minindu206Seats (IOI18_seats)C++14
11 / 100
4066 ms24140 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; vector<int> r, c; vector<vector<int>> grid; int h, w; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { h = H; w = W; r = R, c = C; } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); int cmx = c[0], cmn = c[0], rmx = r[0], rmn = r[0]; int ans = 1; // cout << rmx << " " << rmn << '\n'; // cout << cmx << " " << cmn << '\n'; // cout << '\n'; for (int i = 1; i < h * w; i++) { cmx = max(cmx, c[i]), cmn = min(cmn, c[i]); rmx = max(rmx, r[i]), rmn = min(rmn, r[i]); // cout << rmx << " " << rmn << '\n'; // cout << cmx << " " << cmn << '\n'; // cout << '\n'; int sz = (abs(rmx - rmn) + 1) * (abs(cmx - cmn) + 1); ans += (sz == 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...