結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-05-10 07:37:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 5,000 ms |
| コード長 | 537 bytes |
| コンパイル時間 | 834 ms |
| コンパイル使用メモリ | 75,492 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-11 00:32:15 |
| 合計ジャッジ時間 | 1,452 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int ans = 0,n,m;
cin >> n >> m;
vector<int> arr(n);
for(int i = 0;i < n;i++) arr[i] = i;
vector<vector<int> > table(n,vector<int>(n));
for(int i = 0;i < m;i++){
int i1,i2,score;
cin >> i1 >> i2 >> score;
table[i1][i2] += score;
}
do{
int tmp = 0;
for(int i = 0;i < n;i++) for(int j = i + 1;j < n;j++) tmp += table[arr[i]][arr[j]];
ans = max(ans,tmp);
}while(next_permutation(arr.begin(),arr.end()));
cout << ans << endl;
}
ldsyb