結果

問題 No.90 品物の並び替え
ユーザー kpinkcatkpinkcat
提出日時 2023-10-16 00:05:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 1,157 ms
コンパイル使用メモリ 103,924 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-16 00:05:20
合計ジャッジ時間 1,922 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    ll n, m, ans = 0, arr[9], list[90][90];
    cin >> n >> m;
    for (int i = 0; i < n; i++) arr[i] = i;
    for (int i = 0; i < m; i++) {
        int t1, t2, t3;
        cin >> t1 >> t2 >> t3;
        list[t1][t2] = t3;
    }
    do {
        ll tmp = 0;
        for (int i = 0; i < m; i++){
            for (int j = i+1; j < n; j++){
                tmp += list[j][i];
            }
        }
        ans = max(ans, tmp);
    }while (next_permutation(arr, arr+n));
    cout << ans << endl;
}
0