| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 749005 | myrcella | Hiring (IOI09_hiring) | C++17 | 473 ms | 12984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fi first.first
#define se first.second
#define id second
#define pb push_back
#define pii pair<int,int>
#define ll __int128
#define pll pair<ll,ll>
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define SZ(x) ((int)((x).size()))
const int maxn = 5e5+10;
int n;
ll m;
pair<pii,int> worker[maxn];
bool cmp(pair<pii,int> x, pair<pii,int> y) {
return x.fi*y.se < y.fi*x.se;
}
priority_queue <pii> q;
void solve() {
while (!q.empty()) q.pop();
ll tmp = 0;
int hi = -1,pos;
ll val;
rep(i,0,n) {
q.push({worker[i].se,i}),tmp += worker[i].se;
while (tmp * worker[i].fi > m*worker[i].se) tmp -= q.top().first, q.pop();
if (SZ(q) > hi or (SZ(q)==hi and val * worker[pos].fi * worker[i].se > tmp*worker[i].fi*worker[pos].se)) hi = SZ(q),pos = i,val = tmp;
}
while (!q.empty()) q.pop();
tmp = 0;
rep(i,0,pos+1) {
q.push({worker[i].se,i}),tmp += worker[i].se;
while (tmp * worker[i].fi > m*worker[i].se) tmp -= q.top().first, q.pop();
}
printf("%d\n",hi);
while (!q.empty()) printf("%d\n",worker[q.top().second].id),q.pop();
}
bool check(int cnt, bool hi) {
return false;
}
int main() {
scanf("%d %lld",&n,&m);
rep(i,0,n) {
cin>>worker[i].fi>>worker[i].se;
worker[i].id = i+1;
}
sort(worker,worker+n,cmp);
solve();
}
/*
4 100 5 1000 10 100 8 10 20 1
3 4 1 2 1 3 1 3
3 40 10 1 10 2 10 3
*/
컴파일 시 표준 에러 (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... | ||||
