結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-06-15 22:19:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 980 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 85,892 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 21:05:19 |
| 合計ジャッジ時間 | 1,411 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) std::cout<<(p)<<std::endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int rg[9][9];
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(6);//
int N,M;
cin>>N>>M;
int a,b,c;
rep(i,N)rep(j,N)rg[i][j]=0;
rep(i,M){
cin>>a>>b>>c;
rg[a][b] = c;
}
vector<int> data;
rep(i,N){
data.push_back(i);
}
int ans=-1;
int temp;
do{
temp = 0;
rep(i,N){
for(int k=i+1;k<N;++k){
temp += rg[ data[i] ][ data[k] ];
}
}
if(ans < temp){
ans = temp;
}
}while(next_permutation(data.begin(),data.end()));
P(ans);
return 0;
}
IL_msta