| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1341218 | sally | Bikeparking (EGOI24_bikeparking) | C++20 | 104 ms | 5104 KiB |
#include<iostream>
#include<vector>
using namespace std;
#define int long long
signed main() {
int N;
cin>>N;
vector<int> slot(N), person(N);
for(int i=0; i<N; i++) cin>>slot[i];
for(int i=0; i<N; i++) cin>>person[i];
int ptr = 0, ans = 0;
// step1: upvote
for(int i=0; i<N; i++) {
int need = person[i];
while(ptr < i && need > 0) {
int take = min(need, slot[ptr]);
slot[ptr] -= take;
need -= take;
ans += take;
if(slot[ptr] == 0) ptr++;
}
person[i] = need;
}
// step2: neutral
for(int i=0; i<N; i++) {
int take = min(slot[i], person[i]);
slot[i] -= take;
person[i] -= take;
}
// step3: downvote
for(int i=0; i<N; i++) {
ans -= person[i];
}
cout<<ans;
}| # | 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... | ||||
