Submission #1031117

#TimeUsernameProblemLanguageResultExecution timeMemory
1031117AdamGSIOI Fever (JOI21_fever)C++17
6 / 100
1 ms372 KiB
#include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #define rep(a, b) for(ll a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const ll INF=1e18+7; const int LIM=1e5+7; pair<ll,ll>T[LIM]; ll odl[LIM], kier[LIM], n; int solve() { rep(i, n) odl[i]=INF; kier[0]=0; for(int i=1; i<n; ++i) { int a=abs(T[0].st-T[i].st), b=abs(T[0].nd-T[i].nd); if(b>a) { if(T[0].nd<T[i].nd) kier[i]=1; else kier[i]=3; } else if(b<a) { if(T[0].st<T[i].st) kier[i]=2; else kier[i]=0; } else if(T[i].st<T[0].st) kier[i]=0; else if(T[0].nd<T[i].nd) kier[i]=1; else kier[i]=3; } queue<int>q; q.push(0); odl[0]=0; int ans=0; while(!q.empty()) { int p=q.front(); q.pop(); ++ans; rep(i, n) if(odl[i]==INF) { rep(j, 4) { kier[i]=(kier[i]+1)%4; kier[p]=(kier[p]+1)%4; T[i]={T[i].nd, -T[i].st}; T[p]={T[p].nd, -T[p].st}; if(kier[p]==0) { if(kier[i]==1) { if(T[p].st-T[p].nd==T[i].st-T[i].nd && T[p].st+odl[p]<=T[i].st) { odl[i]=T[i].st-T[p].st; q.push(i); continue; } } if(kier[i]==3) { if(T[p].st+T[p].nd==T[i].st+T[i].nd && T[p].st+odl[p]<=T[i].st) { odl[i]=T[i].st-T[p].st; q.push(i); continue; } } if(kier[i]==2) { if(T[p].nd==T[i].nd && T[p].st+odl[p]<=T[i].st-odl[p]) { odl[i]=(T[i].st-T[p].st)/2; q.push(i); continue; } } } } } } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; rep(i, n) cin >> T[i].st >> T[i].nd; rep(i, n) T[i]={2*T[i].st, 2*T[i].nd}; int ans=0; rep(i, 4) { ans=max(ans, solve()); rep(j, n) T[j]={-T[j].nd, T[j].st}; } cout << ans << '\n'; }
#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...