結果

問題 No.90 品物の並び替え
ユーザー goodbaton
提出日時 2015-08-04 21:50:13
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 959 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 73,460 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 01:19:45
合計ジャッジ時間 1,370 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
main.cpp:32:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |         scanf("%d%d%d",&item1[i],&item2[i],&score[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000009
#define INF 10000000
#define LLINF 2000000000000000000LL
#define SIZE 101
int main(){
int n,m,a,b,c,ans=0;
int item1[SIZE],item2[SIZE],score[SIZE];
int per[9]={0,1,2,3,4,5,6,7,8};
scanf("%d%d",&n,&m);
for(int i=0;i<m;i++){
scanf("%d%d%d",&item1[i],&item2[i],&score[i]);
}
do{
int dic[9]={0},S=0;
for(int i=0;i<n;i++)
dic[per[i]]=i;
for(int i=0;i<m;i++){
if(dic[item1[i]] < dic[item2[i]])
S+=score[i];
}
ans=max(ans,S);
}while(next_permutation(per,per+n));
printf("%d",ans);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0