結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2018-01-25 02:55:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 948 bytes |
| 記録 | |
| コンパイル時間 | 759 ms |
| コンパイル使用メモリ | 84,296 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 08:31:56 |
| 合計ジャッジ時間 | 1,402 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
int N,M;
cin >> N >> M;
vector< vector<int> > S( N, vector<int>( N, 0 ) );
vector<int> V(N);
for ( int i = 0; i < N; i++ ) {
V[i] = i;
}
for ( int i = 0; i < M; i++ ) {
int a,b,s;
cin >> a >> b >> s;
S[a][b] = s;
}
int ans = 0;
do {
int s = 0;
for ( int i = 0; i < N; i++ ) {
for ( int j = i+1; j < N; j++ ) {
s += S[V[i]][V[j]];
}
}
ans = max( ans, s );
} while ( next_permutation( V.begin(), V.end() ) );
cout << ans << endl;
return 0;
}
tetsuzuki1115