# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
936315 | Trisanu_Das | Netrpeljivost (COI23_netrpeljivost) | C++17 | 467 ms | 90912 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |