結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-10-22 20:49:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 5,000 ms |
| コード長 | 556 bytes |
| コンパイル時間 | 5,709 ms |
| コンパイル使用メモリ | 250,120 KB |
| 最終ジャッジ日時 | 2025-01-25 03:03:35 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 100000000000000000
int main(){
int N,M;
cin>>N>>M;
vector<int> a(M),b(M),s(M);
rep(i,M)cin>>a[i]>>b[i]>>s[i];
vector<int> t(N);
rep(i,N)t[i] = i;
int ans = 0;
do{
int sum = 0;
rep(i,M){
if(t[a[i]]<t[b[i]])sum += s[i];
}
ans = max(ans,sum);
}
while(next_permutation(t.begin(),t.end()));
cout<<ans<<endl;
return 0;
}
沙耶花