Submission #1026700

# Submission time Handle Problem Language Result Execution time Memory
1026700 2024-07-18T09:23:25 Z vjudge1 Netrpeljivost (COI23_netrpeljivost) C++17
27 / 100
1500 ms 7288 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 big 2147483647 
#define bigg 9223372036854775807 
#define pb push_back
//#define p push
//#define ins insert
#define f first
#define s second
ll int dp[N][N],arr[N][N];
int nnn;
vector<pair<int,int>>  hesap(int l,int r){
	vector<pair<int,int>> cev;
	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);
	ll 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;
			ll int top=dp[x][y]+dp[m][n];
			ll int yes=arr[y][m];
			if(dp[x][n]==0){
				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 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 14 ms 3420 KB Output is correct
22 Correct 14 ms 3420 KB Output is correct
23 Correct 13 ms 3416 KB Output is correct
24 Correct 2 ms 2904 KB Output is correct
25 Correct 3 ms 2908 KB Output is correct
26 Correct 14 ms 3440 KB Output is correct
27 Correct 14 ms 3672 KB Output is correct
28 Correct 14 ms 3420 KB Output is correct
29 Correct 14 ms 3420 KB Output is correct
30 Correct 14 ms 3420 KB Output is correct
31 Correct 14 ms 3440 KB Output is correct
32 Correct 14 ms 3420 KB Output is correct
33 Correct 14 ms 3456 KB Output is correct
34 Correct 14 ms 3420 KB Output is correct
35 Correct 13 ms 3436 KB Output is correct
36 Correct 14 ms 3420 KB Output is correct
37 Correct 14 ms 3452 KB Output is correct
38 Correct 15 ms 3420 KB Output is correct
39 Correct 13 ms 3420 KB Output is correct
40 Correct 14 ms 3420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 14 ms 3420 KB Output is correct
22 Correct 14 ms 3420 KB Output is correct
23 Correct 13 ms 3416 KB Output is correct
24 Correct 2 ms 2904 KB Output is correct
25 Correct 3 ms 2908 KB Output is correct
26 Correct 14 ms 3440 KB Output is correct
27 Correct 14 ms 3672 KB Output is correct
28 Correct 14 ms 3420 KB Output is correct
29 Correct 14 ms 3420 KB Output is correct
30 Correct 14 ms 3420 KB Output is correct
31 Correct 14 ms 3440 KB Output is correct
32 Correct 14 ms 3420 KB Output is correct
33 Correct 14 ms 3456 KB Output is correct
34 Correct 14 ms 3420 KB Output is correct
35 Correct 13 ms 3436 KB Output is correct
36 Correct 14 ms 3420 KB Output is correct
37 Correct 14 ms 3452 KB Output is correct
38 Correct 15 ms 3420 KB Output is correct
39 Correct 13 ms 3420 KB Output is correct
40 Correct 14 ms 3420 KB Output is correct
41 Execution timed out 1561 ms 7288 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 14 ms 3420 KB Output is correct
22 Correct 14 ms 3420 KB Output is correct
23 Correct 13 ms 3416 KB Output is correct
24 Correct 2 ms 2904 KB Output is correct
25 Correct 3 ms 2908 KB Output is correct
26 Correct 14 ms 3440 KB Output is correct
27 Correct 14 ms 3672 KB Output is correct
28 Correct 14 ms 3420 KB Output is correct
29 Correct 14 ms 3420 KB Output is correct
30 Correct 14 ms 3420 KB Output is correct
31 Correct 14 ms 3440 KB Output is correct
32 Correct 14 ms 3420 KB Output is correct
33 Correct 14 ms 3456 KB Output is correct
34 Correct 14 ms 3420 KB Output is correct
35 Correct 13 ms 3436 KB Output is correct
36 Correct 14 ms 3420 KB Output is correct
37 Correct 14 ms 3452 KB Output is correct
38 Correct 15 ms 3420 KB Output is correct
39 Correct 13 ms 3420 KB Output is correct
40 Correct 14 ms 3420 KB Output is correct
41 Execution timed out 1561 ms 7288 KB Time limit exceeded
42 Halted 0 ms 0 KB -