This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Pantyhose(black) + glasses = infinity
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
const int MAX_N = 1000002;
int h, w, n;
pair<int, int> p[MAX_N];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h = H;
w = W;
n = R.size();
for (int i=0; i<n; ++i)
p[i] = {R[i], C[i]};
}
int swap_seats(int a, int b) {
swap(p[a], p[b]);
int res = 0;
int l = h, r = 0, u = w, d = 0;
for (int i=0; i<n; ++i) {
l = min(l, p[i].first);
r = max(r, p[i].first);
u = min(u, p[i].second);
d = max(d, p[i].second);
res += ((r - l + 1) * (d - u + 1)==i+1);
}
return res;
}
# | 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... |