Submission #817963

#TimeUsernameProblemLanguageResultExecution timeMemory
817963LiudasHiring (IOI09_hiring)C++17
38 / 100
1587 ms15216 KiB
#include <bits/stdc++.h> using namespace std; struct node{ long long Q; long long P; int id; }; int main() { long long N, W; long long H = 0; cin >> N >> W; vector<node> arr(N); vector<int> ans; for(int i = 0; i < N; i ++){ cin >> arr[i].P >> arr[i].Q; arr[i].id = i + 1; } for(int i = 0; i < N; i ++){ node start = arr[i]; long long price = 0; long long c = 0; sort(arr.begin(), arr.end(), [&](node a, node b){return a.Q * start.P < b.Q * start.P;}); vector<int> brr; for(node j : arr){ if(start.P * j.Q >= j.P * start.Q && (price + j.Q) * start.P <= W * start.Q){ c ++; price += j.Q; brr.push_back(j.id); } } if(H < c){ ans = brr; } H = max(c, H); } cout << H << endl; for(int i : ans){ cout << i << endl; } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...