Submission #144275

#TimeUsernameProblemLanguageResultExecution timeMemory
144275MinnakhmetovSeats (IOI18_seats)C++14
0 / 100
4017 ms24184 KiB
#include "seats.h" #include<bits/stdc++.h> using namespace std; int n, m; vector<int> x, y; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { n = H; m = W; x = R; y = C; } int swap_seats(int a, int b) { swap(x[a], x[b]); swap(y[a], y[b]); int ans = 0, lx = n, rx = -1, ly = m, ry = -1;; for (int i = 0; i < n * m; i++) { lx = min(lx, x[i]); rx = max(rx, x[i]); ly = min(ly, y[i]); ry = max(ry, y[i]); if (i + 1 == (rx - lx + 1) * (ry - ly + 1)) { ans++; i += min(rx - lx + 1, ry - ly + 1) - 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...