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"
#define pb push_back
using namespace std;
vector<int> r;
vector<int> c;
int h, w;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
h = H; w = W;
for(int i=0;i<H*W;i++) {
r.pb(R[i]);
c.pb(C[i]);
}
}
int swap_seats(int a, int b) {
swap(r[a], r[b]);
swap(c[a], c[b]);
int max_x = INT_MIN, min_x = INT_MAX;
int max_y = INT_MIN, min_y = INT_MAX;
int br = 0;
for(int i=0;i<h*w;i++) {
max_x = max(max_x, r[i]);
min_x = min(min_x, r[i]);
max_y = max(max_y, c[i]);
min_y = min(min_y, c[i]);
if(i + 1 == (max_x-min_x+1)*(max_y-min_y+1)) {
br++;
}
}
return br;
}
# | 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... |