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 <iostream>
#include "seats.h"
//#define DEBUG
#ifdef DEBUG
#define watch(x) cerr<<#x<<": "<<(x)<<endl
#define watcharr(x,N) cerr<<#x<<": ";for (int i=0; i<N; i++)cerr<<(x)[i]<<' ';cerr<<endl
#else
#define watch(x)
#define watcharr(x,N)
#endif
using namespace std;
using vi = vector<int>;
int H, W;
vi R, C;
void give_initial_chart(int _H, int _W, vi _R, vi _C) {
H = _H;
W = _W;
R = _R;
C = _C;
}
int swap_seats(int a, int b) {
watch(a);
watch(b);
watcharr(R,H*W);
watcharr(C,H*W);
swap(R[a], R[b]);
swap(C[a], C[b]);
watcharr(R,H*W);
watcharr(C,H*W);
int minRow, minCol, maxRow, maxCol;
minRow = minCol = H*W;
maxRow = maxCol = -1;
int beautifulRects = 0;
for (int i=0; i<H*W; i++) {
minRow = min(minRow, R[i]);
minCol = min(minCol, C[i]);
maxRow = max(maxRow, R[i]);
maxCol = max(maxCol, C[i]);
watch(minRow);
watch(maxRow);
watch(minCol);
watch(maxCol);
int expectedSize = i+1;
int size = (maxRow - minRow + 1) * (maxCol - minCol + 1);
watch(i);
watch(size);
watch(expectedSize);
if (size == expectedSize) {
beautifulRects++;
}
}
return beautifulRects;
}
# | 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... |