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"
// #include "grader.cpp"
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define OK puts("ok");
using namespace std;
const int N = (int)1e6 + 7;
pair < int, int > pos[N];
int h, w;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
tie(h, w) = make_tuple(H, W);
for (int i = 0; i < H * W; i++) {
pos[i] = mk(R[i], C[i]);
}
}
int swap_seats(int a, int b) {
swap(pos[a], pos[b]);
int mnx, mxx, mny, mxy;
mnx = mny = N;
mxx = mxy = 0;
int ans = 0;
for (int i = 0; i < h * w; i++) {
mnx = min(mnx, pos[i].fr);
mxx = max(mxx, pos[i].fr);
mny = min(mny, pos[i].sc);
mxy = max(mxy, pos[i].sc);
if (i + 1 == (mxx - mnx + 1) * (mxy - mny + 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... |