Submission #1058534

# Submission time Handle Problem Language Result Execution time Memory
1058534 2024-08-14T10:41:20 Z kachim2 Bikeparking (EGOI24_bikeparking) C++17
0 / 100
56 ms 4956 KB
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
int main()
{
    ll n;
    cin >> n;
    vector<ll> slots(n);
    vector<ll> users(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> slots[i];
    }
    for (ll i = 0; i < n; i++)
    {
        cin >> users[i];
    }
    ll happy = 0;
    ll wanting = 0;
    ll satisfiable = 0;
    for(int i = n-1; i >= 0; i--){
        if(slots[i]){
            if(wanting>0){
                wanting--;
                happy++;
                slots[i]=0;
            }
        }
        if(users[i]) wanting++;
        if(slots[i]&&users[i]) satisfiable++;
    }

    cout << happy-wanting+satisfiable;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 56 ms 4956 KB Output is correct
3 Incorrect 40 ms 4956 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -