제출 #433885

#제출 시각아이디문제언어결과실행 시간메모리
433885frodakcin자리 배치 (IOI18_seats)C++11
11 / 100
4085 ms40720 KiB
#include "seats.h" #include <algorithm> template<typename T> bool ckmax(T& a, const T& b) {return b>a?a=b,1:0;} template<typename T> bool ckmin(T& a, const T& b) {return b<a?a=b,1:0;} const int INF = 0x3f3f3f3f; int N; std::vector<int> R, C; void give_initial_chart(int H, int W, std::vector<int> _R, std::vector<int> _C) { R=_R, C=_C; N = H*W; } int ans() { int maxr=-1, minr=INF, maxc=-1, minc=INF, ans=0; for(int i=0;i<N;++i) { ckmin(minr, R[i]); ckmax(maxr, R[i]+1); ckmin(minc, C[i]); ckmax(maxc, C[i]+1); if(i+1 == (maxr-minr)*(maxc-minc)) ++ans; } return ans; } int swap_seats(int a, int b) { std::swap(R[a], R[b]); std::swap(C[a], C[b]); 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...