# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
817961 | Liudas | Hiring (IOI09_hiring) | C++17 | 1586 ms | 21200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
struct node{
long long Q;
long long P;
};
int main()
{
long long N, W;
long long H = 0;
cin >> N >> W;
vector<node> arr(N), brr;
for(int i = 0; i < N; i ++){
cin >> arr[i].P >> arr[i].Q;
}
int cm = 0;
for(int i = 0; i < N; i ++){
node start = arr[i];
brr = arr;
int price = 0;
int c = 0;
sort(brr.begin(), brr.end(), [&](node a, node b){return a.Q * start.P < b.Q * start.P;});
for(node j : brr){
if(start.P * j.Q >= j.P * start.Q && (price + j.Q) * start.P <= W * start.Q){
c ++;
price += j.Q;
}
}
cm = max(c, cm);
}
cout << cm << endl;
for(int i = 0; i < cm; i ++){
cout << i + 1 << endl;
}
return 0;
}
Compilation message (stderr)
# | 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... |
# | 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... |