제출 #583945

#제출 시각아이디문제언어결과실행 시간메모리
58394520160161simone자리 배치 (IOI18_seats)C++14
11 / 100
4041 ms48556 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N=1e6+10; ll r[N],c[N],h,w; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { for(ll i=0;i<H*W;i++) r[i]=R[i],c[i]=C[i]; h=H,w=W; } int swap_seats(int a, int b) { swap(r[a],r[b]),swap(c[a],c[b]); ll ans=1,a1=c[0],a2=c[0],b1=r[0],b2=r[0]; for(ll i=1;i<h*w;i++){ a1=min(a1,c[i]),a2=max(a2,c[i]); b1=min(b1,r[i]),b2=max(b2,r[i]); if( (a2-a1+1)*(b2-b1+1)==i+1 ) ans++; } return ans; }
#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...