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 <algorithm>
using namespace std;
int h, w, n;
vector<int> row, col;
int subtask = 6;
// SUBTASK 2
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
h = H, w = W, n = H*W, row = R, col = C;
if (n <= 10000) subtask = 2;
else if (h <= 1000 && w <= 1000) subtask = 3;
else subtask = 4;
}
int swap_seats(int A, int B) {
// if (subtask == 2) {
swap(row[A], row[B]);
swap(col[A], col[B]);
int beauty = 1;
int b = row[0], t = row[0], l = col[0], r = col[0];
for (int i = 1; i < n; ++i) {
b = min(b, row[i]);
t = max(t, row[i]);
l = min(l, col[i]);
r = max(r, col[i]);
if ((t-b+1)*(r-l+1) == (i+1)) ++beauty;
}
return beauty;
// }
}
# | 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... |