제출 #837896

#제출 시각아이디문제언어결과실행 시간메모리
837896FulopMate자리 배치 (IOI18_seats)C++17
11 / 100
4105 ms40768 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; int n; vector<pair<int,int>> v; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { n = H*W; v.resize(n); for(int i = 0; i < n; i++){ v[i] = {R[i], C[i]}; } } int swap_seats(int x, int y) { swap(v[x], v[y]); int ans = 1; int a = v[0].first, b = v[0].first, c = v[0].second, d = v[0].second; for(int i = 1; i < n; i++){ a = min(a, v[i].first); b = max(b, v[i].first); c = min(c, v[i].second); d = max(d, v[i].second); if(i+1 == (b-a+1)*(d-c+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...