제출 #138146

#제출 시각아이디문제언어결과실행 시간메모리
138146CaroLinda자리 배치 (IOI18_seats)C++14
11 / 100
1471 ms49660 KiB
#include <bits/stdc++.h> #include "seats.h" #define debug #define lp(i,a,b) for(int i=a;i<b;i++) #define pii pair<int,int> #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair const int MAXN = 1e4+10 ; const int inf=1e9+10 ; using namespace std ; int n ; pii p[MAXN] ; // ------------------------------------ int swap_seats(int a , int b) { pii p1 = mk( inf , inf ) , p2 = mk(-1,-1) ; int cnt = 0 ; swap( p[a] , p[b] ) ; lp(i,0,n) { pii cur = p[i] ; p1.ff=min(p1.ff, cur.ff) ; p1.ss = min(p1.ss , cur.ss) ; p2.ff = max(p2.ff , cur.ff) ; p2.ss = max(p2.ss , cur.ss) ; int grid = ( p2.ff - p1.ff + 1) * ( p2.ss - p1.ss + 1) ; if( i+1 == grid ) cnt ++ ; } return cnt ; } void give_initial_chart(int h , int w , vector<int> R , vector<int> C ) { n = R.size() ; lp(i,0,n) p[i] = mk( R[i] , C[i] ) ; }
#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...