Submission #409994

#TimeUsernameProblemLanguageResultExecution timeMemory
409994luciocfSeats (IOI18_seats)C++14
0 / 100
421 ms23864 KiB
#include <bits/stdc++.h> #include "seats.h" using namespace std; const int maxn = 1e3+10; int n, m; vector<int> x, y; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { n = H, m = W; for (int i = 0; i < n*m; i++) { x.push_back(R[i]); y.push_back(C[i]); } } int sub_1(void) { int mn_x = x[0], mx_x = x[0]; int mn_y = y[0], mx_y = y[0]; int ans = 0; for (int i = 0; i < n*m; ) { mn_x = min(mn_x, x[i]); mx_x = max(mx_x, x[i]); mn_y = min(mn_y, y[i]); mx_y = max(mx_y, y[i]); if ((mx_x-mn_x+1)*(mx_y-mn_y+1) == i+1) ans++; i = max(i+1, ((mx_x-mn_x+1)*(mx_y-mn_y+1))-1); } return ans; } int swap_seats(int a, int b) { int xa = x[a], ya = y[a]; int xb = x[b], yb = y[b]; x[a] = xb, y[a] = yb; x[b] = xa, y[b] = ya; return sub_1(); }
#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...