제출 #379308

#제출 시각아이디문제언어결과실행 시간메모리
379308autumn_eel자리 배치 (IOI18_seats)C++14
11 / 100
4100 ms44908 KiB
#include "seats.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; static int h,w; static vector<int>v; static vector<int>r,c; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { h=H;w=W; r=R;c=C; v=vector<int>(h*w); rep(i,h*w){ v[R[i]*w+C[i]]=i; } } int swap_seats(int a, int b) { swap(r[a],r[b]); swap(c[a],c[b]); int cnt=0; int rmin,rmax,cmin,cmax; rmin=rmax=r[0]; cmin=cmax=c[0]; rep(i,h*w){ rmin=min(rmin,r[i]); rmax=max(rmax,r[i]); cmin=min(cmin,c[i]); cmax=max(cmax,c[i]); if((rmax-rmin+1)*(cmax-cmin+1)==i+1)cnt++; } return cnt; }
#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...