QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377725 | #2934. How Many Unicycles in a Broken Wheel | L_M_Y | WA | 7ms | 3648kb | C++14 | 1.1kb | 2024-04-05 17:02:34 | 2024-04-05 17:02:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e3 + 10;
const int MOD = 100007;
ll n, dp[N][2][2] = { 0 }, ans = 0;
void slove() {
cin >> n;
for (int i = 2; i <= n; i++)
{
if (i == n)
{
ans = (ans + 1) % MOD;
break;
}
memset(dp[i], 0, sizeof dp[i]);
dp[i][0][0] = dp[i][1][0] = 1;
for (int j = i + 1; j <= n; j++)
{
memset(dp[j], 0, sizeof dp[j]);
dp[j][0][1] = (dp[j][0][1] + dp[j - 1][0][1] + dp[j - 1][1][1] + dp[j - 1][1][0]) % MOD;
dp[j][1][0] = (dp[j][1][0] + dp[j - 1][1][0]) % MOD;
dp[j][1][1] = (dp[j][1][1] + dp[j - 1][0][1] + dp[j - 1][1][1]) % MOD;
}
for (int j = (n - i) / 2 + i; j <= n; j++)
{
ans = (ans + (dp[j][1][0] + dp[j][1][1]) * (dp[n - j + i][1][0] + dp[n - j + i][1][1])) % MOD;
if (j != n)
ans = (ans + (dp[j][1][0] + dp[j][1][1]) * (dp[n - j + i - 1][1][0] + dp[n - j + i - 1][1][1])) % MOD;
}
}
cout << ans << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//cin >> T;
while (T--)
slove();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
5
output:
19
result:
ok single line: '19'
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3648kb
input:
1234
output:
72078
result:
wrong answer 1st lines differ - expected: '50380', found: '72078'