結果
問題 | No.90 品物の並び替え |
ユーザー |
![]() |
提出日時 | 2025-01-22 00:25:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 111 ms / 5,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 3,608 ms |
コンパイル使用メモリ | 279,772 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-22 00:26:38 |
合計ジャッジ時間 | 4,334 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef LOCAL#include "settings/debug.cpp"#else#define Debug(...) void(0)#endif#define rep(i, n) for (int i = 0; i < (n); ++i)using ll = long long;using ull = unsigned long long;int main() {int n, m;cin >> n >> m;vector<tuple<int, int, int>> s(m);for (auto&& [a, b, c] : s) cin >> a >> b >> c;vector<int> p(n);iota(p.begin(), p.end(), 0);int ans = 0;do {int sum = 0;for (auto [a, b, c] : s) {if (p[a] < p[b]) sum += c;}ans = max(ans, sum);} while (next_permutation(p.begin(), p.end()));cout << ans << endl;return 0;}