QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234446#4186. Card TradingFyind#WA 0ms3724kbC++171.2kb2023-11-01 17:22:362023-11-01 17:22:36

Judging History

你现在查看的是最新测评结果

  • [2023-11-01 17:22:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3724kb
  • [2023-11-01 17:22:36]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)

int main() {
    int n;
    scanf("%d", &n);
    ll ans = 0, pos;
    vector<pair<int, pair<int, int>>> a(n + 1); // p, b, s
    ll sumb = 0, sums = 0;
    for (int i = 1; i <= n; ++i) {
        int x, y;
        scanf("%d.%d %d %d", &x, &y, &a[i].se.fi, &a[i].se.se);
        a[i].fi = x * 100 + y;
    }
    sort(a.begin() + 1, a.end());
    for (int i = 1; i <= n; ++i)
        sumb += a[i].se.fi;
    for (int i = 1; i <= n; ++i) {
        int cur = i;
        sums += a[cur].se.se;
        while (cur <= n && a[cur + 1].fi == a[cur].fi)
            sums += a[++cur].se.se;
        // cout << i << ':' << sums << ' ' << sumb << endl;
        if (1ll * a[i].fi * min(sums, sumb) > ans)
            ans = 1ll * a[i].fi * min(sums, sumb), pos = a[i].fi;
        for (int j = i; j <= cur; ++j)
            sumb -= a[i].se.fi;
        i = cur;
    }
    if (ans == 0.0) {
        cout << "impossible" << '\n';
    }
    else 
        cout << pos / 100 << '.' << pos % 100 << ' ' << ans / 100 << '.' << ans % 100 << '\n';
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3704kb

input:

5
12.00 0 3
11.99 2 0
11.98 5 0
10.00 1 0
12.01 0 6

output:

impossible

result:

ok 

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3724kb

input:

6
2.85 14 0
4.50 0 1
5.26 3 3
6.17 1 0
14.78 0 2
21.04 1 0

output:

5.26 21.4

result:

wrong answer Wrong answer: Price is formatted incorrectly (21.4).