Submission #294176

#TimeUsernameProblemLanguageResultExecution timeMemory
294176SaboonSeats (IOI18_seats)C++17
11 / 100
4102 ms24312 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; int n, h, w; vector<int> r, c; int MxC[4*maxn], MxR[4*maxn], MnC[4*maxn], MnR[4*maxn]; void give_initial_chart(int H, int W, vector<int> R, vector<int> C){ h = H, w = W, r = R, c = C; n = h*w; } int swap_seats(int a, int b){ swap(r[a],r[b]); swap(c[a],c[b]); int MnR = r[0], MxR = r[0], MnC = c[0], MxC = c[0]; int cnt = 0; for (int i = 0; i < n; i++){ MnR = min(MnR, r[i]); MxR = max(MxR, r[i]); MnC = min(MnC, c[i]); MxC = max(MxC, c[i]); int T = (MxR-MnR+1)*(MxC-MnC+1); if (T == i+1) cnt ++; } return cnt; }
#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...