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 "seats.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> v;
vector <int> x,y;
int n,m;
void give_initial_chart(int n2, int m2, std::vector<int> a, std::vector<int> b) {
n = n2;m = m2;
v.assign(n, vector<int>(m,0));
x = a;
y = b;
for(int i = 0;i < n*m;i++){
v[a[i]][b[i]] = i;
}
}
int swap_seats(int a, int b){
swap(x[a],x[b]);
swap(y[a],y[b]);
int ans = 0;
for(int i = 0;i < n*m;i++){
int r = -1,l = m,d = -1,u = n;
l = min(l,y[i]);
r = max(r,y[i]);
u = min(u,x[i]);
d = max(d,x[i]);
if((r - l + 1)*(d - u + 1) == i + 1){
ans++;
}
}
return ans;
}
/**
2 3 1
0 0
1 0
1 1
0 1
0 2
1 2
0 5
**/
# | 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... |