Submission #1026686

# Submission time Handle Problem Language Result Execution time Memory
1026686 2024-07-18T09:16:24 Z AKaan37 Netrpeljivost (COI23_netrpeljivost) C++17
10 / 100
550 ms 6492 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
#define _ << " " <<

const lo inf = 1000000000000000000;
const lo li = 5050;
const lo mod = 1000000007;

int n,m,a[li][li],k,flag,t,p[li],l[li],r[li];
int cev;
string s;
vector<int> v;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void dfs(int node,int start,int end,int mask){
	if(start==end){return ;}
	dfs(node*2,start,mid,mask),dfs(node*2+1,mid+1,end,mask);
	if(mask&(1<<node)){
		swap(l[node*2+1],l[node*2]);
		swap(r[node*2+1],r[node*2]);
	}
	//~ cout<<l[node*2+1] _ r[node*2] _ node _ start _ end<<endl;
	cev+=a[l[node*2+1]][r[node*2]];
	l[node]=l[node*2];
	r[node]=r[node*2+1];
}

int32_t main(void){
	fio();
	cin>>n;
	FOR{
		for(int j=1;j<=n;j++)cin>>a[i][j];
		l[i+n-1]=i,r[i+n-1]=i;
	}
	int mn=inf;
	for(int i=0;i<=1000000;i++){for(int j=1;j<=n;j++){l[j+n-1]=j,r[j+n-1]=j;}cev=0;dfs(1,1,n,i);mn=min(mn,cev);}
	cout<<mn<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2508 KB Output is correct
2 Correct 57 ms 2396 KB Output is correct
3 Correct 50 ms 2396 KB Output is correct
4 Correct 65 ms 2392 KB Output is correct
5 Correct 51 ms 2396 KB Output is correct
6 Correct 58 ms 2500 KB Output is correct
7 Correct 51 ms 2508 KB Output is correct
8 Correct 51 ms 2396 KB Output is correct
9 Correct 51 ms 2396 KB Output is correct
10 Correct 51 ms 2396 KB Output is correct
11 Correct 54 ms 2396 KB Output is correct
12 Correct 54 ms 2396 KB Output is correct
13 Correct 51 ms 2396 KB Output is correct
14 Correct 65 ms 2396 KB Output is correct
15 Correct 53 ms 2392 KB Output is correct
16 Correct 51 ms 2396 KB Output is correct
17 Correct 51 ms 2392 KB Output is correct
18 Correct 52 ms 2396 KB Output is correct
19 Correct 51 ms 2392 KB Output is correct
20 Correct 51 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2508 KB Output is correct
2 Correct 57 ms 2396 KB Output is correct
3 Correct 50 ms 2396 KB Output is correct
4 Correct 65 ms 2392 KB Output is correct
5 Correct 51 ms 2396 KB Output is correct
6 Correct 58 ms 2500 KB Output is correct
7 Correct 51 ms 2508 KB Output is correct
8 Correct 51 ms 2396 KB Output is correct
9 Correct 51 ms 2396 KB Output is correct
10 Correct 51 ms 2396 KB Output is correct
11 Correct 54 ms 2396 KB Output is correct
12 Correct 54 ms 2396 KB Output is correct
13 Correct 51 ms 2396 KB Output is correct
14 Correct 65 ms 2396 KB Output is correct
15 Correct 53 ms 2392 KB Output is correct
16 Correct 51 ms 2396 KB Output is correct
17 Correct 51 ms 2392 KB Output is correct
18 Correct 52 ms 2396 KB Output is correct
19 Correct 51 ms 2392 KB Output is correct
20 Correct 51 ms 2392 KB Output is correct
21 Incorrect 550 ms 6492 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2508 KB Output is correct
2 Correct 57 ms 2396 KB Output is correct
3 Correct 50 ms 2396 KB Output is correct
4 Correct 65 ms 2392 KB Output is correct
5 Correct 51 ms 2396 KB Output is correct
6 Correct 58 ms 2500 KB Output is correct
7 Correct 51 ms 2508 KB Output is correct
8 Correct 51 ms 2396 KB Output is correct
9 Correct 51 ms 2396 KB Output is correct
10 Correct 51 ms 2396 KB Output is correct
11 Correct 54 ms 2396 KB Output is correct
12 Correct 54 ms 2396 KB Output is correct
13 Correct 51 ms 2396 KB Output is correct
14 Correct 65 ms 2396 KB Output is correct
15 Correct 53 ms 2392 KB Output is correct
16 Correct 51 ms 2396 KB Output is correct
17 Correct 51 ms 2392 KB Output is correct
18 Correct 52 ms 2396 KB Output is correct
19 Correct 51 ms 2392 KB Output is correct
20 Correct 51 ms 2392 KB Output is correct
21 Incorrect 550 ms 6492 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2508 KB Output is correct
2 Correct 57 ms 2396 KB Output is correct
3 Correct 50 ms 2396 KB Output is correct
4 Correct 65 ms 2392 KB Output is correct
5 Correct 51 ms 2396 KB Output is correct
6 Correct 58 ms 2500 KB Output is correct
7 Correct 51 ms 2508 KB Output is correct
8 Correct 51 ms 2396 KB Output is correct
9 Correct 51 ms 2396 KB Output is correct
10 Correct 51 ms 2396 KB Output is correct
11 Correct 54 ms 2396 KB Output is correct
12 Correct 54 ms 2396 KB Output is correct
13 Correct 51 ms 2396 KB Output is correct
14 Correct 65 ms 2396 KB Output is correct
15 Correct 53 ms 2392 KB Output is correct
16 Correct 51 ms 2396 KB Output is correct
17 Correct 51 ms 2392 KB Output is correct
18 Correct 52 ms 2396 KB Output is correct
19 Correct 51 ms 2392 KB Output is correct
20 Correct 51 ms 2392 KB Output is correct
21 Incorrect 550 ms 6492 KB Output isn't correct
22 Halted 0 ms 0 KB -