結果
| 問題 |
No.904 サメトロ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-12 22:33:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 656 bytes |
| コンパイル時間 | 3,602 ms |
| コンパイル使用メモリ | 230,824 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-29 01:47:52 |
| 合計ジャッジ時間 | 4,664 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 13 |
ソースコード
#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;
if(A1<0||B1<0) continue;
bool f=true;
if(A1>sumB-B1) f=false;
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;
}