제출 #431435

#제출 시각아이디문제언어결과실행 시간메모리
431435Bench0310자리 배치 (IOI18_seats)C++17
11 / 100
4077 ms40776 KiB
#include <bits/stdc++.h> #include "seats.h" using namespace std; typedef long long ll; int n,h,w; vector<array<int,2>> v; void give_initial_chart(int nh,int nw,vector<int> r,vector<int> c) { h=nh; w=nw; n=h*w; v.assign(n,{0,0}); for(int i=0;i<n;i++) v[i]={r[i],c[i]}; } int swap_seats(int a,int b) { swap(v[a],v[b]); int ar=v[0][0]; int br=v[0][0]; int ac=v[0][1]; int bc=v[0][1]; int res=0; for(int i=0;i<n;i++) { ar=min(ar,v[i][0]); br=max(br,v[i][0]); ac=min(ac,v[i][1]); bc=max(bc,v[i][1]); res+=((br-ar+1)*(bc-ac+1)==i+1); } return res; } //int main() //{ // // return 0; //}
#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...