Submission #118288

#TimeUsernameProblemLanguageResultExecution timeMemory
118288joseacazSeats (IOI18_seats)C++17
11 / 100
4040 ms24312 KiB
#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 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...