Submission #77353

#TimeUsernameProblemLanguageResultExecution timeMemory
77353Just_Solve_The_ProblemSeats (IOI18_seats)C++11
11 / 100
4037 ms32888 KiB
#include <bits/stdc++.h> #include "seats.h" // #include "grader.cpp" #define pii pair < int, int > #define fr first #define sc second #define mk make_pair #define OK puts("ok"); using namespace std; const int N = (int)1e6 + 7; pair < int, int > pos[N]; int h, w; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { tie(h, w) = make_tuple(H, W); for (int i = 0; i < H * W; i++) { pos[i] = mk(R[i], C[i]); } } int swap_seats(int a, int b) { swap(pos[a], pos[b]); int mnx, mxx, mny, mxy; mnx = mny = N; mxx = mxy = 0; int ans = 0; for (int i = 0; i < h * w; i++) { mnx = min(mnx, pos[i].fr); mxx = max(mxx, pos[i].fr); mny = min(mny, pos[i].sc); mxy = max(mxy, pos[i].sc); if (i + 1 == (mxx - mnx + 1) * (mxy - mny + 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...