답안 #889206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
889206 2023-12-19T07:47:27 Z Muhammad_Aneeq Shortcut (IOI16_shortcut) C++17
0 / 100
2000 ms 49920 KB
#include <vector>
#include <set>
using namespace std;
int const N=1e6+10;
multiset<pair<int,int>>nei[N]={};
long long dis[N]={};
int vis[N]={};
long long ans=1e17+10;
int ns;
long long bfs(int x)
{
	for (int i=0;i<ns;i++)
	{
		vis[i]=0;
		dis[i]=1e17+10;
	}
	dis[x]=0;
	set<pair<long long,int>>s;
	s.insert({0,x});
	while (s.size())
	{
		int x=(*begin(s)).second;
		s.erase(*begin(s));
		if (vis[x])
			continue;
		vis[x]=1;
		for (auto i:nei[x])
		{
			if (dis[i.first]>dis[x]+i.second)
			{
				s.erase({dis[i.first],i.first});
				dis[i.first]=dis[x]+i.second;
				s.insert({dis[i.first],i.first});
			}
		}
	}
	long long z=0;
	for (int i=0;i<ns;i++)
		z=max(z,dis[i]);
	return z;
}
void find()
{
	long long f=0;
	for (int i=0;i<ns;i++)
	{
		long long z=bfs(i);
		f=max(f,z);
	}
	ans=min(ans,f);
}
long long find_shortcut(int n,vector<int>l,vector<int>d,int c)
{
	for (int i=0;i<n-1;i++)
	{
		nei[i].insert({i+1,l[i]});
		nei[i+1].insert({i,l[i]});
	}
	ns=n;
	for (int i=0;i<n;i++)
	{
		if (d[i])
		{
			nei[i].insert({ns,d[i]});
			nei[ns].insert({i,d[i]});
			ns++;
		}
	}
	for (int i=0;i<n;i++)
		for (int j=i+1;j<n;j++)
		{
			nei[i].insert({j,c});
			nei[j].insert({i,c});
			find();
			nei[i].erase(nei[i].find({j,c}));
			nei[j].erase(nei[j].find({i,c}));
		}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 49756 KB n = 4, 80 is a correct answer
2 Correct 10 ms 49916 KB n = 9, 110 is a correct answer
3 Correct 9 ms 49756 KB n = 4, 21 is a correct answer
4 Correct 10 ms 49756 KB n = 3, 4 is a correct answer
5 Correct 10 ms 49756 KB n = 2, 62 is a correct answer
6 Correct 10 ms 49920 KB n = 2, 3 is a correct answer
7 Correct 10 ms 49752 KB n = 3, 29 is a correct answer
8 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
9 Correct 10 ms 49756 KB n = 2, 3 is a correct answer
10 Correct 10 ms 49756 KB n = 2, 2000000001 is a correct answer
11 Correct 10 ms 49756 KB n = 2, 3000000000 is a correct answer
12 Correct 10 ms 49852 KB n = 3, 3000000000 is a correct answer
13 Correct 10 ms 49756 KB n = 3, 3000000000 is a correct answer
14 Correct 10 ms 49756 KB n = 4, 3000000001 is a correct answer
15 Correct 10 ms 49756 KB n = 4, 4000000000 is a correct answer
16 Correct 10 ms 49756 KB n = 5, 4000000000 is a correct answer
17 Correct 11 ms 49892 KB n = 10, 1000000343 is a correct answer
18 Correct 11 ms 49752 KB n = 10, 3189 is a correct answer
19 Correct 11 ms 49756 KB n = 10, 7000000000 is a correct answer
20 Correct 10 ms 49888 KB n = 5, 12 is a correct answer
21 Correct 10 ms 49756 KB n = 5, 25 is a correct answer
22 Correct 10 ms 49900 KB n = 2, 122 is a correct answer
23 Correct 13 ms 49756 KB n = 10, 117 is a correct answer
24 Correct 12 ms 49756 KB n = 10, 336 is a correct answer
25 Correct 11 ms 49864 KB n = 10, 438 is a correct answer
26 Correct 10 ms 49920 KB n = 10, 206 is a correct answer
27 Correct 11 ms 49920 KB n = 10, 636 is a correct answer
28 Correct 10 ms 49920 KB n = 4, 2399 is a correct answer
29 Correct 13 ms 49840 KB n = 10, 10992 is a correct answer
30 Correct 12 ms 49756 KB n = 10, 3112 is a correct answer
31 Execution timed out 2056 ms 49756 KB Time limit exceeded
32 Halted 0 ms 0 KB -