답안 #387751

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
387751 2021-04-09T07:19:22 Z ismoilov 경주 (Race) (IOI11_race) C++14
9 / 100
3000 ms 13892 KB
#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

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)
      |  ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 9676 KB Output is correct
2 Correct 20 ms 9676 KB Output is correct
3 Correct 29 ms 9724 KB Output is correct
4 Correct 23 ms 9664 KB Output is correct
5 Correct 21 ms 9676 KB Output is correct
6 Correct 22 ms 9728 KB Output is correct
7 Correct 21 ms 9676 KB Output is correct
8 Correct 22 ms 9720 KB Output is correct
9 Correct 22 ms 9724 KB Output is correct
10 Correct 26 ms 9676 KB Output is correct
11 Correct 31 ms 9600 KB Output is correct
12 Correct 21 ms 9680 KB Output is correct
13 Correct 21 ms 9600 KB Output is correct
14 Correct 24 ms 9676 KB Output is correct
15 Correct 25 ms 9676 KB Output is correct
16 Correct 23 ms 9704 KB Output is correct
17 Correct 25 ms 9732 KB Output is correct
18 Correct 22 ms 9728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 9676 KB Output is correct
2 Correct 20 ms 9676 KB Output is correct
3 Correct 29 ms 9724 KB Output is correct
4 Correct 23 ms 9664 KB Output is correct
5 Correct 21 ms 9676 KB Output is correct
6 Correct 22 ms 9728 KB Output is correct
7 Correct 21 ms 9676 KB Output is correct
8 Correct 22 ms 9720 KB Output is correct
9 Correct 22 ms 9724 KB Output is correct
10 Correct 26 ms 9676 KB Output is correct
11 Correct 31 ms 9600 KB Output is correct
12 Correct 21 ms 9680 KB Output is correct
13 Correct 21 ms 9600 KB Output is correct
14 Correct 24 ms 9676 KB Output is correct
15 Correct 25 ms 9676 KB Output is correct
16 Correct 23 ms 9704 KB Output is correct
17 Correct 25 ms 9732 KB Output is correct
18 Correct 22 ms 9728 KB Output is correct
19 Incorrect 7 ms 9676 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 9676 KB Output is correct
2 Correct 20 ms 9676 KB Output is correct
3 Correct 29 ms 9724 KB Output is correct
4 Correct 23 ms 9664 KB Output is correct
5 Correct 21 ms 9676 KB Output is correct
6 Correct 22 ms 9728 KB Output is correct
7 Correct 21 ms 9676 KB Output is correct
8 Correct 22 ms 9720 KB Output is correct
9 Correct 22 ms 9724 KB Output is correct
10 Correct 26 ms 9676 KB Output is correct
11 Correct 31 ms 9600 KB Output is correct
12 Correct 21 ms 9680 KB Output is correct
13 Correct 21 ms 9600 KB Output is correct
14 Correct 24 ms 9676 KB Output is correct
15 Correct 25 ms 9676 KB Output is correct
16 Correct 23 ms 9704 KB Output is correct
17 Correct 25 ms 9732 KB Output is correct
18 Correct 22 ms 9728 KB Output is correct
19 Execution timed out 3048 ms 13892 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 9676 KB Output is correct
2 Correct 20 ms 9676 KB Output is correct
3 Correct 29 ms 9724 KB Output is correct
4 Correct 23 ms 9664 KB Output is correct
5 Correct 21 ms 9676 KB Output is correct
6 Correct 22 ms 9728 KB Output is correct
7 Correct 21 ms 9676 KB Output is correct
8 Correct 22 ms 9720 KB Output is correct
9 Correct 22 ms 9724 KB Output is correct
10 Correct 26 ms 9676 KB Output is correct
11 Correct 31 ms 9600 KB Output is correct
12 Correct 21 ms 9680 KB Output is correct
13 Correct 21 ms 9600 KB Output is correct
14 Correct 24 ms 9676 KB Output is correct
15 Correct 25 ms 9676 KB Output is correct
16 Correct 23 ms 9704 KB Output is correct
17 Correct 25 ms 9732 KB Output is correct
18 Correct 22 ms 9728 KB Output is correct
19 Incorrect 7 ms 9676 KB Output isn't correct
20 Halted 0 ms 0 KB -