結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-01 03:27:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 930 bytes |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 52,208 KB |
| 最終ジャッジ日時 | 2024-11-14 18:58:56 |
| 合計ジャッジ時間 | 1,290 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:5:1: error: ‘vector’ does not name a type
5 | vector<unsigned> Cost[51][51], Time[51][51];
| ^~~~~~
main.cpp: In function ‘void dfs(int, unsigned int, unsigned int)’:
main.cpp:12:43: error: ‘Cost’ was not declared in this scope
12 | for(int i=p+1;i<=N;++i) for(int j=0;j<Cost[p][i].size();++j)
| ^~~~
main.cpp:13:35: error: ‘Time’ was not declared in this scope; did you mean ‘time’?
13 | dfs(i, m+Cost[p][i][j], t+Time[p][i][j]);
| ^~~~
| time
main.cpp: In function ‘int main()’:
main.cpp:20:13: error: ‘Cost’ was not declared in this scope
20 | Cost[i][j].clear();
| ^~~~
main.cpp:21:13: error: ‘Time’ was not declared in this scope; did you mean ‘time’?
21 | Time[i][j].clear();
| ^~~~
| time
main.cpp:23:9: error: ‘vector’ was not declared in this scope
23 | vector<int> s(V), t(V), y(V), m(V);
| ^~~~~~
main.cpp:4:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
3 | #include <cstring>
+++ |+#include <vector>
4 | using namespace std;
main.cpp:23:16: error: expected primary-expression before ‘int’
23 | vector<int> s(V), t(V), y(V), m(V);
| ^~~
main.cpp:24:21: error: ‘s’ was not declared in this scope
24 | for(int& x: s) cin>>x;
| ^
main.cpp:25:21: error: ‘t’ was not declared in this scope
25 | for(int& x: t) cin>>x;
| ^
main.cpp:26:21: error: ‘y’ was not declared in this scope
26 | for(int& x: y) cin>>x;
| ^
main.cpp:27:21: error: ‘m’ was not declared in this scope
27 | for(int& x: m) cin>>x;
| ^
main.cp
ソースコード
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
vector<unsigned> Cost[51][51], Time[51][51];
int N, C, V;
unsigned res;
void dfs(int p, unsigned m, unsigned t)
{
if (m>C or t>res) return;
if (p==N) res=t;
for(int i=p+1;i<=N;++i) for(int j=0;j<Cost[p][i].size();++j)
dfs(i, m+Cost[p][i][j], t+Time[p][i][j]);
}
int main()
{
while (cin>>N>>C>>V) {
for(int i=1;i<=N;++i) for(int j=1;j<=N;++j) {
Cost[i][j].clear();
Time[i][j].clear();
}
vector<int> s(V), t(V), y(V), m(V);
for(int& x: s) cin>>x;
for(int& x: t) cin>>x;
for(int& x: y) cin>>x;
for(int& x: m) cin>>x;
for(int i=0;i<V;++i) {
int a=s[i], b=t[i];
Cost[a][b].push_back(y[i]);
Time[a][b].push_back(m[i]);
}
res=-1u;
dfs(1, 0, 0);
cout<<(int)res<<endl;
}
}
hogeover30