QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#719129#2934. How Many Unicycles in a Broken WheelBackToSquare1WA 127ms128840kbC++201.6kb2024-11-06 22:37:462024-11-06 22:37:46

Judging History

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

  • [2024-11-06 22:37:46]
  • 评测
  • 测评结果:WA
  • 用时:127ms
  • 内存:128840kb
  • [2024-11-06 22:37:46]
  • 提交

answer

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> pl;
typedef pair<ld,ld> pd;
typedef vector<ll> vl;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
 
#define G(x) ll x; cin >> x;
#define F(i, l, r) for (ll i = l; i < (r); ++i)
#define all(a) begin(a), end(a)
#define K first
#define V second
#define OK(i,j) i >= 0 && i < n && j >= 0 && j < m
 
#define NN 2505
#define MM 5005
#define MOD 100007

ll dp[4005][4005];
ll sumDp[4005];

void initDp() {
    dp[1][1] = 1;

    for(ll i=2;i<4005;i++) {
        for(ll j=1;j<4005;j++) {
            dp[i][1] = (dp[i][1]+dp[i-1][j])%MOD;
            if(j >= 2) dp[i][j] = (dp[i][j]+dp[i-1][j-1]/(j-1)*j)%MOD;
        }
    }

    for(ll i=0;i<4005;i++) {
        for(ll j=0;j<4005;j++) {
            sumDp[i] = (sumDp[i]+dp[i][j])%MOD;
        }
    }

    sumDp[0] = 1;
}

void solve() {

    initDp();
    ll m;
    cin >> m;

    ll ans = 0;
    for(ll i=0;i<m;i++) {
        for(ll j = i+1;j<m;j++) {
            ll k = j-i+1;
            ans = (ans + k*(k-1)/2*sumDp[i]*sumDp[m-1-j])%MOD;
        }
    }

    cout << ans << '\n';
    // for(ll i=0;i<5;i++) cout << sumDp[i] << ' ';
    // cout << '\n';

}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cout << fixed << setprecision(10);

    solve();

    return 0;

}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 127ms
memory: 128840kb

input:

5

output:

65

result:

wrong answer 1st lines differ - expected: '19', found: '65'