이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Pantyhose(black) + glasses = infinity
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
const int MAX_N = 1000002;
int h, w, n;
pair<int, int> p[MAX_N];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h = H;
w = W;
n = R.size();
for (int i=0; i<n; ++i)
p[i] = {R[i], C[i]};
}
int swap_seats(int a, int b) {
swap(p[a], p[b]);
int res = 0;
int l = h, r = 0, u = w, d = 0;
for (int i=0; i<n; ++i) {
l = min(l, p[i].first);
r = max(r, p[i].first);
u = min(u, p[i].second);
d = max(d, p[i].second);
res += ((r - l + 1) * (d - u + 1)==i+1);
}
return res;
}
# | 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... |