제출 #1042228

#제출 시각아이디문제언어결과실행 시간메모리
1042228ALeonidou철로 (IOI14_rail)C++17
30 / 100
33 ms604 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; #define ll int #define F first #define S second #define sz(x) (ll)x.size() #define endl "\n" #define pb push_back typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } void findLocation(ll n, ll f, ll pos[], ll type[]) { type[0] = 1; pos[0] = f; vii v0; for (ll i =1; i<n; i++){ v0.pb(ii(getDistance(0,i), i)); } sort(v0.begin(), v0.end()); ll first_right = v0[0].S; type[first_right] = 2; pos[first_right] = f + v0[0].F; for (ll i =1; i<n; i++){ if (first_right == i) continue; ll distance_from_zero = getDistance(0, i); ll distance_from_right = getDistance(first_right, i); if (distance_from_zero <= v0[0].F * 2){ pos[i] = f + distance_from_zero; type[i] = 2; } else{ ll expected_distance_from_right = distance_from_zero - v0[0].F; if (expected_distance_from_right == distance_from_right){ pos[i] = f - (distance_from_right - v0[0].F); type[i] = 1; } else{ pos[i] = f + distance_from_zero; type[i] = 2; } } } } /* 1 4 1 1 2 4 2 7 2 9 2 6 1 3 2 6 2 7 1 1 1 0 2 8 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...