Submission #1080169

# Submission time Handle Problem Language Result Execution time Memory
1080169 2024-08-29T07:41:15 Z UmairAhmadMirza Stations (IOI20_stations) C++17
52.3205 / 100
663 ms 1044 KB
#include <bits/stdc++.h>
using namespace std;

int const N=1005;
vector<int> adj[N];
int tim=-1;
int in[N],out[N];
void dfs(int node,int par=-1){
	tim++;
	in[node]=tim;
	for(int i:adj[node])
		if(i!=par)
			dfs(i,node);
	out[node]=tim;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v){
	for (int i = 0; i < n; ++i)
	{
		adj[i].clear();
		tim=-1;
		in[i]=out[i]=0;
	}
	for (int i = 0; i < n-1; ++i)
	{
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	dfs(0);
	vector<int> val;
	for (int i = 0; i < n; ++i)
		val.push_back((in[i]*1000)+out[i]);
	// for(int i=0;i<n;i++)
	// 	cout<<val[i]<<' ';
	// cout<<endl;
	return val;
}
int find_next_station(int s, int t, vector<int> c){
	// cout<<s<<' '<<t<<endl;
	int n=c.size();
	int inn[n],outt[n];
	int ti=t/1000,to=t%1000;
	for (int i = 0; i < n; ++i)
	{
		inn[i]=c[i]/1000;
		outt[i]=c[i]%1000;
	}
	int si=s/1000,so=s%1000;
	for(int i=0;i<n;i++)
		if(inn[i]<=ti && to<=outt[i] && !(inn[i]<=si && so<=outt[i]))
			return c[i];
	
	for(int i=0;i<n;i++)
		if(inn[i]<=si && so<=outt[i])
			return c[i];
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 460 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 355 ms 684 KB Output is correct
2 Correct 298 ms 684 KB Output is correct
3 Correct 663 ms 684 KB Output is correct
4 Correct 460 ms 684 KB Output is correct
5 Correct 382 ms 684 KB Output is correct
6 Correct 295 ms 684 KB Output is correct
7 Correct 304 ms 684 KB Output is correct
8 Correct 2 ms 776 KB Output is correct
9 Correct 2 ms 776 KB Output is correct
10 Correct 0 ms 772 KB Output is correct
11 Correct 409 ms 684 KB Output is correct
12 Correct 293 ms 1044 KB Output is correct
13 Correct 340 ms 784 KB Output is correct
14 Correct 313 ms 684 KB Output is correct
15 Correct 39 ms 768 KB Output is correct
16 Correct 38 ms 764 KB Output is correct
17 Correct 63 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 607 ms 684 KB Output is correct
2 Correct 453 ms 684 KB Output is correct
3 Correct 413 ms 684 KB Output is correct
4 Correct 2 ms 776 KB Output is correct
5 Correct 2 ms 776 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Correct 424 ms 796 KB Output is correct
8 Correct 613 ms 684 KB Output is correct
9 Correct 429 ms 684 KB Output is correct
10 Correct 409 ms 684 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 3 ms 768 KB Output is correct
13 Correct 2 ms 776 KB Output is correct
14 Correct 2 ms 768 KB Output is correct
15 Correct 1 ms 764 KB Output is correct
16 Correct 348 ms 684 KB Output is correct
17 Correct 322 ms 684 KB Output is correct
18 Correct 361 ms 684 KB Output is correct
19 Correct 326 ms 684 KB Output is correct
20 Correct 361 ms 684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 357 ms 684 KB Partially correct
2 Partially correct 301 ms 684 KB Partially correct
3 Partially correct 632 ms 684 KB Partially correct
4 Partially correct 435 ms 684 KB Partially correct
5 Partially correct 439 ms 684 KB Partially correct
6 Partially correct 321 ms 684 KB Partially correct
7 Partially correct 290 ms 684 KB Partially correct
8 Partially correct 2 ms 764 KB Partially correct
9 Partially correct 3 ms 772 KB Partially correct
10 Partially correct 0 ms 768 KB Partially correct
11 Partially correct 331 ms 684 KB Partially correct
12 Partially correct 372 ms 684 KB Partially correct
13 Partially correct 648 ms 684 KB Partially correct
14 Partially correct 448 ms 684 KB Partially correct
15 Partially correct 395 ms 684 KB Partially correct
16 Partially correct 328 ms 688 KB Partially correct
17 Partially correct 381 ms 684 KB Partially correct
18 Partially correct 292 ms 800 KB Partially correct
19 Partially correct 297 ms 1012 KB Partially correct
20 Partially correct 252 ms 796 KB Partially correct
21 Partially correct 38 ms 776 KB Partially correct
22 Partially correct 44 ms 716 KB Partially correct
23 Partially correct 62 ms 860 KB Partially correct
24 Partially correct 4 ms 776 KB Partially correct
25 Partially correct 3 ms 764 KB Partially correct
26 Partially correct 2 ms 768 KB Partially correct
27 Partially correct 1 ms 768 KB Partially correct
28 Partially correct 0 ms 768 KB Partially correct
29 Partially correct 292 ms 804 KB Partially correct
30 Partially correct 293 ms 684 KB Partially correct
31 Partially correct 302 ms 796 KB Partially correct
32 Partially correct 350 ms 684 KB Partially correct
33 Partially correct 357 ms 684 KB Partially correct
34 Partially correct 221 ms 684 KB Partially correct
35 Partially correct 290 ms 684 KB Partially correct
36 Partially correct 326 ms 684 KB Partially correct
37 Partially correct 313 ms 788 KB Partially correct
38 Partially correct 339 ms 792 KB Partially correct
39 Partially correct 308 ms 800 KB Partially correct
40 Partially correct 270 ms 792 KB Partially correct
41 Partially correct 271 ms 796 KB Partially correct
42 Partially correct 52 ms 768 KB Partially correct
43 Partially correct 60 ms 684 KB Partially correct
44 Partially correct 97 ms 684 KB Partially correct
45 Partially correct 113 ms 680 KB Partially correct
46 Partially correct 212 ms 684 KB Partially correct
47 Partially correct 183 ms 684 KB Partially correct
48 Partially correct 38 ms 736 KB Partially correct
49 Partially correct 41 ms 716 KB Partially correct