제출 #109696

#제출 시각아이디문제언어결과실행 시간메모리
109696polyfish자리 배치 (IOI18_seats)C++14
11 / 100
4085 ms40840 KiB
//Pantyhose(black) + glasses = infinity #include "seats.h" #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << '\n'; #define BP() cerr << "OK!\n"; #define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';} #define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';} const int MAX_N = 1000002; int h, w, n; pair<int, int> p[MAX_N]; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { h = H; w = W; n = R.size(); for (int i=0; i<n; ++i) p[i] = {R[i], C[i]}; } int swap_seats(int a, int b) { swap(p[a], p[b]); int res = 0; int l = h, r = 0, u = w, d = 0; for (int i=0; i<n; ++i) { l = min(l, p[i].first); r = max(r, p[i].first); u = min(u, p[i].second); d = max(d, p[i].second); res += ((r - l + 1) * (d - u + 1)==i+1); } return res; }
#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...