Submission #115539

#TimeUsernameProblemLanguageResultExecution timeMemory
115539WhipppedCreamSeats (IOI18_seats)C++17
11 / 100
4040 ms30328 KiB
#include <bits/stdc++.h> #include "seats.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 1e6+5; int r[maxn], c[maxn]; int n, m; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { n = H; m = W; for(int i = 0; i< n*m; i++) { r[i] = R[i]; c[i] = C[i]; } } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); int ans = 0; int mnr = 1e9, mxr = -1; int mnc = 1e9, mxc = -1; for(int i = 0; i< n*m; i++) { mnr = min(mnr, r[i]); mxr = max(mxr, r[i]); mnc = min(mnc, c[i]); mxc = max(mxc, c[i]); if((mxc-mnc+1)*(mxr-mnr+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...