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"
using namespace std;
typedef long long ll;
int n, w, h;
vector<int> x, y;
void give_initial_chart(int h1, int w1, vector<int> r, vector<int> c) {
w = w1; h = h1;
n = h*w;
x = c; y = r;
}
int swap_seats(int a, int b) {
swap(x[a], x[b]);
swap(y[a], y[b]);
int res = 1;
int left = x[0], right = x[0], top = y[0], bot = y[0];
for (int i = 1; i < n; i++) {
left = min(left, x[i]);
right = max(right, x[i]);
top = min(top, y[i]);
bot = max(bot, y[i]);
if ((right-left+1) * (bot-top+1) == i+1) res++;
}
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... |