結果

問題 No.90 品物の並び替え
ユーザー J31831276J31831276
提出日時 2018-12-27 23:02:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 63,448 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 03:08:12
合計ジャッジ時間 1,586 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 10 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,948 KB
testcase_04 AC 2 ms
6,948 KB
testcase_05 AC 10 ms
6,944 KB
testcase_06 AC 7 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 111 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <numeric>
#include <vector>

#define ll long long

using namespace std;

int M[10001];

int main(){

   int n,m;
   cin>>n>>m;
   int item1[90],item2[90],score[90];
   vector<int> v;
   for(int i=0;i<n;++i) v.push_back(i);
   for(int i=0;i<m;++i) cin>>item1[i]>>item2[i]>>score[i];
   
   int ans=0;
   do{
	    int mini_ans=0;
        for(int j=0;j<m;++j)
            if(v[item1[j]]<v[item2[j]]) mini_ans+=score[j];
        ans=max(ans,mini_ans);
   }while (next_permutation(v.begin(), v.end()));

   cout<<ans<<endl;

   return 0;
}
0