제출 #808172

#제출 시각아이디문제언어결과실행 시간메모리
808172Supersonic자리 배치 (IOI18_seats)C++14
11 / 100
4082 ms32824 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<pair<ll,ll>> g;int h,w;int n; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { h=H;w=W;n=h*w;for(int i=0;i<n;i++){g.push_back({R[i],C[i]});} } int swap_seats(int a, int b) { swap(g[a],g[b]); pair<ll,ll> mi,mx;mi={1000001,1000001};mx={-1000001,-1000001}; //pair<ll,ll> lm={1000001,1000001},um={1000001,1000001},rm={-1000001,-1000001},dm={-1000001,-1000001}; int lm=1000001,um=1000001,rm=-1000001,dm=-1000001; long long t=0; for(int i=0;i<=n;i++){ mi=min(mi,g[i]);mx=max(mx,g[i]); /*if(g[i].second<lm.second)lm=g[i]; if(g[i].second>rm.second)rm=g[i]; if(g[i].first<um.first)um=g[i]; if(g[i].first>dm.first)dm=g[i];*/ if(g[i].second<lm)lm=g[i].second; if(g[i].second>rm)rm=g[i].second; if(g[i].first<um)um=g[i].first; if(g[i].first>dm)dm=g[i].first; //cerr<<mi.first<<' '<<mi.second<<" | "<<mx.first<<' '<<mx.second; if((mx.first-mi.first+1)*(mx.second-mi.second+1)==i+1&&rm-lm==mx.second-mi.second&&dm-um==mx.first-mi.first){t++;}//cerr<<" ***";}cerr<<endl; //cerr<<lm<<'-'<<um<<'-'<<rm<<'-'<<dm<<endl; //cerr<<(lm-rm)<<' '<<mx.second-mi.second<<endl; //cerr<<(lm-rm==mx.second-mi.second)<<' '<<(dm-um==mx.first-mi.first)<<endl; } return t; } /* 2 3 2 0 0 1 0 1 1 0 1 0 2 1 2 0 5 0 5 */
#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...