結果
問題 | No.904 サメトロ |
ユーザー |
|
提出日時 | 2022-02-12 22:30:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 3,904 ms |
コンパイル使用メモリ | 228,640 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 01:44:57 |
合計ジャッジ時間 | 4,889 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 8 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using ll=long long; int main(){ int N; cin>>N; int sumA=0,sumB=0; vector<int> A(N-1),B(N-1); for(int i=0;i<N-1;i++){ cin>>A[i]>>B[i]; sumA+=A[i],sumB+=B[i]; } int ans=0; for(int A1=0;A1<=sumB;A1++){ int B1=A1+sumA-sumB; sumA+=A1,sumB+=B1; bool f=true; for(int i=0;i<N-1;i++){ if(A[i]>sumB-B[i]) f=false; } if(f) ans++; sumA-=A1,sumB-=B1; } cout<<ans<<endl; return 0; }