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;
vector<int> r, c;
vector<vector<int>> grid;
int h, w;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C)
{
h = H;
w = W;
r = R, c = C;
}
int swap_seats(int a, int b)
{
swap(r[a], r[b]);
swap(c[a], c[b]);
int cmx = c[0], cmn = c[0], rmx = r[0], rmn = r[0];
int ans = 1;
// cout << rmx << " " << rmn << '\n';
// cout << cmx << " " << cmn << '\n';
// cout << '\n';
for (int i = 1; i < h * w; i++)
{
cmx = max(cmx, c[i]), cmn = min(cmn, c[i]);
rmx = max(rmx, r[i]), rmn = min(rmn, r[i]);
// cout << rmx << " " << rmn << '\n';
// cout << cmx << " " << cmn << '\n';
// cout << '\n';
int sz = (abs(rmx - rmn) + 1) * (abs(cmx - cmn) + 1);
ans += (sz == 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... |