結果
問題 | No.561 東京と京都 |
ユーザー |
|
提出日時 | 2019-08-18 14:27:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 311 bytes |
コンパイル時間 | 1,902 ms |
コンパイル使用メモリ | 191,536 KB |
最終ジャッジ日時 | 2025-01-07 14:10:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:6: warning: ‘d’ is used uninitialized [-Wuninitialized] 9 | k-=d; | ~^~~ main.cpp:6:11: note: ‘d’ was declared here 6 | int n,d; | ^ main.cpp:10:19: warning: ‘n’ is used uninitialized [-Wuninitialized] 10 | for (int i=1;i<n;i++) { | ~^~ main.cpp:6:9: note: ‘n’ was declared here 6 | int n,d; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,d; int t,k; cin>>t>>k; k-=d; for (int i=1;i<n;i++) { int a,b; cin>>a>>b; int pt=t; t=a+max(t,k-d); k=b+max(pt-d,k); } cout<<max(t,k)<<endl; return 0; }