QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#524169#5532. KangarooRong70 0ms0kbC++141.8kb2024-08-19 11:30:282024-08-19 11:30:28

Judging History

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

  • [2024-08-19 11:30:28]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-08-19 11:30:28]
  • 提交

answer

// Go in my style.
// Not afraid to dark.

#include <bits/stdc++.h>
using namespace std;

clock_t start_time, end_time;
#define GET_START start_time = clock ();
#define GET_END end_time = clock (); fprintf (stderr, "TIME COSSEMED : %0.3lf\n", 1.0 * (end_time - start_time) / CLOCKS_PER_SEC);
#define inline __inline__ __attribute__ ((always_inline))

#define int long long

namespace io {
    int read_pos, read_dt; char read_char;
    inline int read (int &p = read_pos){
        p = 0, read_dt = 1; read_char = getchar ();
        while (! isdigit (read_char)){
            if (read_char == '-')
                read_dt = - 1;
            read_char = getchar ();
        }
        while (isdigit (read_char)){
            p = (p << 1) + (p << 3) + read_char - 48;
            read_char = getchar ();
        }
        return p = p * read_dt;
    }
    int write_sta[65], write_top;
    inline void write (int x){
        if (x < 0)
            putchar ('-'), x = - x;
        write_top = 0;
        do
            write_sta[write_top ++] = x % 10, x /= 10;
        while (x);
        while (write_top)
            putchar (write_sta[-- write_top] + 48);
    }
}

const int N = 2e3, mod = 998244353;
int n, s, t, f[N + 5][N + 5];

signed main (){
	GET_START
	
	freopen ("kangaroo.in", "r", stdin);
	freopen ("kangaroo.out", "w", stdout);
	
	
	io::read (n), io::read (s), io::read (t);
	
	f[0][0] = 1;
	for (int i = 1;i <= n;++ i)
		for (int j = 0;j <= n;++ j)
			if (i == s || i == t)
				f[i][j] = (f[i - 1][j] + (j > 0 ? f[i - 1][j - 1] : 0)) % mod;
			else {
				f[i][j] = (f[i][j] + f[i - 1][j + 1] * j % mod) % mod;
				if (j > 0)
					f[i][j] = (f[i][j] + f[i - 1][j - 1] * (j - (i > s) - (i > t)) % mod) % mod;
			}
	io::write (f[n][1]), putchar ('\n');
	
	GET_END
	return 0;
}

詳細信息

Subtask #1:

score: 0
Dangerous Syscalls

Test #1:

score: 0
Dangerous Syscalls

input:

7 3 6

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%