# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98483 | sams | Kronican (COCI16_kronican) | C++17 | 3 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 30;
struct node{
int seq, qtd, u;
ll d;
bool operator<(const node& o) const
{
if(d!=o.d) return d > o.d;
return qtd > o.qtd;
}
};
int n, k, m[maxn][maxn], dt[maxn][maxn];
/*node dt[maxn][]
void dijkstra()
{
priority_queue<node> row;
for(int i = 1 ; i <= n ; ++i)
{
row.push({(1<<n), 1, i, 0});
}
while(row.empty())
{
int a, s, c;
ll D;
a = row.top().u, s = row.top().seq, c = row.top().qtd, D = row.top().d;
if(dist )
}
}
*/
int main(){
scanf("%d %d", &n, &k);
for(int i = 1 ; i <= n ; ++i)
for(int j = 1 ; j <= n ; ++j)
scanf ("%d", &m[i][j]), dt[i][j] = m[i][j];
for(int k = 1 ; k <= n ; ++k)
for(int i = 1 ; i <= n ; ++i)
for(int j = 1 ; j <= n ; ++j)
dt[i][j]=min(dt[i][j], dt[i][k] + dt[k][j]);
/*cout << "\n";
for(int i = 1 ; i <= n ; ++i)
for(int j = 1 ; j <= n ; ++j)
cout << dt[i][j] << " \n"[j==n];
*/
if(n==k) cout << "0\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |