Submission #765942

#TimeUsernameProblemLanguageResultExecution timeMemory
765942tengiz05Seats (IOI18_seats)C++17
11 / 100
4066 ms31576 KiB
#include "seats.h" #include "iostream" #ifndef EVAL #include "grader.cpp" #endif using namespace std; vector<int> r, c; int n, m; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { n = H; m = 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; int minx = n, maxx = -1, miny = m, maxy = -1; for (int i = 0; i < n * m; i++) { minx = min(minx, r[i]); maxx = max(maxx, r[i]); miny = min(miny, c[i]); maxy = max(maxy, c[i]); if ((maxx - minx + 1) * (maxy - miny + 1) == i + 1) { ans++; } } return ans; } /* 2 3 2 0 0 1 0 1 1 0 1 0 2 1 2 0 5 0 5 */
#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...