Submission #621349

#TimeUsernameProblemLanguageResultExecution timeMemory
621349JomnoiSeats (IOI18_seats)C++17
11 / 100
4043 ms40748 KiB
#include <bits/stdc++.h> #include "seats.h" 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, R = r, C = c; } int swap_seats(int a, int b) { swap(R[a], R[b]), swap(C[a], C[b]); int ans = 0, minR = H - 1, maxR = 0, minC = W - 1, maxC = 0; for(int i = 0; i < H * W; i++) { minR = min(minR, R[i]); maxR = max(maxR, R[i]); minC = min(minC, C[i]); maxC = max(maxC, C[i]); if((maxR - minR + 1) * (maxC - minC + 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...