Submission #813292

#TimeUsernameProblemLanguageResultExecution timeMemory
813292MosesRail (IOI14_rail)C++14
0 / 100
188 ms712 KiB
/* _ _ _ __ __ _____ /\ | | /\ | | | | | \/ |/ ____| / \ | |__ ___ / \ | |__ __| | ___ | \ / | | / /\ \ | '_ \ / _ \ / /\ \ | '_ \ / _` |/ _ \| |\/| | | / ____ \| |_) | (_) / ____ \| |_) | (_| | (_) | | | | |____ /_/ \_\_.__/ \___/_/ \_\_.__/ \__,_|\___/|_| |_|\_____| */ // build command: // g++ -std=gnu++17 -O3 -DDEBUG -g -fsanitize=signed-integer-overflow -fsanitize=bounds-strict -fsanitize=address -fsanitize=integer-divide-by-zero -fsanitize=float-divide-by-zero -fsanitize=pointer-overflow -fsanitize=shift-exponent -fsplit-stack -Wshadow -Wall -fconcepts -Wno-unused-result // REMEMBER: // BS, Offline, Persistent SegTree, SQRT, Treap, MaxFlow, FFT, Matrices #include "rail.h" #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") // DEBUG STUFF template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #ifdef DEBUG #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif #define F first #define S second #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; // RANDOM NUMBER GENERATOR mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); #define SHUF(v) shuffle(all(v), RNG); // Use mt19937_64 for 64 bit random numbers. int getrand(int l,int r) { return uniform_int_distribution<int>(l, r)(RNG); } const ld eps = 1e-9; const int mod = 1e9 + 7; const int oo = 1e9 + 7; const ll lloo = 1e18 + 7; const int N = 5000 + 7; pii mn[N]; vector<pii> g[N]; void dfs(int i,int loc,int type) { } void findLocation(int n, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; for(int i = 0 ; i < n ; i++) { mn[i] = {oo,-1}; for(int j = i+1 ; j < n ; j++) { int x = getDistance(i,j); mn[i] = min(mn[i],{x,j}); mn[j] = min(mn[j],{x,i}); } } for(int i = 0 ; i < n ; i++) { g[mn[i].S].pb({i,mn[i].F}); } vector<bool> vis(n); function<void(int,int,int)> dfs = [&](int i,int loc,int type) { vis[i] = 1; location[i] = loc; stype[i] = type+1; for(auto x:g[i]) { int v = x.F; int w = x.S; if (vis[v]) continue; dfs(v,loc+(type?(-w):(w)),type^1); } }; dfs(0,first,0); return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...