제출 #596391

#제출 시각아이디문제언어결과실행 시간메모리
596391Lucpp자리 배치 (IOI18_seats)C++17
11 / 100
4091 ms24120 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; int n; vector<int> r, c; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { n = H*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 cmi = n, cma = 0, rmi = n, rma = 0; for(int i = 0; i < n; i++){ cmi = min(cmi, c[i]); cma = max(cma, c[i]); rmi = min(rmi, r[i]); rma = max(rma, r[i]); if((cma-cmi+1)*(rma-rmi+1) == i+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...