結果
| 問題 | 
                            No.90 品物の並び替え
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kpinkcat
                         | 
                    
| 提出日時 | 2023-10-16 00:05:18 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 721 bytes | 
| コンパイル時間 | 927 ms | 
| コンパイル使用メモリ | 103,188 KB | 
| 最終ジャッジ日時 | 2025-02-17 08:00:45 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 1 WA * 8 | 
ソースコード
#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;
}
            
            
            
        
            
kpinkcat