This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Be name khode //
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define all(x) x.begin(), x.end()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
const int maxn = 1e6 + 10;
const int lg = 20;
std::vector<int> r;
int n, m;
pair <int, int> a[maxn];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
n = H;
m = W;
for(int i = 0; i < n * m; i++)
a[i] = {R[i], C[i]};
}
int swap_seats(int x, int y) {
swap(a[x], a[y]);
pair <int, int> h, w;
h = {a[0].fi, a[0].fi};
w = {a[0].se, a[0].se};
int ans = 0;
for(int i = 0; i < n * m; i++){
h.fi = max(h.fi, a[i].fi);
h.se = min(h.se, a[i].fi);
w.fi = max(w.fi, a[i].se);
w.se = min(w.se, a[i].se);
if((h.fi - h.se + 1) * (w.fi - w.se + 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... |