# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
749549 | 2023-05-28T07:49:25 Z | 반딧불(#9967) | Gym Badges (NOI22_gymbadges) | C++17 | 146 ms | 4684 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; pair<int, int> arr[500002]; //int DP[5002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &arr[i].first); for(int i=1; i<=n; i++) scanf("%d", &arr[i].second); sort(arr+1, arr+n+1, [&](pair<int, int> A, pair<int, int> B){ if(A.first + A.second != B.first + B.second) return A.first + A.second < B.first + B.second; return A.second < B.second; }); // for(int i=1; i<=n+1; i++) DP[i] = 2e9; // for(int i=1; i<=n; i++){ // for(int j=i-1; j>=0; j--){ // if(DP[j] <= arr[i].second) DP[j+1] = min(DP[j+1], DP[j] + arr[i].first); // } // } int ans = 0; while(ans+1<=n && arr[1].second >= arr[ans+1].first) arr[1].second -= arr[++ans].first; printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 146 ms | 4684 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |