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;
typedef pair<int, int> pii;
const int MAXN = 1e6+5;
int h, w, n;
pii points[MAXN];
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
h = H;
w = W;
n = h*w;
for (int i = 0; i < n; i++) {
points[i] = pii(R[i], C[i]);
}
}
int swap_seats(int a, int b) {
swap(points[a], points[b]);
int l = h, r = 0, u = w, d = 0;
int ans = 0;
for (int i = 0; i < n; i++) {
l = min(l, points[i].first);
r = max(r, points[i].first);
u = min(u, points[i].second);
d = max(d, points[i].second);
ans += ((r-l+1)*(d-u+1) == i+1);
}
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... |