Submission #425957

#TimeUsernameProblemLanguageResultExecution timeMemory
425957TryMaxSeats (IOI18_seats)C++17
11 / 100
4104 ms39752 KiB
#include "seats.h" #include <bits/stdc++.h> #ifdef LOCAL #include "grader.cpp" #endif // LOCAL using namespace std; const int inf = 1e9 + 10; int h, w; vector<int> x, y; void give_initial_chart(int H, int W, vector<int> R, vector<int> C){ h = H; w = W; x = R; y = C; } int swap_seats(int a, int b){ swap(x[a], x[b]); swap(y[a], y[b]); int ans = 0; int minx = inf, maxx = -inf, miny = inf, maxy = -inf; for(int i = 0; i < h * w; ++i){ minx = min(minx, x[i]); maxx = max(maxx, x[i]); miny = min(miny, y[i]); maxy = max(maxy, y[i]); if((maxx - minx + 1) * (maxy - miny + 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...