結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-10 02:12:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 498 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 51,940 KB |
| 最終ジャッジ日時 | 2024-11-14 18:59:10 |
| 合計ジャッジ時間 | 830 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:9: error: ‘vector’ was not declared in this scope
8 | vector<long long> x(n), w(n), t(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:8:16: error: expected primary-expression before ‘long’
8 | vector<long long> x(n), w(n), t(n);
| ^~~~
main.cpp:9:35: error: ‘x’ was not declared in this scope
9 | for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
| ^
main.cpp:9:41: error: ‘w’ was not declared in this scope
9 | for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
| ^
main.cpp:9:47: error: ‘t’ was not declared in this scope
9 | for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
| ^
main.cpp:13:24: error: ‘x’ was not declared in this scope
13 | auto ct=wt+x[i];
| ^
main.cpp:14:23: error: ‘t’ was not declared in this scope
14 | auto r=ct/t[i];
| ^
main.cpp:17:25: error: ‘w’ was not declared in this scope
17 | else if (ct+w[i]>(r+1)*t[i])
| ^
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, l;
while (cin>>n>>l) {
vector<long long> x(n), w(n), t(n);
for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
auto wt=0LL;
for(int i=0;i<n;++i) {
auto ct=wt+x[i];
auto r=ct/t[i];
if (r%2==1)
wt+=(r+1)*t[i]-ct;
else if (ct+w[i]>(r+1)*t[i])
wt+=(r+2)*t[i]-ct;
}
cout<<l+wt<<endl;
}
}
hogeover30