ICPC 2019宁夏网络赛
Posted accpted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ICPC 2019宁夏网络赛相关的知识,希望对你有一定的参考价值。
ICPC 2019宁夏网络赛
Maximum Element In A Stack
Rolling The Polygon
Caesar Cipher
Take Your Seat
Moving On
#include<bits/stdc++.h> using namespace std; typedef long long ll; int n,m,k,q; int dp[210][210][210]; int d[210],id[210]; bool cmp(int x,int y) return d[x] < d[y]; int main() int _,ca=0; scanf("%d", &_); while (_--) memset(dp, 0x3f, sizeof(dp)); scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) scanf("%d", &d[i]); id[i] = i; sort(id + 1, id + 1 + n, cmp); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) scanf("%d", &dp[0][i][j]); for (int k = 1; k <= n; k++) for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) dp[k][i][j] = min(dp[k - 1][i][j], dp[k - 1][i][id[k]] + dp[k - 1][id[k]][j]); printf("Case #%d:\n",++ca); for (int i = 1; i <= q; i++) int u, v, w; scanf("%d%d%d", &u, &v, &w); int k = 0; for (int i = 1; i <= n; i++) if (d[id[i]] <= w) k = i; printf("%d\n", dp[k][u][v]); return 0;
以上是关于ICPC 2019宁夏网络赛的主要内容,如果未能解决你的问题,请参考以下文章