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;
int n;
vector<pair<int,int>> v;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
n = H*W;
v.resize(n);
for(int i = 0; i < n; i++){
v[i] = {R[i], C[i]};
}
}
int swap_seats(int x, int y) {
swap(v[x], v[y]);
int ans = 1;
int a = v[0].first, b = v[0].first, c = v[0].second, d = v[0].second;
for(int i = 1; i < n; i++){
a = min(a, v[i].first);
b = max(b, v[i].first);
c = min(c, v[i].second);
d = max(d, v[i].second);
if(i+1 == (b-a+1)*(d-c+1)){
ans++;
}
}
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... |