結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2017-08-22 13:00:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 526 ms / 5,000 ms |
| コード長 | 655 bytes |
| コンパイル時間 | 1,530 ms |
| コンパイル使用メモリ | 170,416 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 04:20:20 |
| 合計ジャッジ時間 | 2,789 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
ソースコード
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
int N,M,I[2][100],S[100];
cin >> N >> M;
for(int i = 0;i < M;i++)cin >> I[0][i] >> I[1][i] >> S[i];
vector<int> v(N);
iota(v.begin(),v.end(),0);
int maxs = 0;
do{
int score = 0;
// for(auto x:v)cout << x << " ";cout << endl;
for(int i = 0;i < M;i++){
if(find(v.begin(),v.end(),I[0][i]) < find(v.begin(),v.end(),I[1][i])){
score += S[i];
}
}
maxs = max(maxs,score);
}while(next_permutation(v.begin(),v.end()));
cout << maxs << endl;
}
Bantako