This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |