이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
#define INF (1 << 30)
using namespace std;
int H, W;
vector <int> R, C;
void give_initial_chart ( int _h, int _w, vector <int> _r, vector <int> _c )
{
H = _h;
W = _w;
swap ( R, _r );
swap ( C, _c );
}
int swap_seats ( int a, int b )
{
swap ( R[a], R[b] );
swap ( C[a], C[b] );
int maximR = -1, minimR = INF;
int maximC = -1, minimC = INF;
int ans = 0;
for ( int i = 0; i < H * W; i++ )
{
maximR = max ( maximR, R[i] );
minimR = min ( minimR, R[i] );
maximC = max ( maximC, C[i] );
minimC = min ( minimC, C[i] );
if ( (maximR - minimR + 1) * (maximC - minimC + 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... |