# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
152682 | Segtree | 자리 배치 (IOI18_seats) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define N 10010
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
ll h,w,r[N],c[N];
give_initial_chart(int H,int W,int[] R, int[] C){
h=H,w=W;
for(int i=1;i<=h*w;i++)r[i]=R[i];
for(int i=1;i<=h*w;i++)c[i]=C[i];
}
int swap_seats(int a,int b){
if(h*w>N)return 0;
swap(r[a],r[b]);
swap(c[a],c[b]);
ll xl=1e17,xr=-1e17,yl=1e17,yr=-1e17;
ll ans=0;
for(int k=1;k<=h*w;k++){
chmin(xl,r[k]);
chmax(xr,r[k]);
chmin(yl,c[k]);
chmax(yr,c[k]);
if((xr-xl+1)*(yr-yl+1)==k)ans++;
}
return ans;
}
int main(){
return 0;
}