이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
pair <int,int> pos[1000000];
vector <vector <int> > a;
void give_initial_chart(int h,int w,vector <int> r,vector <int> c){
n=h;
m=w;
vector <vector <int> > v(h);
for (int i=0; i<h; i++){
vector <int> e(w);
v[i]=e;
}
for (int i=0; i<h*w; i++){
pos[i]={r[i],c[i]};
v[r[i]][c[i]]=i;
}
a=v;
}
int swap_seats(int u,int v){
pair <int,int> wha=pos[u],whb=pos[v];
swap(pos[u],pos[v]);
swap(a[wha.first][wha.second],a[whb.first][whb.second]);
int ans=0;
int minr=1e9,maxr=-1e9,minc=1e9,maxc=-1e9;
for (int i=0; i<m*n; i++){
//get pos[i]
minr=min(minr,pos[i].first);
maxr=max(maxr,pos[i].first);
minc=min(minc,pos[i].second);
maxc=max(maxc,pos[i].second);
int a=(maxr-minr+1)*(maxc-minc+1);
if (a==i+1) ans++;
}
return ans;
}
# | 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... |