제출 #600798

#제출 시각아이디문제언어결과실행 시간메모리
600798jack715자리 배치 (IOI18_seats)C++14
11 / 100
4086 ms40760 KiB
#include "seats.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define pp pop_back #define mp make_pair #define bb back #define ff first #define ss second using namespace std; vector<int> row, col; int h, w; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { row = R; col = C; h = H; w = W; } int swap_seats(int A, int B) { swap(row[A], row[B]); swap(col[A], col[B]); // cout << "=== " << A << ' ' << B << '\n'; // cout << row[A] << ' '<< col[A] << ' ' << row[B] << ' ' << col[B] << '\n'; int ans = 0, l = w-1, r = 0, t = h-1, b = 0; for (int i = 0; i < h*w; i++) { // cout << col[i] << ' ' << row[i] << '\n'; l = min(l, col[i]); t = min(t, row[i]); r = max(r, col[i]); b = max(b, row[i]); // cout << l << ' ' << r << '\n'; // cout << t << ' ' << b << '\n'; if (i+1 == (r-l+1)*(b-t+1)) { // cout << i << ' '; ans++; } } // cout << "===\n"; // cout << '\n'; return ans; } /* 2 3 2 0 0 1 0 1 1 0 1 0 2 1 2 0 5 0 5 */
#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...