結果
問題 |
No.860 買い物
|
ユーザー |
|
提出日時 | 2019-08-09 23:47:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 1,000 ms |
コード長 | 266 bytes |
コンパイル時間 | 542 ms |
コンパイル使用メモリ | 66,512 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 15:58:15 |
合計ジャッジ時間 | 2,184 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N; long dp[1<<17]; main() { cin>>N; long sum=0; long a=2e9,b=2e9; for(int i=0;i<N;i++) { long C,D;cin>>C>>D; sum+=C+D; a=min(a,dp[i]-D); b=min(b,a+C); dp[i+1]=b; } cout<<sum+b<<endl; }