結果
問題 | No.904 サメトロ |
ユーザー |
![]() |
提出日時 | 2019-10-12 09:20:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 1,497 ms |
コンパイル使用メモリ | 165,680 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 10:12:35 |
合計ジャッジ時間 | 2,577 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 14 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)#define all(V) V.begin(), V.end()using i64 = int_fast64_t;using P = pair<i64,i64>;int main(){int N;cin >> N;int in = 0, out = 0;int a,b;rep(i,N-1){cin >> a >> b;in += a;out += b;}int ans = 0;for(int i = 0; i <= in; i++){a = out + i - in;if(0 <= a && a <= out) ans++;}cout << ans << endl;}