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 "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++;
}
}
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... |