제출 #798405

#제출 시각아이디문제언어결과실행 시간메모리
798405TheSahib자리 배치 (IOI18_seats)C++14
11 / 100
1237 ms51152 KiB
#include "seats.h" #include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; const int MAX = 1e5 + 5; const int oo = 1e9 + 9; int n; int h, w; pii mp[MAX]; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { n = R.size(); h = H; w = W; for (int i = 0; i < n; i++) { mp[i] = {R[i], C[i]}; } } int swap_seats(int a, int b) { swap(mp[a], mp[b]); int mnR = oo, mxR = -oo, mnC = oo, mxC = -oo; int ans = 0; cout << '\n'; for (int i = 0; i < n; i++) { mxR = max(mxR, mp[i].first); mxC = max(mxC, mp[i].second); mnR = min(mnR, mp[i].first); mnC = min(mnC, mp[i].second); int r = mxR - mnR + 1; int c = mxC - mnC + 1; if(r * c == 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...