QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#582215#7927. Fortune TellingqwerasdfCompile Error//C++201.7kb2024-09-22 15:40:222024-09-22 15:40:22

Judging History

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

  • [2024-09-22 15:40:22]
  • 评测
  • [2024-09-22 15:40:22]
  • 提交

answer

#include <atcoder/math>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder; //https://github.com/atcoder/ac-library

#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define bit(n, k) ((n >> k) & 1)
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> pii;

int get1(int n, int r){
    // 0,...,n-1
    int remove=(n-1)/6;
    if((n-1)%6>=r)remove++;
    return n-remove;
}

int get2(int k,int r){
    // 0,...,k
    int remove=k/6;
    if(k%6>=r)remove++;
    return k-remove;
}

void test_case(int tt){
    int n; cin>>n;
    vector<vector<ll>> dp(n+1);
    
    const int mod=998244353;
    ll six=inv_mod(6,998244353);
    dp[1].push_back(1);
    function<void(int)> solve=[&](int N)->void {
        if(N<=1)return;
        dp[N].resize(N);
        if(dp[5*N/6].empty())solve(5*N/6);
        if(dp[5*N/6+1].empty())solve(5*N/6+1);
        for(int k=0; k<N; k++){
            ll res=0;
            if(N<6){
                rep(i,0,N){
                    if(k%6!=i%6){
                        res=(res+dp[get1(N,i)][get2(k,i)])%mod;
                    }
                }
                res=(res*inv_mod(N,998244353))%mod;
            }
            else{
                rep(i,0,6){
                    if(k%6!=i%6){
                        res=(res+(dp[get1(N,i)][get2(k,i)]*six%mod))%mod;
                    }
                }
            }
            dp[N][k]=res;
        }
    };
    solve(n);
    rep(i,0,n)cout<<dp[n][i]<<'\n';
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    //cin>>t;
    rep(i, 1, t + 1)
    {
        test_case(i);
    }
    return 0;
}

詳細信息

answer.code:1:10: fatal error: atcoder/math: No such file or directory
    1 | #include <atcoder/math>
      |          ^~~~~~~~~~~~~~
compilation terminated.