Submission #144274

#TimeUsernameProblemLanguageResultExecution timeMemory
144274Minnakhmetov자리 배치 (IOI18_seats)C++14
11 / 100
4067 ms40796 KiB
#include "seats.h" #include<bits/stdc++.h> using namespace std; int n, m; vector<int> x, y; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { n = H; m = 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, lx = n, rx = -1, ly = m, ry = -1;; for (int i = 0; i < n * m; i++) { lx = min(lx, x[i]); rx = max(rx, x[i]); ly = min(ly, y[i]); ry = max(ry, y[i]); if (i + 1 == (rx - lx + 1) * (ry - ly + 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...