제출 #204603

#제출 시각아이디문제언어결과실행 시간메모리
204603awlintqaa철로 (IOI14_rail)C++14
56 / 100
883 ms98808 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 200 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; const ll mod=1e9+7; const ll inf= 4e18; const ld pai=acos(-1); #include "rail.h" int n,st; vi v; int dis[5009][5009]; int done[5009],way[5009]; void findLocation(int N, int first, int location[], int stype[]){ n=N,st=first; location[0]=st,stype[0]=1; if(n==1)return; done[0]=1; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ dis[i][j]=dis[j][i]=getDistance(i,j); } } for(int i=1;i<n;i++){ int z=1; for(int j=1;j<n;j++){ if(i==j)C; if(dis[0][i]==dis[0][j]+dis[j][i]){ way[i]++; z=0; } } if(z){ v.pb(i); done[i]=1; location[i]=dis[0][i]+st; stype[i]=2; } } vi ret; for(int i=0;i<n;i++){ if(done[i])C; for(auto u:v){ if(dis[0][i]==dis[0][u]+dis[u][i] && way[i]==1){ location[i]=location[u]-dis[u][i]; stype[i]=1; done[i]=1; ret.pb(i); } } } for(int i=0;i<n;i++){ if(done[i])C; for(auto u:ret){ if(dis[0][i]==dis[0][u]+dis[u][i]){ location[i]=location[u]+dis[u][i]; stype[i]=2; done[i]=1; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...