Submission #387751

#TimeUsernameProblemLanguageResultExecution timeMemory
387751ismoilovRace (IOI11_race)C++14
9 / 100
3048 ms13892 KiB
#include "race.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define rall(x) (x).begin(), (x).end() #define fp(a,i,c) for(ll (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(ll (a) = (i); (a) <= (c); (a)++) #define fv(c) for(int (a) = (1); (a) <= (c); (a)++) #define fz(c) for(int (a) = (0); (a) < (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) #define pb push_back #define in insert #define ss second #define ff first vector <pair<ll, ll>> v[200001]; vector <ll> a(200001), b(200001), c(200001); ll kk, mn = 1e18; void dfs(ll x) { for(auto it : v[x]){ if(it.first != x){ a[it.first] = a[x]+it.second; b[it.first] = b[x]+1; if(a[it.first] == kk) mn = min(mn, b[it.first]); dfs(it.first); } } } int best_path(int n, int k, int h[][2], int l[]) { kk = k; fp(i,1,n) v[h[i][0]].pb({h[i][1], l[i]}); fp(i,0,n) { a = c, b = c; dfs(i); } mn = (mn == 1e18 ? -1 : mn); return mn; }

Compilation message (stderr)

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:10:26: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(ll (a) = (i); (a) < (c); (a)++)
      |                          ^
race.cpp:38:2: note: in expansion of macro 'fp'
   38 |  fp(i,1,n)
      |  ^~
race.cpp:10:26: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(ll (a) = (i); (a) < (c); (a)++)
      |                          ^
race.cpp:40:2: note: in expansion of macro 'fp'
   40 |  fp(i,0,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...