QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#460243#5532. Kangaroofryan6 5ms4892kbC++201.3kb2024-07-01 10:47:232024-07-01 10:47:24

Judging History

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

  • [2024-07-01 10:47:24]
  • 评测
  • 测评结果:6
  • 用时:5ms
  • 内存:4892kb
  • [2024-07-01 10:47:23]
  • 提交

answer

#pragma GCC optimize("trapv")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

const int mod = 1e9+7;
const int mxn = 50;
const int rmxn = 2e3;

int n, cs, cf;
int a[mxn][mxn][mxn], d[mxn][mxn][mxn];

signed main() {
	
	scanf("%lld%lld%lld",&n,&cs,&cf);
	if (cs > cf) swap(cs,cf);
	
	a[2][1][2] = 1;
	d[2][2][1] = 1;
		
	for (int k = 3; k < mxn; k++) {
		for (int i = 1; i <= k; i++) {
			for (int j = i+1; j <= k; j++) {
				
				for (int x = i; x <= k-1; x++) {
					a[k][i][j] += d[k-1][x][j-1];
					a[k][i][j] %= mod;
				}
				for (int x = 1; x < i; x++) {
					d[k][i][j] += a[k-1][x][j-1];
					d[k][i][j] %= mod;
				}
				
			}
			for (int j = 1; j < i; j++) {
				a[k][i][j] = d[k][k+1-i][k+1-j];
				d[k][i][j] = a[k][k+1-i][k+1-j];
			}
		}
	}
	
	printf("%lld",(a[n][cs][cf]+d[n][cs][cf])%mod);
	
	return 0;
}

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 5ms
memory: 4888kb

input:

7 3 6

output:

14

result:

ok 1 number(s): "14"

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #2:

score: 0
Wrong Answer
time: 5ms
memory: 4892kb

input:

39 36 32

output:

805776544

result:

wrong answer 1st numbers differ - expected: '964903316', found: '805776544'

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%