Submission #1026689

# Submission time Handle Problem Language Result Execution time Memory
1026689 2024-07-18T09:17:49 Z vjudge1 Netrpeljivost (COI23_netrpeljivost) C++17
27 / 100
1500 ms 11120 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
#define endl '\n'
#define N 600
#define M 15
#define big 2147483647 
#define bigg 9223372036854775807 
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second
int dp[N][N],arr[N][N];
int nnn;
vector<pair<int,int>>  hesap(int l,int r){
	vector<pair<int,int>> cev;

	//cout<<l<<" "<<r<<endl;

	if(l==r){		
		dp[l][r]=dp[r][l]=0;
		cev.pb({l,r});
		cev.pb({r,l});
		return cev;
	}
	int mid=(l+r)/2;
	vector<pair<int,int>> a=hesap(l,mid), b=hesap(mid+1,r);
	int mn=bigg;
	for(auto u:a){
		int x=u.f, y=u.s;
		for(auto v:b){
			int m=v.f,n=v.s;
			int top=dp[x][y]+dp[m][n];
			int yes=arr[y][m];
			if(dp[x][n]==-1){
				dp[x][n]=top+yes;
				cev.pb({x,n});
				cev.pb({n,x});
			}
			dp[x][n]=min(dp[x][n],top+yes);
			dp[n][x]=dp[x][n];
			//cout<<x<<" "<<y<<"  "<<m<<" "<<n<<": "<<dp[x][n]<<" "<<yes<<" "<<top<<endl;
			mn=min(mn,dp[x][n]);
		}
	}
	if(l==1&&r==nnn){
		cout<<mn<<" "<<endl;
	}
	return cev;

}
signed main(){
  	lalala;
  	memset(dp,-1,sizeof(dp));
  	cin>>nnn;
  	for(int i=1;i<=nnn;i++){
  		for(int j=1;j<=nnn;j++)cin>>arr[i][j];
  	}
  	hesap(1,nnn);



}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Output is correct
2 Correct 1 ms 3164 KB Output is correct
3 Correct 1 ms 3164 KB Output is correct
4 Correct 1 ms 3164 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 2 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3160 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3124 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 1 ms 3172 KB Output is correct
15 Correct 1 ms 3164 KB Output is correct
16 Correct 1 ms 3164 KB Output is correct
17 Correct 2 ms 3164 KB Output is correct
18 Correct 2 ms 3276 KB Output is correct
19 Correct 1 ms 3164 KB Output is correct
20 Correct 1 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Output is correct
2 Correct 1 ms 3164 KB Output is correct
3 Correct 1 ms 3164 KB Output is correct
4 Correct 1 ms 3164 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 2 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3160 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3124 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 1 ms 3172 KB Output is correct
15 Correct 1 ms 3164 KB Output is correct
16 Correct 1 ms 3164 KB Output is correct
17 Correct 2 ms 3164 KB Output is correct
18 Correct 2 ms 3276 KB Output is correct
19 Correct 1 ms 3164 KB Output is correct
20 Correct 1 ms 3164 KB Output is correct
21 Correct 13 ms 4220 KB Output is correct
22 Correct 17 ms 4356 KB Output is correct
23 Correct 13 ms 4188 KB Output is correct
24 Correct 3 ms 3672 KB Output is correct
25 Correct 2 ms 3676 KB Output is correct
26 Correct 14 ms 4188 KB Output is correct
27 Correct 14 ms 4132 KB Output is correct
28 Correct 13 ms 4188 KB Output is correct
29 Correct 13 ms 4188 KB Output is correct
30 Correct 13 ms 4368 KB Output is correct
31 Correct 14 ms 4188 KB Output is correct
32 Correct 13 ms 4188 KB Output is correct
33 Correct 13 ms 4388 KB Output is correct
34 Correct 17 ms 4440 KB Output is correct
35 Correct 14 ms 4312 KB Output is correct
36 Correct 13 ms 4360 KB Output is correct
37 Correct 13 ms 4188 KB Output is correct
38 Correct 14 ms 4192 KB Output is correct
39 Correct 13 ms 4188 KB Output is correct
40 Correct 13 ms 4188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Output is correct
2 Correct 1 ms 3164 KB Output is correct
3 Correct 1 ms 3164 KB Output is correct
4 Correct 1 ms 3164 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 2 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3160 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3124 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 1 ms 3172 KB Output is correct
15 Correct 1 ms 3164 KB Output is correct
16 Correct 1 ms 3164 KB Output is correct
17 Correct 2 ms 3164 KB Output is correct
18 Correct 2 ms 3276 KB Output is correct
19 Correct 1 ms 3164 KB Output is correct
20 Correct 1 ms 3164 KB Output is correct
21 Correct 13 ms 4220 KB Output is correct
22 Correct 17 ms 4356 KB Output is correct
23 Correct 13 ms 4188 KB Output is correct
24 Correct 3 ms 3672 KB Output is correct
25 Correct 2 ms 3676 KB Output is correct
26 Correct 14 ms 4188 KB Output is correct
27 Correct 14 ms 4132 KB Output is correct
28 Correct 13 ms 4188 KB Output is correct
29 Correct 13 ms 4188 KB Output is correct
30 Correct 13 ms 4368 KB Output is correct
31 Correct 14 ms 4188 KB Output is correct
32 Correct 13 ms 4188 KB Output is correct
33 Correct 13 ms 4388 KB Output is correct
34 Correct 17 ms 4440 KB Output is correct
35 Correct 14 ms 4312 KB Output is correct
36 Correct 13 ms 4360 KB Output is correct
37 Correct 13 ms 4188 KB Output is correct
38 Correct 14 ms 4192 KB Output is correct
39 Correct 13 ms 4188 KB Output is correct
40 Correct 13 ms 4188 KB Output is correct
41 Execution timed out 1552 ms 11120 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Output is correct
2 Correct 1 ms 3164 KB Output is correct
3 Correct 1 ms 3164 KB Output is correct
4 Correct 1 ms 3164 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 2 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3160 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3124 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 1 ms 3172 KB Output is correct
15 Correct 1 ms 3164 KB Output is correct
16 Correct 1 ms 3164 KB Output is correct
17 Correct 2 ms 3164 KB Output is correct
18 Correct 2 ms 3276 KB Output is correct
19 Correct 1 ms 3164 KB Output is correct
20 Correct 1 ms 3164 KB Output is correct
21 Correct 13 ms 4220 KB Output is correct
22 Correct 17 ms 4356 KB Output is correct
23 Correct 13 ms 4188 KB Output is correct
24 Correct 3 ms 3672 KB Output is correct
25 Correct 2 ms 3676 KB Output is correct
26 Correct 14 ms 4188 KB Output is correct
27 Correct 14 ms 4132 KB Output is correct
28 Correct 13 ms 4188 KB Output is correct
29 Correct 13 ms 4188 KB Output is correct
30 Correct 13 ms 4368 KB Output is correct
31 Correct 14 ms 4188 KB Output is correct
32 Correct 13 ms 4188 KB Output is correct
33 Correct 13 ms 4388 KB Output is correct
34 Correct 17 ms 4440 KB Output is correct
35 Correct 14 ms 4312 KB Output is correct
36 Correct 13 ms 4360 KB Output is correct
37 Correct 13 ms 4188 KB Output is correct
38 Correct 14 ms 4192 KB Output is correct
39 Correct 13 ms 4188 KB Output is correct
40 Correct 13 ms 4188 KB Output is correct
41 Execution timed out 1552 ms 11120 KB Time limit exceeded
42 Halted 0 ms 0 KB -