結果

問題 No.90 品物の並び替え
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-05 17:17:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 200,128 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-25 17:21:50
合計ジャッジ時間 2,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,m;
    cin>>n>>m;
    int a[n][n] {};
    for (int i = 0; i < n; i++) {
        int b, c, d;
        cin>>b>>c>>d;
        a[b][c]=d;
    }
    int b[n];
    for (int i=0;i<n;i++)b[i]=i;
    int ans=0;
    do {
        int sm=0;
        for (int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
                sm+=a[b[i]][b[j]];
        ans=max(ans,sm);
    } while(next_permutation(b, b+n));
    cout<<ans<<endl;
    return 0;
}
0