結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-09 16:27:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 441 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 52,068 KB |
| 最終ジャッジ日時 | 2024-11-14 18:59:07 |
| 合計ジャッジ時間 | 809 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:9: error: ‘vector’ was not declared in this scope
7 | vector<int> a(n);
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:7:16: error: expected primary-expression before ‘int’
7 | vector<int> a(n);
| ^~~
main.cpp:8:30: error: ‘a’ was not declared in this scope
8 | for(int i=0;i<n;++i) a[i]=i;
| ^
main.cpp:10:23: error: expected primary-expression before ‘int’
10 | vector<vector<int>> score(n, vector<int>(n));
| ^~~
main.cpp:13:17: error: ‘score’ was not declared in this scope
13 | score[a][b]=s;
| ^~~~~
main.cpp:18:64: error: ‘score’ was not declared in this scope
18 | for(int i=0;i<n;++i) for(int j=i+1;j<n;++j) c+=score[a[i]][a[j]];
| ^~~~~
main.cpp:18:70: error: ‘a’ was not declared in this scope
18 | for(int i=0;i<n;++i) for(int j=i+1;j<n;++j) c+=score[a[i]][a[j]];
| ^
main.cpp:20:41: error: ‘a’ was not declared in this scope
20 | } while (next_permutation(begin(a), end(a)));
| ^
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, m; cin>>n>>m;
vector<int> a(n);
for(int i=0;i<n;++i) a[i]=i;
vector<vector<int>> score(n, vector<int>(n));
while (m--) {
int a, b, s; cin>>a>>b>>s;
score[a][b]=s;
}
int res=0;
do {
int c=0;
for(int i=0;i<n;++i) for(int j=i+1;j<n;++j) c+=score[a[i]][a[j]];
res=max(res, c);
} while (next_permutation(begin(a), end(a)));
cout<<res<<endl;
}
hogeover30