Submission #417540

#TimeUsernameProblemLanguageResultExecution timeMemory
417540MDarioIOI Fever (JOI21_fever)C++11
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define X first #define Y second #define pb(x) push_back(x) ll n, a[101], a1[101], r, r1, c[20]; pair<ll, ll> p[101]; bool b[101]; int main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); cin >> n; for(int i=0; i<n; i++){ a1[i]=-1; cin >> p[i].X >> p[i].Y; } for(int hj=0; hj<4; hj++){ a1[0]=hj; a[0]=0; b[0]=0; r1=1; for(int i=1; i<n; i++){ a1[0]=-1; a[0]=1000000000000000ll; b[i]=0; } for(int i=0; i<n; i++){ c[0]=1000000000000000ll; c[1]=0; for(int t=0; t<n; t++){ if(!b[t]){ if(a[t]<c[0]){ c[0]=a[t]; c[1]=t; } } } if(c[0]==1000000000000000ll)break; b[c[1]]=1; for(int t=0; t<n; t++){ if(!b[t]){ if(a1[c[1]]==0){ if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&p[c[1]].X-p[t].X>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=1; } a[t]=min(a[t], p[c[1]].X-p[t].X); } if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&p[t].X-p[c[1]].X>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=3; } a[t]=min(a[t], p[t].X-p[c[1]].X); } } if(a1[c[1]]==1){ if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&p[t].X-p[c[1]].X>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=2; } a[t]=min(a[t], p[t].X-p[c[1]].X); } if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&-(p[c[1]].X-p[t].X)>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=0; } a[t]=min(a[t], -(p[c[1]].X-p[t].X)); } } if(a1[c[1]]==2){ if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&-(p[c[1]].X-p[t].X)>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=3; } a[t]=min(a[t], -(p[c[1]].X-p[t].X)); } if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&-(p[t].X-p[c[1]].X)>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=1; } a[t]=min(a[t], -(p[t].X-p[c[1]].X)); } } if(a1[c[1]]==2){ if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&-(p[t].X-p[c[1]].X)>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=0; } a[t]=min(a[t], -(p[t].X-p[c[1]].X)); } if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&p[c[1]].X-p[t].X>=a[c[1]]){ if(a1[t]==-1){ r1++; a1[t]=2; } a[t]=min(a[t], p[c[1]].X-p[t].X); } } } } } r=max(r, r1); } cout << r; return 0; } /* 2 0 0 4 3 */
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...