제출 #209665

#제출 시각아이디문제언어결과실행 시간메모리
209665TAISA_자리 배치 (IOI18_seats)C++14
11 / 100
4098 ms40828 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; void chmin(int& a,int b){a=min(a,b);} void chmax(int& a,int b){a=max(a,b);} vector<int> r,c; int h,w; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { r=R; c=C; h=H; w=W; } int swap_seats(int a, int b) { swap(r[a],r[b]); swap(c[a],c[b]); int xmi=c[0],xma=c[0],ymi=r[0],yma=r[0]; int res=0; for(int i=0;i<h*w;i++){ chmin(xmi,c[i]); chmin(ymi,r[i]); chmax(xma,c[i]); chmax(yma,r[i]); if((xma-xmi+1)*(yma-ymi+1)==i+1){ res++; } } return res; }
#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...