Submission #118246

# Submission time Handle Problem Language Result Execution time Memory
118246 2019-06-18T12:38:25 Z dorijanlendvaj Shortcut (IOI16_shortcut) C++14
0 / 100
2000 ms 404 KB
#include "shortcut.h"
#define ll long long
#include <bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
#define x first
const ll LLINF=1ll<<60;
#define y second
#define pb push_back
#define pii pair<int,int>
#define vi vector<int> 
#define vl vector<ll>
const char en='\n';

void fil(int start,vl&dist,int n,vi l,vi d,int c,int lo,int hi)
{
	priority_queue<pair<ll,int>> pq;
	pq.push({0,start});
	vector<bool> bio;
	bio.resize(2*n);
	while (pq.size())
	{
		int i=pq.top().y;
		ll di=pq.top().x;
		pq.pop();
		if (bio[i]) continue;
		bio[i]=1;
		dist[i]=-di;
		//cout<<lo<<' '<<hi<<' '<<i<<' '<<start<<' '<<-di<<endl;
		if (i%2==0)
		{
			pq.push({di-d[i/2],i+1});
			if (i<n*2-2) pq.push({di-l[i/2],i+2});
			if (i/2==lo) pq.push({di-c,hi*2});
			if (i>0) pq.push({di-l[i/2-1],i-2});
			if (i/2==hi) pq.push({di-c,lo*2});
		}
		else
		{
			pq.push({di-d[i/2],i-1});
		}
	}
}

const int dissss=-361;

ll find_shortcut(int n,vi l,vi d,int c)
{
	assert(n<=100);
	ll mi=LLINF;
	for (int lll=0;lll<n;++lll) for (int r=lll+1;r<n;++r)
	{
		ll ma=0,ii=-1,jj=-1;
		for (int j=0;j<n;++j)
		{
			vl dist(2*n,LLINF);
			fil(j*2+1,dist,n,l,d,c,lll,r);
			for (int i=0;i<2*n;++i)
			{
				ma=max(ma,dist[i]);
				if (dist[i]==dissss) ii=i,jj=j*2+1;
			}
		}
		mi=min(mi,ma);
		if (ma==dissss) cout<<lll<<' '<<r<<' '<<ii<<' '<<jj<<en;
	}
	return mi;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 4, 80 is a correct answer
2 Correct 2 ms 384 KB n = 9, 110 is a correct answer
3 Correct 2 ms 256 KB n = 4, 21 is a correct answer
4 Correct 2 ms 384 KB n = 3, 4 is a correct answer
5 Correct 2 ms 256 KB n = 2, 62 is a correct answer
6 Correct 2 ms 256 KB n = 2, 3 is a correct answer
7 Correct 2 ms 256 KB n = 3, 29 is a correct answer
8 Correct 2 ms 256 KB n = 2, 3 is a correct answer
9 Correct 2 ms 256 KB n = 2, 3 is a correct answer
10 Correct 2 ms 256 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 256 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 384 KB n = 3, 3000000000 is a correct answer
14 Correct 2 ms 384 KB n = 4, 3000000001 is a correct answer
15 Correct 2 ms 384 KB n = 4, 4000000000 is a correct answer
16 Correct 2 ms 384 KB n = 5, 4000000000 is a correct answer
17 Correct 3 ms 384 KB n = 10, 1000000343 is a correct answer
18 Correct 3 ms 256 KB n = 10, 3189 is a correct answer
19 Correct 3 ms 400 KB n = 10, 7000000000 is a correct answer
20 Correct 2 ms 384 KB n = 5, 12 is a correct answer
21 Correct 2 ms 384 KB n = 5, 25 is a correct answer
22 Correct 2 ms 256 KB n = 2, 122 is a correct answer
23 Correct 4 ms 384 KB n = 10, 117 is a correct answer
24 Correct 3 ms 404 KB n = 10, 336 is a correct answer
25 Correct 3 ms 384 KB n = 10, 438 is a correct answer
26 Correct 3 ms 384 KB n = 10, 206 is a correct answer
27 Correct 3 ms 384 KB n = 10, 636 is a correct answer
28 Correct 2 ms 384 KB n = 4, 2399 is a correct answer
29 Correct 3 ms 384 KB n = 10, 10992 is a correct answer
30 Correct 3 ms 384 KB n = 10, 3112 is a correct answer
31 Execution timed out 2050 ms 384 KB Time limit exceeded
32 Halted 0 ms 0 KB -