이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
/*
O(n^2 log n) what
*/
int main(){
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int n;
std::cin>>n;
std::vector<std::vector<int>> netrp(n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int x;
std::cin>>x;
netrp[i].push_back(x);
}
}
std::vector<long long> ccosts(n);
for(int i=1;i<n;i++){
std::vector<long long> nccosts(n,1e18);
for(int j=0;j<n;j++){
for(int k=0;!(i&k);k++){
nccosts[j^k^(i&-i)]=std::min(nccosts[j^k^(i&-i)],ccosts[j]+netrp[j][j^k^(i&-i)]);
}
}
ccosts=nccosts;
}
long long mn=1e18;
for(int i=0;i<n;i++)mn=std::min(mn,ccosts[i]);
std::cout<<mn<<'\n';
}
# | 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... |