結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2014-12-07 20:34:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 793 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 77,880 KB |
| 実行使用メモリ | 10,012 KB |
| 最終ジャッジ日時 | 2024-06-11 16:32:13 |
| 合計ジャッジ時間 | 6,946 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 8 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
void dfs(){
}
int main(){
int n, m;
cin >> n >> m;
vector<pair<int,int> > item(m);
vector<int> score(m);
for(int i=0; i<m; i++){
int x,y,z;
cin >> x >> y >> z;
item[i] = make_pair(x,y);
score[i] = z;
}
vector<int> v(m);
//商品iの位置
for(int i=0; i<m; i++) v[i] = i;
long long ans = 0;
do{
long long tmp = 0;
for(int i=0; i<m; i++){
if( v[ item[i].first ] < v[ item[i].second ] ){
tmp += score[i];
}
}
ans = max(ans, tmp);
}while( next_permutation( v.begin(), v.end() ) );
cout << ans << endl;
return 0;
}
koyumeishi