제출 #831493

#제출 시각아이디문제언어결과실행 시간메모리
831493caganyanmaz자리 배치 (IOI18_seats)C++17
11 / 100
1589 ms49860 KiB
#include <bits/stdc++.h> #include "seats.h" using namespace std; constexpr static int MXN = 1e4 + 5; constexpr static int INF = 1e6; vector<int> r, c; int mnr[MXN], mxr[MXN], mnc[MXN], mxc[MXN]; int h, w, n; int counter; void create_table() { counter = 0; mnr[0] = INF; mxr[0] = -INF; mnc[0] = INF; mxr[0] = -INF; for (int i = 1; i <= n; i++) { mnr[i] = min(mnr[i-1], r[i-1]); mxr[i] = max(mxr[i-1], r[i-1]+1); mnc[i] = min(mnc[i-1], c[i-1]); mxc[i] = max(mxc[i-1], c[i-1]+1); if ((mxr[i] - mnr[i]) * (mxc[i] - mnc[i]) == i) counter++; } } void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { r = R, c = C; h = H, w = W; n = h*w; } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); create_table(); return counter; }
#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...