제출 #290580

#제출 시각아이디문제언어결과실행 시간메모리
290580gabrc52자리 배치 (IOI18_seats)C++14
11 / 100
4094 ms24312 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...