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>
#define f0r(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
using namespace std;
vector<pair<int,int>>v;
int h, w;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h = H;
w = W;
f0r(i, H * W){
v.pb({R[i], C[i]});
}
}
int swap_seats(int a, int b) {
swap(v[a], v[b]);
pii x = {v[0].first, v[0].first};
pii y = {v[0].second, v[0].second};
int ans = 0;
f0r(i, h*w){
x.first = min(v[i].first, x.first);
x.second = max(v[i].first, x.second);
y.first = min(v[i].second, y.first);
y.second = max(v[i].second, y.second);
if((x.second - x.first + 1) * (y.second - y.first + 1) == i+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... |