제출 #409917

#제출 시각아이디문제언어결과실행 시간메모리
409917luciocf자리 배치 (IOI18_seats)C++14
11 / 100
4051 ms40968 KiB
#include <bits/stdc++.h> #include "seats.h" using namespace std; 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(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; int mn_x = x[0], mx_x = x[0]; int mn_y = y[0], mx_y = y[0]; int ans = 1; for (int i = 1; i < n*m; i++) { 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++; } return ans; } int swap_seats(int a, int b) { return sub_1(a, b); }
#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...