Submission #294012

#TimeUsernameProblemLanguageResultExecution timeMemory
294012shayan_pSeats (IOI18_seats)C++17
11 / 100
4073 ms40952 KiB
#include<bits/stdc++.h> #include "seats.h" #define F first #define S second #define PB push_back #define sz(s) int((s).size()) #define bit(n,k) (((n)>>(k))&1) using namespace std; typedef long long ll; typedef pair<int,int> pii; const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10; vector<int> X, Y; int N, M; int solve(){ int mnx = X[0], mxx = X[0]; int mny = Y[0], mxy = Y[0]; int ans = 1; for(int i = 1; i < N * M; i++){ mnx = min(mnx, X[i]); mny = min(mny, Y[i]); mxx = max(mxx, X[i]); mxy = max(mxy, Y[i]); ans+= i+1 == (mxx - mnx + 1) * (mxy - mny + 1); } return ans; } void give_initial_chart(int N, int M, vector<int> X, vector<int> Y){ ::N = N, ::M = M, ::X = X, ::Y = Y; } int swap_seats(int a, int b){ swap(X[a], X[b]); swap(Y[a], Y[b]); return solve(); }
#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...