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"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
const int maxn = 1e6+5;
int r[maxn], c[maxn];
int n, m;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C)
{
n = H; m = W;
for(int i = 0; i< n*m; i++)
{
r[i] = R[i];
c[i] = C[i];
}
}
int swap_seats(int a, int b)
{
swap(r[a], r[b]);
swap(c[a], c[b]);
int ans = 0;
int mnr = 1e9, mxr = -1;
int mnc = 1e9, mxc = -1;
for(int i = 0; i< n*m; i++)
{
mnr = min(mnr, r[i]);
mxr = max(mxr, r[i]);
mnc = min(mnc, c[i]);
mxc = max(mxc, c[i]);
if((mxc-mnc+1)*(mxr-mnr+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... |