이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
int r, c;
vector<pair<int, int>> where;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
ios::sync_with_stdio(0);
cin.tie(0);
r = H;
c = W;
where.resize(r * c);
for (int i = 0; i < r * c; i++) {
where[i] = {R[i], C[i]};
}
}
int solve() {
int res = 0;
int min_row = 1e9;
int max_row = -1e9;
int min_column = 1e9;
int max_column = -1e9;
for (int i = 0; i < r * c; i++) {
min_row = min(min_row, where[i].first);
max_row = max(max_row, where[i].first);
min_column = min(min_column, where[i].second);
max_column = max(max_column, where[i].second);
res += (((max_row - min_row + 1) * (max_column - min_column + 1)) == (i + 1));
}
return res;
}
int swap_seats(int a, int b) {
swap(where[a], where[b]);
return solve();
}
# | 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... |