이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
vector<int> row, col;
int h, w;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
row = R;
col = C;
h = H;
w = W;
}
int swap_seats(int A, int B) {
swap(row[A], row[B]);
swap(col[A], col[B]);
// cout << "=== " << A << ' ' << B << '\n';
// cout << row[A] << ' '<< col[A] << ' ' << row[B] << ' ' << col[B] << '\n';
int ans = 0, l = w-1, r = 0, t = h-1, b = 0;
for (int i = 0; i < h*w; i++) {
// cout << col[i] << ' ' << row[i] << '\n';
l = min(l, col[i]);
t = min(t, row[i]);
r = max(r, col[i]);
b = max(b, row[i]);
// cout << l << ' ' << r << '\n';
// cout << t << ' ' << b << '\n';
if (i+1 == (r-l+1)*(b-t+1)) {
// cout << i << ' ';
ans++;
}
}
// cout << "===\n";
// cout << '\n';
return ans;
}
/*
2 3 2
0 0
1 0
1 1
0 1
0 2
1 2
0 5
0 5
*/
# | 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... |