제출 #1058538

#제출 시각아이디문제언어결과실행 시간메모리
1058538kachim2Bikeparking (EGOI24_bikeparking)C++17
0 / 100
52 ms5896 KiB
#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+min(ll(0), -wanting+satisfiable); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...