Submission #1015990

#TimeUsernameProblemLanguageResultExecution timeMemory
1015990isaachewNetrpeljivost (COI23_netrpeljivost)C++17
100 / 100
334 ms57964 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...