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 ll long long
#define pii pair<int, int>
using namespace std;
const int MAX = 1e5 + 5;
const int oo = 1e9 + 9;
int n;
int h, w;
pii mp[MAX];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
n = R.size();
h = H;
w = W;
for (int i = 0; i < n; i++)
{
mp[i] = {R[i], C[i]};
}
}
int swap_seats(int a, int b) {
swap(mp[a], mp[b]);
int mnR = oo, mxR = -oo, mnC = oo, mxC = -oo;
int ans = 0;
cout << '\n';
for (int i = 0; i < n; i++)
{
mxR = max(mxR, mp[i].first);
mxC = max(mxC, mp[i].second);
mnR = min(mnR, mp[i].first);
mnC = min(mnC, mp[i].second);
int r = mxR - mnR + 1;
int c = mxC - mnC + 1;
if(r * c == 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... |