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"
typedef long long int64;
using namespace std;
vector<int> r,c;
const int maxn = 1e4 + 2;
int n = 0, m = 0;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
for (int i = 0; i < H * W; i++){
R[i]++;
C[i]++;
}
r = R, c = C, n = H, m = W;
}
int swap_seats(int a, int b) {
swap(r[a], r[b]);
swap(c[a], c[b]);
int ll = c[0], rr = c[0], uu = r[0], dd = r[0];
int rs = 1;
for (int i = 1; i < n * m; i++){
ll = min(ll, c[i]);
rr = max(rr, c[i]);
uu = min(uu, r[i]);
dd = max(dd, r[i]);
// cout << i << " " << ll << " " << rr << " " << uu << " " << dd << "\n";
if ((rr - ll + 1) * (dd - uu + 1) == i + 1) rs++;
}
return rs;
}
# | 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... |