제출 #1044606

#제출 시각아이디문제언어결과실행 시간메모리
1044606happy_node자리 배치 (IOI18_seats)C++17
0 / 100
4027 ms31564 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; namespace { const int MX=1e6+5; const array<int,4> inf={(int)1e9,0,(int)1e9,0}; int H,W; array<int,4> arr[MX]; } void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { ::H=H, ::W=W; for(int i=0;i<H*W;i++) { arr[i]={R[i],R[i],C[i],C[i]}; } } int swap_seats(int a, int b) { swap(arr[a],arr[b]); int ans=0; int L0=1e9,R0=0,L1=1e9,R1=0; for(int i=0;i<H*W;i++) { L0=min(L0,arr[i][0]); L1=min(L1,arr[i][2]); R0=max(R0,arr[i][1]); R1=max(R1,arr[i][3]); if((R1-R0+1)*(L1-L0+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...