제출 #1141070

#제출 시각아이디문제언어결과실행 시간메모리
1141070FaggiHiring (IOI09_hiring)C++20
33 / 100
1595 ms12256 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) int(x.size()) #define forn(i,n) for(i=0; i<n; i++) #define all(x) x.begin(),x.end() #define pb push_back #define mp make_pair #define fr first #define se second using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n, w, i, s, q, ma=0, cant, j; double costLevel, acum; cin >> n >> w; vector<pair<ll,double>>v(n); vector<double>costs(n); for(i=0; i<n; i++) { cin >> s >> q; v[i].first=q; costLevel=double(s)/double(q); v[i].second=costLevel; costs[i]=costLevel; } sort(all(v)); sort(all(costs)); vector<ll>act,maV; for(i=0; i<n; i++) { costLevel=costs[i]; acum=0; cant=0; act.resize(0); for(j=0; j<n; j++) { if(v[j].second<=costLevel) { if(double(costLevel*v[j].first)+acum>double(w)) break; acum+=double(costLevel*v[j].first); cant++; act.pb(j); } } if(cant>ma) { ma=cant; maV=act; } } cout << maV.size() << '\n'; for(auto k:maV) cout << k+1 << '\n'; 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...