結果
| 問題 | No.90 品物の並び替え |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2022-11-10 01:05:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 5,000 ms |
| コード長 | 483 bytes |
| コンパイル時間 | 2,922 ms |
| コンパイル使用メモリ | 245,036 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 05:49:57 |
| 合計ジャッジ時間 | 3,518 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,i,j,cur,ans=0;
scanf("%d%d",&N,&M);
int score[M][3],ord[N];
for(i=0;i<M;++i){
for(j=0;j<3;++j){
scanf("%d",&score[i][j]);
}
}
for(i=0;i<N;++i)ord[i]=i;
do{
cur=0;
for(i=0;i<M;++i){
if(ord[score[i][0]]<ord[score[i][1]]){
cur+=score[i][2];
}
}
if(ans<cur){
ans=cur;
}
}while(next_permutation(ord,ord+N));
printf("%d\n",ans);
}
ytft