QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#657636#9442. Music Gameucup-team1001#WA 0ms3624kbC++231.2kb2024-10-19 15:07:532024-10-19 15:07:53

Judging History

This is the latest submission verdict.

  • [2024-10-19 15:07:53]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3624kb
  • [2024-10-19 15:07:53]
  • Submitted

answer

#include "bits/stdc++.h"

using namespace std;
using i64 = long long;

i64 mod = 998244353;

i64 mul(i64 a, i64 b) {
    return a * b % mod;
}

i64 qpow(i64 a, i64 b) {
    i64 res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        b /= 2;
        a = mul(a, a);
    }
    return res;
}

i64 inv(i64 x) {
    return qpow(x, mod - 2);
}

i64 add(i64 x, i64 y) {
    return (x + y) % mod;
}

i64 sub(i64 x, i64 y) {
    return (x - y + mod) % mod;
}


void solve() {
    int n;
    cin >> n;
    vector<tuple<i64, i64, i64>> arr;
    for (int i = 1; i <= n; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        arr.emplace_back(x, y, z);
    }
    sort(arr.begin(), arr.end(), [&](auto a, auto b) {
        auto [x1, y1, z1] = a;
        auto [x2, y2, z2] = b;
        return x1 * z1 * y2 < x2 * z2 * y1;
    });
    i64 tim = 0;
    for (auto [x, y, z]: arr) {
//        cerr << x << " " << y << " " << z << endl;
        swap(y, z);
        tim = mul((mul(y, inv(z))),
                  add(tim, x));
    }
    cout << tim << endl;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}

详细

Test #1:

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

input:

2
3 3 5
2 4 7

output:

831870305

result:

ok "831870305"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

5
2 5 9
6 4 7
1 9 14
17 8 13
10 4 11

output:

914017655

result:

ok "914017655"

Test #3:

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

input:

8
6 2 8
3 1 8
5 30 71
7 9 58
6 4 7
6 9 25
2 8 67
6 6 55

output:

173088720

result:

wrong answer 1st words differ - expected: '923892723', found: '173088720'