結果
問題 | No.90 品物の並び替え |
ユーザー |
|
提出日時 | 2020-07-03 03:10:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 5,000 ms |
コード長 | 573 bytes |
コンパイル時間 | 1,797 ms |
コンパイル使用メモリ | 199,012 KB |
最終ジャッジ日時 | 2025-01-11 13:59:38 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,n) for(int i=0; i<(int)(n); i++)int main() {ios_base::sync_with_stdio(0);cin.tie(0);int n, m;cin >> n >> m;vector<int> v(n);REP (i, n) v[i] = i;vector<vector<int> > scores(n, vector<int>(n));REP (i, m) {int x, y, z;cin >> x >> y >> z;scores[x][y] = z;}int ret = 0;do {int tmp = 0;REP (i, n) REP (j, i) tmp += scores[v[j]][v[i]];ret = max(ret, tmp);} while (next_permutation(v.begin(), v.end()));cout << ret << endl;return 0;}