QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#755758#9627. 算术Rosmontis_L#WA 0ms3568kbC++201.5kb2024-11-16 17:59:322024-11-16 17:59:32

Judging History

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

  • [2024-11-16 17:59:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3568kb
  • [2024-11-16 17:59:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
const int mod = 998244353;
void solve()
{
    multiset<ll> s;
    ll t, x;
    cin >> t;
    for (int i = 2; i <= 9; i++)
    {
        cin >> x;
        for (int j = 1; j <= x; j++)
            s.insert(i);
    }
    if(s.empty())
    {
        int cx = 0, cy = t / 3, cz = 0;
        t %= 3;
        if(t == 1)
            cy--, cz++;
        else if(t == 2)
            cy--, cx++;
        ll res = 1;
        for (int i = 1; i <= cx; i++)
            res = res * 2 % mod;
        for (int i = 1; i <= cy; i++)
            res = res * 3 % mod;
        for (int i = 1; i <= cz; i++)
            res = res * 4 % mod;
        cout << res << '\n';
        return;
    }
    int ls = t;
    for (int i = 1; i <= ls; i++)
    {
        auto it = s.begin();
        int p = *it;
        if(p == 3)
            break;
        t--;
        s.erase(it);
        s.insert(p + 1);
    }
    int cx = 0, cy = t / 3, cz = 0;
    t %= 3;
    if(t == 1)
        cy--, cz++;
    else if(t == 2)
        cx++;
    for (int i = 1; i <= cx; i++)
        s.insert(2);
    for (int i = 1; i <= cy; i++)
        s.insert(3);
    for (int i = 1; i <= cz; i++)
        s.insert(4);
    ll res = 1;
    for(auto i : s)
         res = res * i % mod;
    cout << res << endl;
}

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

詳細信息

Test #1:

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

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

54
108
4
10
90
90553232
143532368

result:

wrong answer 3rd lines differ - expected: '1', found: '4'