QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234458#4186. Card TradingFyind#WA 0ms3960kbC++171.2kb2023-11-01 17:27:232023-11-01 17:27:23

Judging History

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

  • [2023-11-01 17:27:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3960kb
  • [2023-11-01 17:27:23]
  • 提交

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 = -1, pos;
    vector<pair<ll, pair<ll, ll>>> a(n + 1); // p, b, s
    ll sumb = 0, sums = 0;
    for (int i = 1; i <= n; ++i) {
        ll x, y;
        scanf("%lld.%lld %lld %lld", &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 == -1) {
        cout << "impossible" << '\n';
    }
    else 
        cout << pos / 100 << '.' << pos % 100 << ' ' << ans / 100 << '.' << ans % 100 << '\n';
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3960kb

input:

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

output:

10.0 0.0

result:

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