이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define TASK ""
#define bit(x) (1LL << (x))
#define getbit(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
template <typename T1, typename T2> bool mini(T1 &a, T2 b) {
if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maxi(T1 &a, T2 b) {
if (a < b) {a = b; return true;} return false;
}
mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r) {
return l + rd() % (r - l + 1);
}
const int N = 1e5 + 5;
const int oo = 1e9;
const long long ooo = 1e18;
const int mod = 1e9 + 7; // 998244353;
const long double pi = acos(-1);
int x[N];
int y[N];
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++)
x[i] = R[i], y[i] = C[i];
}
int brute() {
int ans = 0;
int minx = oo, miny = oo, maxx = -oo, maxy = -oo;
for (int i = 0; i < n * m; i++) {
mini(minx, x[i]);
maxi(maxx, x[i]);
mini(miny, y[i]);
maxi(maxy, y[i]);
int dx = maxx - minx + 1;
int dy = maxy - miny + 1;
ans += (dx * dy == i + 1);
}
return ans;
}
int swap_seats(int a, int b) {
swap(x[a], x[b]);
swap(y[a], y[b]);
if (n * m <= 10000)
return brute();
return -1;
}
//#include "grader.cpp"
# | 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... |