Submission #817961

#TimeUsernameProblemLanguageResultExecution timeMemory
817961LiudasHiring (IOI09_hiring)C++17
25 / 100
1586 ms21200 KiB
#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)

hiring.cpp: In function 'int main()':
hiring.cpp:10:15: warning: unused variable 'H' [-Wunused-variable]
   10 |     long long H = 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...