| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1222058 | shehasanormalusername | Bikeparking (EGOI24_bikeparking) | C++20 | 48 ms | 2632 KiB |
#include <bits/stdc++.h>
using namespace std;
#define vt vector
int main() {
int n; cin >> n;
vt<int> a(n), b(n);
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < n; i++) cin >> b[i];
int ans = 0;
int numbetter = 0;
int neutrals = 0;
for(int i = 0; i < n; i++) {
if(b[i] && numbetter) {
if(!a[i]) numbetter--;
ans++;
} else if(b[i] && a[i]) {
if(neutrals) {
neutrals--;
numbetter++;
} else {
neutrals++;
a[i]--;
}
} else if(b[i] && !a[i]) {
if(neutrals) {
neutrals--;
} else {
ans--;
}
}
numbetter += a[i];
}
cout << ans << "\n";
}
// subtask 3| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
