Submission #00073
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n; while ( true ){ cin >> n; if (n == 0) break ; ll ans = 0; ll leed = 0; ll now[2] = {}; vector<ll> a(n),b(n); for (auto &i:a)cin >> i; for (auto &i:b)cin >> i; for (ll i=0;i<n;i++){ now[0] += a[i]; now[1] += b[i]; if (now[0] > now[1]) { if (leed == 0)leed = 1; else if (leed == 2){ ans++; leed = 1; } } else if (now[0] < now[1]) { if (leed == 0)leed = 2; else if (leed == 1){ ans++; leed = 2; } } } cout << ans << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - 追い抜き |
ユーザー名 | DAI_0110 |
投稿日時 | 2025-03-28 11:43:22 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 767 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 688 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
B1 | AC | 31 ms | 604 KB |
1
|
B2 | AC | 25 ms | 688 KB |
1
|
B3 | AC | 25 ms | 644 KB |
1
|
B4 | AC | 28 ms | 472 KB |
1
|