Submission #417552

#TimeUsernameProblemLanguageResultExecution timeMemory
417552MDarioIOI Fever (JOI21_fever)C++11
25 / 100
1 ms332 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]; void f1(ll t){ 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); } } void f2(ll t){ 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)); } } void f3(ll t){ 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)); } } void f4(ll t){ 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); } } 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[i]=-1; a[i]=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){ f1(t); } if(a1[c[1]]==1){ f2(t); } if(a1[c[1]]==2){ f3(t); } if(a1[c[1]]==3){ f4(t); } } } } r=max(r, r1); } cout << r; return 0; } /* 15 5 6 2 9 12 0 4 11 3 12 6 5 0 8 9 10 11 13 8 7 13 2 1 1 7 14 10 4 14 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...