제출 #417165

#제출 시각아이디문제언어결과실행 시간메모리
417165AmineTrabelsi자리 배치 (IOI18_seats)C++14
0 / 100
441 ms39748 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; //vector<vector<int>> gr; vector<int> r,c; int h,w,n; int get(){ int a = r[0],b=c[0],x= r[0],y=c[0]; int ans = 1; for(int i=1;i<n;i++){ int le = r[i], ri = c[i]; //cerr<<le<<" "<<ri<<'\n'; if(le < a)a = le; if(le > x)x = le; if(ri < b)b = ri; if(ri > y)y = ri; //cerr << i<<": "<<a<<" "<<b<<" "<<x<<" "<<y<<'\n'; ans += (x-a+1) * (y-b+1) == i+1; i = max(i,(x-a+1) * (y-b+1)-2); } return ans; } void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { h = H,w= W,n = H*W; r = R; c = C; } int swap_seats(int a, int b) { swap(r[a],r[b]); swap(c[a],c[b]); return get(); }
#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...