Submission #719766

#TimeUsernameProblemLanguageResultExecution timeMemory
719766bin9638Seats (IOI18_seats)C++17
11 / 100
4025 ms40768 KiB
#include <bits/stdc++.h> #ifndef SKY #include "seats.h" #endif // SKY using namespace std; #define N 1000010 #define ll long long #define fs first #define sc second #define ii pair<int,int> #define pb push_back int n,m; ii pos[N]; int solve() { int top=pos[0].fs,bot=pos[0].fs,lef=pos[0].sc,righ=pos[0].sc,res=1; for(int i=1;i<n*m;i++) { top=min(top,pos[i].fs); bot=max(bot,pos[i].fs); lef=min(lef,pos[i].sc); righ=max(righ,pos[i].sc); if((bot-top+1)*(righ-lef+1)==i+1) res++; } return res; } int swap_seats(int a, int b) { swap(pos[a],pos[b]); return solve(); } void give_initial_chart(int NNN, int MMM, std::vector<int> R, std::vector<int> C) { n=NNN; m=MMM; for(int i=0;i<n*m;i++) pos[i]={R[i],C[i]}; } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); return 0; } #endif
#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...