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>
#include "seats.h"
using namespace std;
int H, W;
vector<int> R, C;
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 ans = 0, minR = H - 1, maxR = 0, minC = W - 1, maxC = 0;
for(int i = 0; i < H * W; i++) {
minR = min(minR, R[i]);
maxR = max(maxR, R[i]);
minC = min(minC, C[i]);
maxC = max(maxC, C[i]);
if((maxR - minR + 1) * (maxC - minC + 1) == i + 1) {
ans++;
}
}
return ans;
}
# | 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... |