結果
問題 | No.90 品物の並び替え |
ユーザー |
![]() |
提出日時 | 2020-05-12 20:10:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 92 ms / 5,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 1,620 ms |
コンパイル使用メモリ | 170,004 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 20:27:57 |
合計ジャッジ時間 | 2,292 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, M, it1[100], it2[100], scr[100];cin >> N >> M;for (int i = 0; i < M; i++) {cin >> it1[i] >> it2[i] >> scr[i];}vector<int> V(N);for (int i = 0; i < N; i++) {V[i] = i;}int ans = 0;do {int score = 0;for (int i = 0; i < M; i++) {if (V[it1[i]] < V[it2[i]])score += scr[i];}ans = max(ans, score);} while (next_permutation(V.begin(), V.end()));cout << ans << endl;}