This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |