제출 #936315

#제출 시각아이디문제언어결과실행 시간메모리
936315Trisanu_DasNetrpeljivost (COI23_netrpeljivost)C++17
100 / 100
467 ms90912 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int N = 2050;
const int INF = 0x3f3f3f3f;
 
int n, cst[N][N];
ll dp[N][N];
 
int main(){
	scanf("%d", &n);
	for(int i = 0;i < n;i++) for(int j = 0;j < n;j++) scanf("%d", &cst[i][j]);
	for(int p = 1;p < n;p++) {
		int ch = p & (-p);
		for(int z = 0;z < n;z++) {
			dp[p][z] = (ll)1e18;
			int zz = (z ^ ch) & (~(ch - 1));
			for(int t = zz;t < zz + ch;t++) dp[p][z] = min(dp[p][z], dp[p - 1][t] + cst[t][z]);
		}
	}
	ll sol = (ll)1e18;
	for(int i = 0;i < n;i++) sol = min(sol, dp[n - 1][i]);
	printf("%lld\n", sol);
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
Main.cpp:13:57: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  for(int i = 0;i < n;i++) for(int j = 0;j < n;j++) scanf("%d", &cst[i][j]);
      |                                                    ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...