This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |