이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
#define m_p make_piar
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 1000006;
int n, m;
int x[N], y[N];
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)
{
x[i] = R[i];
y[i] = C[i];
}
}
int swap_seats(int a, int b)
{
swap(x[a], x[b]);
swap(y[a], y[b]);
int minx = x[0];
int maxx = x[0];
int miny = y[0];
int maxy = y[0];
int ans = 0;
for (int i = 0; i < n * m; ++i)
{
minx = min(minx, x[i]);
maxx = max(maxx, x[i]);
miny = min(miny, y[i]);
maxy = max(maxy, y[i]);
if ((maxx - minx + 1) * (maxy - miny + 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... |