Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
MOD = 100000 until (n, m, s = gets.split.map(&:to_i)).all?(&:zero?) dp = Array.new(m + 1){Array.new(n * n + 1){Array.new(s + 1, 0)}} dp[0][0][0] = 1 (1 .. m).each do |i| dp[i] = Marshal.load(Marshal.dump(dp[i - 1])) (1 .. n * n).each do |j| (i .. s).each do |k| dp[i][j][k] += dp[i - 1][j - 1][k - i] dp[i][j][k] %= MOD end end end p dp.last.last.last end
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
using namespace std; int N, M, S, cnt; void DFS(int num, int rest, int sum){ if( rest == 0 ){ if( sum + num > S ){ return ; }else{ cnt++; return ; } } for(int i = num; i <= M - rest; i++){ int tmp = sum; for( int j = num; j < rest + 1; j++ ){ tmp += j; } if( tmp > S ){ return ; } sum += i; DFS(i + 1, rest - 1, sum); sum -= i; } } int main(void){ while( 1 ){ cin >> N >> M >> S; if( N == 0 && M == 0 && S == 0 ){ break; } cnt = 0; DFS( 1, N * N - 1, 0 ); cout << cnt << '\n'; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x[2000 + 1][3000 + 1]; int y[2000 + 1][3000 + 1]; int main() { int n, m, s; while (true) { cin >> n >> m >> s; if ((n == 0 && m == 0) && s == 0) { break; } memset(x, 0, sizeof(x)); memset(y, 0, sizeof(y)); for (int i = 1; i <= m; i++) { x[i][i] = 1; } for (int i = 2; i <= n * n; i++) { for (int j = 1; j <= m; j++) { for (int k = 1; k <= s; k++) { for (int l = j + 1; l <= m; l++) { y[l][k + l] += x[j][k]; } } } for (int j = 0; j <= m; j++) { for (int k = 0; k <= s; k++) { x[j][k] = y[j][k] % 100000; y[j][k] = 0; } } y[0][0] = 0; } int sum = 0; for (int i = 0; i <= m; i++) { sum += x[i][s]; sum %= 100000; } cout << sum << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { for (int n, m, sum; scanf("%d%d%d", &n, &m, &sum), n;) { n *= n; static int dp[50][2001][3001]; for (int d = 0; d < (m + 1); d++) dp[0][d][0] = 1; for (int i = 0; i < (n); i++) for (int d = 1; d <= m; d++) for (int s = 0; s < (sum + 1); s++) { dp[i + 1][d][s] = dp[i + 1][d - 1][s]; if (s - d >= 0) dp[i + 1][d][s] += dp[i][d - 1][s - d]; } printf("%d\n", dp[n][m][sum]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
dp[55][3005],n,m,s,i,j;main(k){for(;scanf("%d%d%d",&n,&m,&s)&n;printf("%d\n",dp[n*n][s])){for(i=0;i<50;i++)for(j=0;j<=s;)dp[i][j++]=!i&!j;for(i=1;i<=m;i++)for(j=50;j>0;j--)for(k=i;k<=s;)dp[j][k++]=(dp[j-1][k-i]+dp[j][k])%100000;}}
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}; const int kaijou[10] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; int main() { while (1) { int n, m, s; scanf("%d%d%d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) break; static int dp[2002][3002] = {}; for (int i = 0; i < 2002; i++) { for (int j = 0; j < 3002; j++) { if (j == 0) dp[i][j] = 1; else dp[i][j] = 0; } } for (int i = 1; i <= n * n; i++) { for (int j = s + 1 - 1; j >= 0; j--) { for (int k = 1; k <= m; k++) { if (j >= k) { dp[k][j] = dp[k - 1][j - k]; } else dp[k][j] = 0; dp[k][j] %= 100000; } dp[0][j] = 0; } for (int j = 0; j < s + 1; j++) { for (int k = 1; k <= m; k++) { dp[k][j] += dp[k - 1][j]; dp[k][j] %= 100000; } } } printf("%d\n", dp[m][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[3000 + 1][2000 + 1][2]; vector<int> ns[8]; vector<int> ms, ss; vector<int> ret; int main() { while (1) { cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) break; ns[N].push_back((int)ms.size()); ms.push_back(M); ss.push_back(S); ret.push_back(0); } int n = 1; for (int i = 0; i <= 2000; i++) { dp[0][i][1] = 1; } for (int a = 1; a <= 49; a++) { for (int j = 3000; j >= 0; j--) { int v = min(2000, j); for (int k = 1; k <= v; k++) { dp[j][k][0] = dp[j - k][k - 1][1]; } dp[j][0][1] = dp[j][0][0]; for (int k = 1; k <= 2000; k++) { dp[j][k][1] = dp[j][k - 1][1] + dp[j][k][0]; if (dp[j][k][1] >= 100 * 1000) { dp[j][k][1] -= 100 * 1000; } } } if (a == n * n) { for (int i = 0; i < ns[n].size(); i++) { int j = ns[n][i]; ret[j] = dp[ss[j]][ms[j]][1]; } n++; } } for (int i = 0; i < ret.size(); i++) { cout << ret[i] << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m, s; int dp[50][3001][2001]; int main() { while (1) { scanf("%d %d %d", &n, &m, &s); if (n == 0) break; memset(dp, 0, sizeof(dp)); for (int i = 1; i < m + 1; i++) { dp[1][i][i] = 1; } for (int i = 2; i < n * n + 1; i++) { for (int j = 3; j < s + 1; j++) { for (int k = 2; k < m + 1; k++) { if (j - k >= 1) { dp[i][j][k] += dp[i - 1][j - k][k - 1]; dp[i][j][k] %= 100000; } dp[i][j][k] += dp[i][j][k - 1]; dp[i][j][k] %= 100000; } } } printf("%d\n", dp[n * n][s][m]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
//y09-6 ビンゴ(2回目) #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <time.h> #include <string> #include <vector> #include <map> #include <list> #include <set> #include <stack> #include <queue> #include <cstdlib> #include <algorithm> #include <random> #include <cassert> using namespace std; #define LL long long #undef INT_MIN #undef INT_MAX #define INT_MIN -2147483648 #define INT_MAX 2147483647 #define LL_MIN -9223372036854775808 #define LL_MAX 9223372036854775807 #define segment_size 65536 #define ROOP() while (true) int main(){ ROOP(){ int N,M,S; cin >> N >> M >> S; if(N==0) return 0; int dp[50][3001]; for(int i=0; i<50; i++){ for(int j=0; j<3001; j++){ dp[i][j] = 0; } } dp[0][0] = 1; for(int i=1; i<=N*N; i++){ for(int j=i; j<=S; j++){ if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i]; if(j>m) dp[i][j] -= dp[i-1][j-m-1]; dp[i][j] %= 100000; } } cout << dp[N*N][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2001][3001]; int main() { int n, m, s; while (cin >> n >> m >> s && n) { memset(dp, 0, sizeof(dp)); n = n * n; for (int i = 1; i <= m; i++) dp[0][i][i] = 1; for (int i = 1; i < n; i++) { for (int j = 0; j < 2001; j++) for (int k = 0; k < 3001; k++) dp[i & 1][j][k] = 0; for (int y = 0; y <= s; y++) { int tmp = 0; for (int x = 1; x <= m && x + y <= s; x++) { dp[i & 1][x][y + x] += tmp; if (dp[i & 1][x][y + x] >= 100000) dp[i & 1][x][y + x] -= 100000; tmp += dp[(i + 1) & 1][x][y]; if (tmp >= 100000) tmp -= 100000; } } } int ans = 0; for (int i = 1; i <= m; i++) ans = (ans + dp[(n + 1) & 1][i][s]) % 100000; cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; const int mod = 100000; struct Mod { public: int num; Mod() : Mod(0) { ; } Mod(long long int n) : num((n % mod + mod) % mod) { static_assert(mod < INT_MAX / 2, "mod is too big, please make num 'long long int' from 'int'"); } Mod(int n) : Mod(static_cast<long long int>(n)) { ; } operator int() { return num; } }; Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); } Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; } Mod operator+(const Mod a, const long long int b) { return b + a; } Mod operator++(Mod &a) { return a + Mod(1); } Mod operator-(const Mod a, const Mod b) { return Mod((mod + a.num - b.num) % mod); } Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; } Mod operator--(Mod &a) { return a - Mod(1); } Mod operator*(const Mod a, const Mod b) { return Mod(((long long)a.num * b.num) % mod); } Mod operator*(const long long int a, const Mod b) { return Mod(a) * b; } Mod operator*(const Mod a, const long long int b) { return Mod(b) * a; } Mod operator*(const Mod a, const int b) { return Mod(b) * a; } Mod operator+=(Mod &a, const Mod b) { return a = a + b; } Mod operator+=(long long int &a, const Mod b) { return a = a + b; } Mod operator-=(Mod &a, const Mod b) { return a = a - b; } Mod operator-=(long long int &a, const Mod b) { return a = a - b; } Mod operator*=(Mod &a, const Mod b) { return a = a * b; } Mod operator*=(long long int &a, const Mod b) { return a = a * b; } Mod operator*=(Mod &a, const long long int &b) { return a = a * b; } Mod operator^(const Mod a, const int n) { if (n == 0) return Mod(1); Mod res = (a * a) ^ (n / 2); if (n % 2) res = res * a; return res; } Mod mod_pow(const Mod a, const long long int n) { if (n == 0) return Mod(1); Mod res = mod_pow((a * a), (n / 2)); if (n % 2) res = res * a; return res; } Mod inv(const Mod a) { return a ^ (mod - 2); } Mod operator/(const Mod a, const Mod b) { assert(b.num != 0); return a * inv(b); } Mod operator/(const long long int a, const Mod b) { return Mod(a) / b; } Mod operator/=(Mod &a, const Mod b) { return a = a / b; } Mod fact[1024000], factinv[1024000]; void init(const int amax = 1024000) { fact[0] = Mod(1); factinv[0] = 1; for (int i = 0; i < amax - 1; ++i) { fact[i + 1] = fact[i] * Mod(i + 1); factinv[i + 1] = factinv[i] / Mod(i + 1); } } Mod comb(const int a, const int b) { return fact[a] * factinv[b] * factinv[a - b]; } int main() { while (1) { int N, M, S; cin >> N >> M >> S; if (!N) break; int asize = N * N; const int rest = S - (1 + asize) * asize / 2; if (rest < 0) cout << 0 << endl; else { vector<vector<Mod>> mp(M + 1, vector<Mod>(rest + 1)); mp[0][rest] = 1; for (int i = 0; i < asize; ++i) { vector<vector<Mod>> nextmp(M + 1, vector<Mod>(rest + 1)); for (int j = 0; j < mp.size(); ++j) { for (int k = 0; k < mp[j].size(); ++k) { if (mp[j][k].num) { const int least = j; const int arest = k; for (int n = least; n <= min(M - asize, arest / (asize - i)); ++n) { nextmp[n][arest - n] += mp[j][k]; } } } } mp = nextmp; } Mod ans = 0; for (int i = 0; i < mp.size(); ++i) ans += mp[i][0]; cout << ans << endl; } } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
python2
mod=100000 while 1: n,m,s=map(int,raw_input().split()) if n==m==s==0:break dp=[[[0]*(s+1) for _ in xrange(m+2)] for _ in xrange(2)] for i in xrange(n**2): for j in xrange(1,m+1): for k in xrange(1,s+1): if i==0: if j>=k: dp[(i+1)&1][j+1][k]=1 else: if j>k: dp[(i+1)&1][j+1][k]=dp[(i+1)&1][j][k] continue dp[(i+1)&1][j+1][k]=(dp[(i+1)&1][j][k])%mod dp[(i+1)&1][j+1][k]+=(dp[i&1][j][k-j])%mod print(dp[(n**2)&1][m+1][s]%mod)
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const long long INF = 1LL << 61LL; static const double EPS = 1e-8; static const int mod = 100000; int N, M, S; int mem[50][100][1001]; long long cal(int n, int mx, int sum) { long long res = 0; if (mem[n][mx][sum] != -1) return mem[n][mx][sum]; if (n == N * N) { if (sum == S) { return 1; } else return 0; } for (int i = mx + 1; i <= M; ++i) { if (sum + i > S) break; res += cal(n + 1, i, sum + i); } return mem[n][mx][sum] = res % mod; } int main() { while (1) { cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) break; memset(mem, -1, sizeof(mem)); cout << cal(0, 0, 0) << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int surplus = 100000; int n, m, s, N, ans, ss[50]; int b[50][3001]; bool judge[50][2001][3001]; int dp(int now, int num, int sum) { if (sum > s) return 0; ss[now] = 0; for (int i = (num); i < (m + 1); i++) { if (now == N) { if (sum + i == s) { return 1; } else if (i == m) { return 0; } } else { if (!judge[now][i][sum]) { b[now][sum] += dp(now + 1, i + 1, sum + i); judge[now][i][sum] = 1; b[now][sum] %= surplus; } } } return b[now][sum]; } int main() { while (cin >> n >> m >> s) { if (!n && !m && !s) return 0; ans = 0; N = n * n; dp(1, 1, 0); for (int i = (1); i < (s + 1); i++) { ans += b[1][i]; } ans %= surplus; cout << ans << endl; for (int i = (1); i < (50); i++) { ss[i] = 0; for (int j = (1); j < (2001); j++) { for (int k = (0); k < (3001); k++) { b[i][k] = 0; judge[i][j][k] = 0; } } } } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][3001][50]; const int mod = 100000; int n, m, s; int main() { while (cin >> n >> m >> s && (n | m | s)) { memset(dp, 0, sizeof(dp)); for (int i = 0; i < 2; i++) dp[i][0][n * n] = 1; for (int i = m; i >= 0; i--) { for (int j = 0; j <= s; j++) { for (int k = n * n; k >= 0; k--) { int cur = (i + 1) % 2; int nxt = i % 2; dp[nxt][j][k] = 0; if (k == n * n) { if (j == 0) dp[nxt][j][k] = 1; else dp[nxt][j][k] = 0; } else { dp[nxt][j][k] += dp[cur][j][k]; if (j - i >= 0) dp[nxt][j][k] += dp[cur][j - i][k + 1]; } dp[nxt][j][k] %= mod; } } } cout << dp[1][s][0] % mod << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <cstdio> #include <algorithm> #include <cstring> using namespace std; int n, m, s; long long int dp[50][3001][2001]; int main(){ while(1){ scanf("%d %d %d", &n, &m, &s); if(n == 0) break; memset(dp, 0, sizeof(dp)); for(int i=1; i<m+1; i++){ dp[1][i][i] = 1; } for(int i=2; i<n*n+1; i++){ for(int j=3; j<s+1; j++){ for(int k=2; k<m+1; k++){ if(j-k>=1){ dp[i][j][k] += dp[i-1][j-k][k-1]; // dp[i][j][k] %= 100000; } dp[i][j][k] += dp[i][j][k-1]; // dp[i][j][k] %= 100000; } } } /* for(int i=0; i<n*n; i++){ printf("%d\n", i); for(int j=1; j<s+1; j++){ for(int k=1; k<m+1; k++){ printf("%d\t", dp[i][j][k]); } printf("\n"); } } */ printf("%lld\n", dp[n*n][s][m]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x[2000 + 1][3000 + 1]; int y[2000 + 1][3000 + 1]; int main() { int n, m, s; while (true) { cin >> n >> m >> s; if ((n == 0 && m == 0) && s == 0) { break; } memset(x, 0, sizeof(x)); memset(y, 0, sizeof(y)); for (int i = 1; i <= m; i++) { x[i][i] = 1; } for (int i = 2; i <= n * n; i++) { for (int j = i - 1; j <= m; j++) { for (int k = j + (i - 2) * (i - 1) / 2; k <= s; k++) { for (int l = j + 1; l <= m; l++) { y[l][k + l] += x[j][k]; } } } y[2000][3000] = 0; for (int j = 0; j <= m; j++) { for (int k = 0; k <= s; k++) { x[j][k] = y[j][k] % 100000; y[j][k] = 0; } } y[0][0] = 0; } int sum = 0; for (int i = 0; i <= m; i++) { sum += x[i][s]; sum %= 100000; } cout << sum << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}; const int kaijou[10] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; int main() { while (1) { int n, m, s; scanf("%d%d%d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) break; static int dp[2002][3002] = {}; for (int i = 0; i < 2002; i++) { for (int j = 0; j < 3002; j++) { if (j == 0) dp[i][j] = 1; else dp[i][j] = 0; } } int l = 0; for (int i = 1; i <= n * n; i++) { l += i; for (int j = s + 1 - 1; j >= 0; j--) { } for (int j = l; j <= s; j++) { for (int k = 1; k <= min(m, j); k++) { dp[k][j] = dp[k - 1][j - k]; dp[k][j] %= 100000; } for (int k = min(m, j); k <= m; k++) { dp[k][j] = 0; } dp[0][j] = 0; } for (int j = l - i; j < l; j++) { for (int k = 0; k < m + 1; k++) { dp[j][k] = 0; } } for (int j = 0; j < s + 1; j++) { for (int k = 1; k <= m; k++) { dp[k][j] += dp[k - 1][j]; dp[k][j] %= 100000; } } } printf("%d\n", dp[m][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[3000 + 1][2000 + 1]; int dp2[3000 + 1][2000 + 1]; vector<int> ns[8]; vector<int> ms, ss; vector<int> ret; int main() { while (1) { cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) break; ns[N].push_back((int)ms.size()); ms.push_back(M); ss.push_back(S); ret.push_back(0); } int n = 1; for (int i = 0; i <= 2000; i++) { dp2[0][i] = 1; } for (int a = 1; a <= 49; a++) { for (int j = 0; j <= 3000; j++) { int v = min(2000, j); for (int k = 0; k <= v; k++) { if (j - k >= 0 && k > 0) { dp[j][k] = dp2[j - k][k - 1]; } } } for (int j = 0; j <= 3000; j++) { dp2[j][0] = dp[j][0]; for (int k = 1; k <= 2000; k++) { dp2[j][k] = dp2[j][k - 1] + dp[j][k]; if (dp2[j][k] >= 100 * 1000) { dp2[j][k] -= 100 * 1000; } } } if (a == n * n) { for (int i = 0; i < ns[n].size(); i++) { int j = ns[n][i]; ret[j] = dp2[ss[j]][ms[j]]; } n++; } } for (int i = 0; i < ret.size(); i++) { cout << ret[i] << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m, s, ans; int dp[2][2001][3001]; int main() { while (cin >> n >> m >> s && n) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int i = 0; i < n * n; ++i) { for (int j = 0; j < m; ++j) { for (int k = 0; k < s; ++k) { dp[1][j + 1][k + 1] = (dp[1][j][k] + dp[0][j][k - j]) % 100000; } } for (int j = 0; j <= m; ++j) { for (int k = 0; k <= s; ++k) { dp[0][j][k] = dp[1][j][k]; dp[1][j][k] = 0; } } } ans = 0; for (int i = 0; i <= m; ++i) { ans += dp[0][i][s]; ans %= 100000; } cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[50][2001][3001]; int main() { for (int i = 1; i <= 2000; i++) { dp[1][i][i] = 1; } for (int i = 1; i < 49; i++) { for (int j = 1; j < 2000; j++) { for (int k = 1; k < 3000; k++) { if (k + j + 1 > 3000) break; dp[i + 1][j + 1][k + j + 1] += dp[i][j][k] + dp[i + 1][j][k + j]; dp[i + 1][j + 1][k + j + 1] %= 100000; } } } int N, M, S; while (cin >> N >> M >> S) { int ans = 0; for (int i = 1; i <= M; i++) { ans += dp[N * N][i][S]; } printf("%d\n", ans % 100000); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m, s; int dp[50][3001][2001]; int main() { while (1) { scanf("%d %d %d", &n, &m, &s); if (n == 0) break; memset(dp, 0, sizeof(dp)); for (int i = 1; i < m + 1; i++) { if (i <= s) dp[1][i][i] = 1; } for (int i = 2; i < n * n + 1; i++) { for (int j = 1; j < m + 1; j++) { for (int k = 1; k < j; k++) { for (int l = 1; l < s + 1; l++) { if (l + j <= s) { dp[i][l + j][j] += dp[i - 1][l][k]; dp[i][l + j][j] %= 100000; } } } } } int ans = 0; for (int j = 1; j < m + 1; j++) { ans += dp[n * n][s][j]; ans %= 100000; } printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; constexpr int mod = 100000; int main() { int N, M, S; cin >> N >> M >> S; vector<vector<long long>> dp(S + 1, vector<long long>(M + 1, 0)); dp[0][0] = 1; for (int i = 0; i < N * N; i++) { vector<vector<long long>> nxt(S + 1, vector<long long>(M + 1, 0)); for (int j = 0; j <= S; j++) for (int k = 1; k <= M; k++) dp[j][k] = (dp[j][k] + dp[j][k - 1]) % mod; for (int k = 1; k <= M; k++) for (int j = k; j <= S; j++) nxt[j][k] = (nxt[j][k] + dp[j - k][k - 1]) % mod; swap(dp, nxt); } long long ret = 0; for (int i = 1; i <= M; i++) ret += mod + dp[S][i]; ret %= mod; return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; const int mod = 100000; struct Mod { public: int num; Mod() : Mod(0) { ; } Mod(long long int n) : num((n % mod + mod) % mod) { static_assert(mod < INT_MAX / 2, "mod is too big, please make num 'long long int' from 'int'"); } Mod(int n) : Mod(static_cast<long long int>(n)) { ; } operator int() { return num; } }; Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); } Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; } Mod operator+(const Mod a, const long long int b) { return b + a; } Mod operator++(Mod &a) { return a + Mod(1); } Mod operator-(const Mod a, const Mod b) { return Mod((mod + a.num - b.num) % mod); } Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; } Mod operator--(Mod &a) { return a - Mod(1); } Mod operator*(const Mod a, const Mod b) { return Mod(((long long)a.num * b.num) % mod); } Mod operator*(const long long int a, const Mod b) { return Mod(a) * b; } Mod operator*(const Mod a, const long long int b) { return Mod(b) * a; } Mod operator*(const Mod a, const int b) { return Mod(b) * a; } Mod operator+=(Mod &a, const Mod b) { return a = a + b; } Mod operator+=(long long int &a, const Mod b) { return a = a + b; } Mod operator-=(Mod &a, const Mod b) { return a = a - b; } Mod operator-=(long long int &a, const Mod b) { return a = a - b; } Mod operator*=(Mod &a, const Mod b) { return a = a * b; } Mod operator*=(long long int &a, const Mod b) { return a = a * b; } Mod operator*=(Mod &a, const long long int &b) { return a = a * b; } Mod operator^(const Mod a, const int n) { if (n == 0) return Mod(1); Mod res = (a * a) ^ (n / 2); if (n % 2) res = res * a; return res; } Mod mod_pow(const Mod a, const long long int n) { if (n == 0) return Mod(1); Mod res = mod_pow((a * a), (n / 2)); if (n % 2) res = res * a; return res; } Mod inv(const Mod a) { return a ^ (mod - 2); } Mod operator/(const Mod a, const Mod b) { assert(b.num != 0); return a * inv(b); } Mod operator/(const long long int a, const Mod b) { return Mod(a) / b; } Mod operator/=(Mod &a, const Mod b) { return a = a / b; } Mod fact[1024000], factinv[1024000]; void init(const int amax = 1024000) { fact[0] = Mod(1); factinv[0] = 1; for (int i = 0; i < amax - 1; ++i) { fact[i + 1] = fact[i] * Mod(i + 1); factinv[i + 1] = factinv[i] / Mod(i + 1); } } Mod comb(const int a, const int b) { return fact[a] * factinv[b] * factinv[a - b]; } int main() { while (1) { int N, M, S; cin >> N >> M >> S; if (!N) break; int asize = N * N; const int rest = S - (1 + asize) * asize / 2; if (rest < 0) cout << 0 << endl; else { vector<vector<Mod>> mp(M + 1, vector<Mod>(rest + 1)); mp[0][rest] = 1; int amax = 0; for (int i = 0; i < asize; ++i) { vector<vector<Mod>> nextmp(M + 1, vector<Mod>(rest + 1)); int aamax = amax; for (int j = 0; j <= amax; ++j) { for (int k = 0; k < mp[j].size(); ++k) { if (mp[j][k].num) { const int least = j; const int arest = k; for (int n = least; n <= min(M - asize, arest / (asize - i)); ++n) { nextmp[n][arest - n] += mp[j][k]; aamax = max(aamax, n); } } } } amax = max(aamax, amax); mp = nextmp; } Mod ans = 0; for (int i = 0; i < mp.size(); ++i) ans += mp[i][0]; cout << ans << endl; } } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int main(void) { int i, j, k; int n, m, s; int hoge = 0; while (scanf("%d%d%d", &n, &m, &s), n) { ++hoge; if (hoge >= 12) exit(1); } puts("a"); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.Scanner; //Bingo public class Main{ void run(){ Scanner sc = new Scanner(System.in); int MOD = 100000; // long T = System.currentTimeMillis(); int[][][] dp = new int[2][2001][3001]; for(;;){ int N = sc.nextInt(), M = sc.nextInt(), S = sc.nextInt(); if((N|M|S)==0)break; N*=N; int X = 1; for(int x=1;x<=N;x++,X=1-X)for(int m=1;m<=M;m++)for(int s=1;s<=S;s++){ dp[X][m][s] = 0; if(x==1){ if(s<=m)dp[X][m][s]++; } else{ dp[X][m][s]+=dp[X][m-1][s]; if(s-m>=0)dp[X][m][s]+=dp[1-X][m-1][s-m]; } if(MOD<=dp[X][m][s])dp[X][m][s]-=MOD; } System.out.println(dp[1-X][M][S]); } // System.out.println(System.currentTimeMillis()-T); } public static void main(String[] args) { new Main().run(); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int surplus = 100000; int N, ans; int b[50][2001][3001]; int main() { int n, m, s; while (cin >> n >> m >> s) { if (!n && !m && !s) return 0; ans = 0; N = n * n; for (int i = (1); i < (m); i++) b[1][i][i] = 1; for (int i = (1); i < (N + 1); i++) { for (int j = (1); j < (m); j++) { for (int k = (1); k < (s); k++) { if (!b[i][j + 1][k + 1]) { b[i][j + 1][k + 1] = b[i][j][k] + b[i - 1][j][k - j]; b[i][j + 1][k + 1] %= surplus; } if (i == N && k + 1 == s) ans += b[i][j + 1][k + 1]; } } } cout << ans % surplus << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][55][3005]; int n, m, s; int main(void) { cin >> n >> m >> s; n *= n; dp[0][0][0] = 1; for (int i = 1; i <= m; i++) { for (int j = 0; j <= n; j++) { for (int k = j * (j + 1) / 2; k <= min(s, (i * 2 - j + 1) * j / 2); k++) { dp[i % 2][j][k] = dp[(i + 1) % 2][j][k]; if (k - i >= 0 && j > 0) dp[i % 2][j][k] = (dp[(i + 1) % 2][j - 1][k - i] + dp[i % 2][j][k]) % 100000; } } } cout << dp[m % 2][n][s] << endl; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int main() { for (int n, m, s, i, j, d[50][3500], M = 1e5; std::cin >> n >> m >> s, n *= n;) { std::fill(d[0], d[50], M); d[0][0] = 1; for (i = 1; i <= n; ++i) for (j = 0; j <= s; ++j) { if (j >= i) d[i][j] += d[i - 1][j - i] + d[i][j - i]; if (j > m) d[i][j] -= d[i - 1][j - m - 1]; d[i][j] %= M; } printf("%d\n", d[n][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int dp[50][3001]; int main() { while (1) { int i; int n, m, s; int square; scanf("%d %d %d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) { return 0; } memset(dp, 0, sizeof(dp)); square = n * n; dp[0][0] = 1; for (i = 1; i < m + 1; i++) { int j; for (j = s; j >= i; j--) { int k; for (k = 0; k < square; k++) { dp[k + 1][j] += dp[k][j - i]; } } } printf("%d\n", dp[square][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int main(void) { int i, j, k; int n, m, s; int hoge = 0; while (scanf("%d%d%d", &n, &m, &s), n) { ++hoge; if (hoge >= 100) exit(1); } puts("a"); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int N, M, S; cin >> N >> M >> S; vector<vector<int> > dp(N * N + 1, vector<int>(S + 1, 0)); dp[0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = N * N; j >= 1; j--) { for (int k = i; k <= S; k++) { (dp[j][k] += dp[j - 1][k - i]) %= 100000; } } } cout << dp[N * N][S] << endl; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 7; const int MAXM = 2005; const int MAXS = 3005; const int mod = 100000; int N, M, S; int dp[2][MAXM][MAXS]; int main() { while (cin >> N >> M >> S && (N | M | S)) { fill(dp[0][0], dp[2][0], 0); dp[0][0][0] = 1; for (int i = 0; i < N * N; ++i) { int p = i % 2; int q = 1 - p; for (int j = 0; j <= M; ++j) for (int k = 0; k <= S; ++k) dp[q][j][k] = 0; for (int j = 0; j <= M; ++j) { for (int k = 0; k <= S; ++k) { if (dp[p][j][k] == 0) continue; for (int m = j + 1; m <= M && k + m <= S; ++m) { dp[q][m][k + m] += dp[p][j][k]; dp[q][m][k + m] %= mod; } } } } int res = 0; for (int j = 0; j <= M; ++j) { res += dp[(N * N) % 2][j][S]; res %= mod; } cout << res << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s; while (cin >> n >> m >> s) { if (n == 0 && m == 0 && s == 0) break; int dp[2][2300][3300]; for (long long i = 0; i < (long long)(2); i++) for (long long j = 0; j < (long long)(2300); j++) for (long long k = 0; k < (long long)(3300); k++) dp[i][j][k] = 0; dp[0][0][0] = 1; for (int i = 1; i <= n * n; i++) { for (int j = 0; j < 2300; j++) for (int k = 0; k < 3300; k++) dp[i % 2][j][k] = 0; for (int j = 1; j <= m; j++) { for (int k = 1; k <= s; k++) { if (k - j >= 0) { dp[i % 2][j][k] += dp[i % 2][j - 1][k - 1] + dp[(i - 1) % 2][j - 1][k - j]; dp[i % 2][j][k] %= 100000; } } } } long long ans = 0; for (int i = 0; i <= m; i++) { ans += dp[(n * n) % 2][i][s]; ans %= 100000; } cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[2][2001][3001]; int main() { while (cin >> N >> M >> S) { if (N == 0 && M == 0 && S == 0) break; for (int i = 0; i < 2; i++) { for (int j = 1; j <= M; j++) { for (int k = 1; k <= S; k++) { dp[i][j][k] = 0; } } } for (int i = 1; i <= min(M, S); i++) dp[0][i][i] = 1; for (int i = 0; i < N * N - 1; i++) { int _ = i % 2; for (int j = 1; j <= M; j++) { for (int k = 1; k <= S; k++) { dp[_ ^ 1][j][k] = 0; } } for (int j = 1; j <= M; j++) { for (int k = (i * (i - 1) / 2) + j; k <= S; k++) { if (dp[_][j][k] == 0) continue; int s = N * N - i - 1; int ss = k + (s - 1) * s / 2; if (ss + s * (j + 1) > S) break; for (int l = j + 1; l <= min(M, S - k); l++) { if (ss + s * l > S) break; dp[_ ^ 1][l][k + l] = (dp[_ ^ 1][l][k + l] + dp[_][j][k]) % 100000; } } } } int m = 0; for (int i = 0; i <= M; i++) m = (m + dp[(N * N - 1) % 2][i][S]) % 100000; cout << m << "\n"; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[7 * 7 + 1][3000 + 1]; int main() { int N, M, S; scanf("%d %d %d", &N, &M, &S); dp[0][0] = 1; for (int k = 1; k <= M; ++k) { for (int i = N * N; i >= 1; --i) { for (int j = k; j <= S; ++j) { dp[i][j] += dp[i - 1][j - k]; dp[i][j] %= 100000; } } } printf("%d\n", dp[N * N][S]); }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2048][64]; int N, M, S; int main(void) { while (scanf("%d %d %d", &N, &M, &S) && N != 0) { bool flg = false; for (int i = 0; i < 2048; i++) { for (int j = 0; j < 64; j++) { dp[0][i][j] = 0; dp[1][i][j] = 0; } } dp[flg][0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = 0; j <= S; j++) { for (int k = 0; k <= N * N; k++) { if (dp[flg][j][k] != 0) { if (i + j <= S) { dp[!flg][j + i][k + 1] += dp[flg][j][k]; dp[!flg][j + i][k + 1] %= 100000; } dp[!flg][j][k] += dp[flg][j][k]; dp[!flg][j][k] %= 100000; } } } for (int j = 0; j <= S; j++) { for (int k = 0; k <= N * N; k++) { dp[flg][j][k] = 0; } } flg = !flg; } printf("%d\n", dp[flg][S][N * N]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<iostream> #include<algorithm> #include<vector> #include<stack> #include<map> #include<set> #include<queue> #include<cstdio> #include<climits> #include<cmath> #include<cstring> #include<string> #include<sstream> #include<numeric> #include<cassert> #define f first #define s second #define mp make_pair #define REP(i,n) for(int i=0; i<(int)(n); i++) #define rep(i,s,n) for(int i=(s); i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define ALL(c) (c).begin(), (c).end() #define IN(x,s,g) ((x) >= (s) && (x) < (g)) #define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h))) #define print(x) printf("%d\n",x) using namespace std; typedef unsigned int uint; typedef long long ll; const int _dx[] = {0,1,0,-1}; const int _dy[] = {-1,0,1,0}; int getInt(){ int ret = 0,c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define MOD 100000 int n,m,s; int memo[2001][3001]; int prevs[2][3001]; int *prev, *prev2; int dp,dp2; int main(){ while(true){ n = getInt(); m = getInt(); s = getInt(); if(n+m+s == 0) break; n = n * n; prev = prevs[0]; prev2 = prevs[1]; REP(i,n){ if(i == 0){ REP(k,m+1) REP(j,s+1) memo[k][j] = 0; rep(x,1,m+1){ int xx = x * n; if(xx > s) break; memo[x][xx] = 1; } }else{ memset(prev,0,sizeof(int)*s); if(i % 12 == 0){ rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*s); rep(y,n-i,s+1){ memo[x][y] = (memo[x-1][y-(n-i)] + prev[y-(n-i)]) % MOD; } swap(prev,prev2); } }else{ rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*s); rep(y,n-i,s+1){ memo[x][y] = (memo[x-1][y-(n-i)] + prev[y-(n-i)]); } swap(prev,prev2); } } } } int ans = 0; REP(i,m+1) ans = (ans + memo[i][s]) % MOD; print(ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { while (true) { int N, M, S; cin >> N >> M >> S; if (N == 0) return 0; M = min(M, S); int dp[50][3001]; for (int i = 0; i < 50; i++) { for (int j = 0; j < 3001; j++) { dp[i][j] = 0; } } dp[0][0] = 1; for (int i = 1; i <= N * N; i++) { for (int j = 1; j <= S; j++) { if (j >= i) dp[i][j] = dp[i - 1][j - i] + dp[i][j - i]; if (j > M) dp[i][j] -= dp[i - 1][j - M - 1]; dp[i][j] %= 100000; } } cout << dp[N * N][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int _dx[] = {0, 1, 0, -1}; const int _dy[] = {-1, 0, 1, 0}; int getInt() { int ret = 0, c; c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret *= 10; ret += c - '0'; c = getchar(); } return ret; } int n, m, second; int memo[2][2001][3001]; int dp, dp2; int main() { while (true) { n = getInt(); m = getInt(); second = getInt(); if (n + m + second == 0) break; n = n * n; dp = 0; dp2 = 1; for (int i = 0; i < (int)(n); i++) { swap(dp, dp2); for (int k = 0; k < (int)(m + 1); k++) for (int j = 0; j < (int)(second + 1); j++) memo[dp][k][j] = 0; if (i == 0) { for (int x = (1); x < (int)(m + 1); x++) { int xx = x * n; if (xx > second) break; memo[dp][x][xx] = 1; } } else { for (int x = (1); x < (int)(m + 1); x++) for (int y = (n - i); y < (int)(second + 1); y++) { memo[dp][x][y] = (memo[dp][x - 1][y - (n - i)] + memo[dp2][x - 1][y - (n - i)]) % 100000; } } } int ans = 0; for (int i = 0; i < (int)(m + 1); i++) ans = (ans + memo[dp][i][second]) % 100000; printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[50][2001][3001]; int func(int n, int m, int s) { if (s < 0) return 0; if (dp[n][m][s] != -1) return dp[n][m][s]; if (n == 0) { if (s == 0) return 1; else return 0; } int res = 0; for (int i = 1; i < m + 1; i++) { res += func(n - 1, i - 1, s - i); res %= 100000; } return dp[n][m][s] = res % 100000; } int main() { int n, m, s; while (cin >> n >> m >> s, (n || m) || s) { for (int i = 0; i < n * n + 1; i++) for (int j = 0; j < m + 1; j++) for (int k = 0; k < s + 1; k++) dp[i][j][k] = -1; cout << func(n * n, m, s) << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int DP[50][2001][3001]; int main() { int n, m, s; long long int sum; for (int i = 0; i < 50; i++) { for (int j = 0; j <= 2000; j++) { for (int k = 0; k <= 3000; k++) { DP[i][j][k] = 0; } } } DP[1][1][1] = 1; for (int i = 1; i < 50; i++) { for (int j = 1; j <= 2000; j++) { for (int k = 1; k <= 3000; k++) { if (i == 1 && j == k) { DP[i][j][k] = 1; } else if (k < j) { DP[i][j][k] = DP[i][j - 1][k]; } else { DP[i][j][k] = DP[i][j - 1][k] + DP[i - 1][j - 1][k - j]; if (DP[i][j][k] > 100000) { DP[i][j][k] = DP[i][j][k] % 100000; } } } } } while (true) { cin >> n >> m >> s; if (n == 0 && m == 0 && s == 0) { break; } cout << DP[n * n][m][s] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void) { int i, j, k; int n, m, s; for (i = 0; scanf("%d%d%d", &n, &m, &s), n; ++i) { if (i == 0) { if (n % 4 == 0) { for (;;) ; } if (n % 4 == 1) { exit(1); } if (n % 4 == 2) { puts("a"); } if (n % 4 == 3) { char* hoge = new char[32768 * 1024 * 2]; } } } puts("a"); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[64][3005]; int main() { while (scanf("%d%d%d", &N, &M, &S) && N || M || S) { memset(dp, 0, sizeof dp); dp[0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = ((N) * (N)); j >= 0; j--) { for (int s = 0; s <= S; s++) { dp[j + 1][s + i] = (dp[j + 1][s + i] + dp[j][s]) % 100000; } } } printf("%d\n", dp[((N) * (N))][S]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s; while (cin >> n >> m >> s) { if (n == 0 && m == 0 && s == 0) break; int dp[2][2002][3002]; for (long long i = 0; i < (long long)(2); i++) for (long long j = 0; j < (long long)(2002); j++) for (long long k = 0; k < (long long)(3002); k++) dp[i][j][k] = 0; dp[0][0][0] = 1; for (int i = 1; i <= n * n; i++) { for (int j = 0; j <= m; j++) for (int k = 0; k <= s; k++) dp[i % 2][j][k] = 0; for (int j = 1; j <= m; j++) { for (int k = 1; k <= s; k++) { if (k - j >= 0) { dp[i % 2][j][k] += dp[i % 2][j - 1][k - 1] + dp[(i - 1) % 2][j - 1][k - j]; dp[i % 2][j][k] %= 100000; } } } } long long ans = 0; for (int i = 0; i <= m; i++) { ans += dp[(n * n) % 2][i][s]; ans %= 100000; } cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2001][3001]; int main() { while (1) { int n, m, s; scanf("%d%d%d", &n, &m, &s); if (n == 0) break; int t1 = 0, t2 = 1; n *= n; for (int i = 0; i < 2; i++) for (int j = 0; j < m + 1; j++) for (int k = 0; k < s + 1; k++) dp[i][j][k] = 0; for (int i = 0; i < m + 1; i++) dp[t1][i][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j < m + 1; j++) { for (int k = 0; k < s + 1; k++) { dp[t2][j][k] = 0; } } for (int j = 1; j <= m; j++) { for (int k = 0; k < s + 1; k++) { if (k - j >= 0) { dp[t2][j][k] += dp[t1][j - 1][k - j]; } dp[t2][j][k] += dp[t2][j - 1][k]; if (dp[t2][j][k] < 0) puts("AAAAAAA"); dp[t2][j][k] %= 100000; } } swap(t1, t2); } printf("%d\n", dp[t1][m][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-10; static const double PI = acos(-1.0); static const int mod = 1000000007; static const int INF = 1 << 29; static const long long LL_INF = 1ll << 60; static const int dx[] = {-1, 0, 1, 0, 1, -1, 1, -1}; static const int dy[] = {0, -1, 0, 1, 1, 1, -1, -1}; int n, m, s; int dp[50][2001][3001]; void input() { cin >> n >> m >> s; } int dfs(int now, int num, int many) { if (now == n * n) { return !many; } if (many < num * (n * n - now) || m == num) { return 0; } if (dp[now][num][many] >= 0) { return dp[now][num][many]; } int res = 0; for (int i = num + 1; i <= m; i++) { res += dfs(now + 1, i, many - i); res %= 100000; } return dp[now][num][many] = res; } void solve() { memset((dp), -1, sizeof(dp)); cout << dfs(0, 0, s) << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(0); input(); solve(); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int _dx[] = {0, 1, 0, -1}; const int _dy[] = {-1, 0, 1, 0}; int getInt() { int ret = 0, c; c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret *= 10; ret += c - '0'; c = getchar(); } return ret; } int n, m, second; int memo[2][2001][3001]; int dp, dp2; int main() { while (true) { n = getInt(); m = getInt(); second = getInt(); if (n + m + second == 0) break; n = n * n; dp = 0; dp2 = 1; for (int i = 0; i < (int)(n); i++) { swap(dp, dp2); if (i == 0) { for (int k = 0; k < (int)(m + 1); k++) for (int j = 0; j < (int)(second + 1); j++) memo[dp][k][j] = 0; for (int x = (1); x < (int)(m + 1); x++) { int xx = x * n; if (xx > second) break; memo[dp][x][xx] = 1; } } else { if (i % 5 == 4) { for (int x = (1); x < (int)(m + 1); x++) for (int y = (n - i); y < (int)(second + 1); y++) { memo[dp][x][y] = (memo[dp][x - 1][y - (n - i)] + memo[dp2][x - 1][y - (n - i)]) % 100000; } } else { for (int x = (1); x < (int)(m + 1); x++) for (int y = (n - i); y < (int)(second + 1); y++) { memo[dp][x][y] = (memo[dp][x - 1][y - (n - i)] + memo[dp2][x - 1][y - (n - i)]); } } } } int ans = 0; for (int i = 0; i < (int)(m + 1); i++) ans = (ans + memo[dp][i][second]) % 100000; printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mod = 100000; long long dp[50][3001]; long long N, M, S; int main() { scanf("%lld%lld%lld", &N, &M, &S); N *= N; dp[0][0] = 1; for (long long i = 1; i <= M; i++) { for (long long j = N; j >= 1; j--) { for (long long k = i; k <= S; k++) { dp[j][k] = (dp[j][k] + dp[j - 1][k - i]) % mod; } } } printf("%lld\n", dp[N][S]); }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2001][3001]; const int mod = 100000; int main() { int n, m, s; while (cin >> n >> m >> s, n) { n = n * n; for (int i = 0; i <= m; i++) { for (int j = 0; j <= s; j++) dp[0][i][j] = 0; } dp[0][0][0] = 1; for (int i = 0; i < n; i++) { int cur = i & 1, nxt = 1 - cur; for (int j = 0; j <= m; j++) { for (int k = 0; k <= s; k++) dp[nxt][j][k] = 0; } for (int j = 0; j <= m; j++) { for (int k = 0; k <= s; k++) { if (j < m) { (dp[cur][j + 1][k] += dp[cur][j][k]) %= mod; if (k + j + 1 <= s) (dp[nxt][j + 1][k + j + 1] += dp[cur][j][k]) %= mod; } } } } for (int i = 0; i < m; i++) (dp[n & 1][i + 1][s] += dp[n & 1][i][s]) %= mod; cout << dp[n & 1][m][s] << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.Arrays; import java.util.Scanner; public class Main { static final int mod = 100000; static int dp[][][]; static int n, m, s; public static int dp(int k, int v, int t) { if (0 <= dp[k][v][t]) { return dp[k][v][t]; } if (k == n * n - 1) { if (v == t) { return dp[k][v][t] = 1; } else { return dp[k][v][t] = 0; } } if (t < v) { return dp[k][v][t] = 0; } int sum = 0; for (int i = v + 1; i <= m; i++) { sum += dp(k + 1, i, t - v); sum %= mod; } return dp[k][v][t] = sum; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { n = sc.nextInt(); m = sc.nextInt(); s = sc.nextInt(); if ((n | m | s) == 0) { break; } dp = new int[n * n][m + 1][s + 1]; for (int i = 0; i < n * n; i++) { for (int j = 0; j < m + 1; j++) { Arrays.fill(dp[i][j], -1); } } int sum = 0; for (int i = 1; i <= m; i++) { sum += dp(0, i, s); sum %= mod; } System.out.println(sum); } } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const long long INF = 1LL << 61LL; static const double EPS = 1e-8; static const int mod = 100000; int N, M, S; int mem[50][2001][3001]; long long cal(int n, int mx, int sum) { long long res = 0; if (mem[n][mx][sum] != -1) return mem[n][mx][sum]; if (n == N * N) { if (sum == S) { return 1; } else return 0; } for (int i = mx + 1; i <= M; ++i) { if (sum + i > S) break; res += cal(n + 1, i, sum + i); } return mem[n][mx][sum] = res % mod; } int main() { while (1) { cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) break; memset(mem, -1, sizeof(mem)); cout << cal(0, 0, 0) << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 100000; int n, m, s; int dp[50][2010][3010]; int dfs(int i = 0, int pre = 0, int sum = 0) { if (i == n * n) return sum == s; if (pre > m) return 0; int &ret = dp[i][pre][sum]; if (ret != -1) return ret; int cnt = 0; for (int j = pre + 1; j <= m; j++) { if (sum + j > s) break; cnt += dfs(i + 1, j, sum + j); cnt %= mod; } return ret = cnt; } signed main() { while (cin >> n >> m >> s, n) { for (int i = 0; i < n * n; i++) { for (int j = 0; j < m; j++) { for (int k = 0; k < 3010; k++) { dp[i][j][k] = -1; } } } cout << dfs() << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[2010][50][3010]; int main() { cin >> N >> M >> S; dp[0][0][0] = 1; for (int i = 0; i <= M; i++) { for (int s = 0; s <= S; s++) { for (int k = 0; k < N * N; k++) { dp[i + 1][k][s] = (dp[i + 1][k][s] + dp[i][k][s]) % 100000; if (k + 1 <= N * N && s + i + 1 <= S) { dp[i + 1][k + 1][s + i + 1] = (dp[i + 1][k + 1][s + i + 1] + dp[i][k][s]) % 100000; } } } } int ans = 0; for (int i = 0; i <= M; i++) { ans = (ans + dp[i][N * N][S]) % 100000; } cout << ans << "\n"; return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2010][59][3010]; int main() { int N, M, S, n2; while (1) { cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) break; n2 = N * N; for (int k = 0; k <= M; k++) { for (int i = 0; i <= n2; i++) { for (int j = 0; j <= S; j++) { dp[k][i][j] = 0; } } } dp[0][0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = 0; j <= n2; j++) { for (int k = 0; k <= S; k++) { if (dp[i - 1][j][k] != 0) { if (k <= S - i && j != n2) { dp[i][j + 1][k + i] += dp[i - 1][j][k]; dp[i][j + 1][k + i] %= 100000; } dp[i][j][k] += dp[i - 1][j][k]; dp[i][j][k] %= 100000; } } } } cout << dp[M][n2][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; import java.math.*; import java.awt.geom.*; import java.io.*; public class Main { static int INF = 2 << 29; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { int n = sc.nextInt(); int m = sc.nextInt(); int s = sc.nextInt(); if(n == 0 && m == 0 && s == 0) break; int[][][] dp = new int[n*n+1][m + 1][s+1]; dp[0][0][0] = 1; for(int i = 0; i < dp.length-1; i++) { for(int j = 0; j < dp[i].length; j++) { for(int k = j; k < dp[i][j].length; k++) { if(dp[i][j][k] == 0) continue; for(int l = j+1; l < dp[i].length; l++) { if(k + l > s) break; dp[i+1][l][k + l] += dp[i][j][k]; dp[i+1][l][k + l] %= 100000; } } } } int sum = 0; for(int i = 0; i <= m; i++) { sum += dp[n*n][i][s]; sum %= 100000; } System.out.println(sum); } } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long dp[2][2000][3000]; signed main() { long long a, b, c; while (cin >> a >> b >> c, a || b || c) { a *= a; c -= a * (a + 1) / 2; b -= a; memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (long long d = 1; d <= a; d++) { memset(dp[d & 1], 0, sizeof(dp[d & 1])); for (long long e = 0; e <= b; e++) { for (long long f = 0; f <= c; f++) { dp[d & 1][e][f] = dp[(d + 1) & 1][e][f]; if (e >= 1 && f >= (a - d + 1)) { dp[d & 1][e][f] = (dp[d & 1][e][f] + dp[d & 1][e - 1][f - (a - d + 1)]) % 100000; } } } } long long sum = 0; for (long long i = 0; i <= b; i++) { sum += dp[a & 1][i][c] % 100000; } cout << sum << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
//y09-6 ビンゴ(2回目) #include <iostream> #include <fstream> #include <stdio.h> #include <math.h> #include <time.h> #include <string> #include <vector> #include <map> #include <list> #include <set> #include <stack> #include <queue> #include <cstdlib> #include <algorithm> #include <random> #include <cassert> using namespace std; #define LL long long #undef INT_MIN #undef INT_MAX #define INT_MIN -2147483648 #define INT_MAX 2147483647 #define LL_MIN -9223372036854775808 #define LL_MAX 9223372036854775807 #define segment_size 65536 #define ROOP() while (true) int main(){ ROOP(){ int N,M,S; cin >> N >> M >> S; if(N==0) return 0; int dp[50][3001]; for(int i=0; i<50; i++){ for(int j=0; j<3001; j++){ dp[i][j] = 0; } } dp[0][0] = 1; for(int i=1; i<=N*N; i++){ for(int j=i; j<=S; j++){ if(j>=i) dp[i][j] = dp[i-1][j-i] + dp[i][j-i]; if(j>m) dp[i][j] -= dp[i-1][j-M-1]; dp[i][j] %= 100000; } } cout << dp[N*N][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<iostream> #include<algorithm> #include<vector> #include<stack> #include<map> #include<set> #include<queue> #include<cstdio> #include<climits> #include<cmath> #include<cstring> #include<string> #include<sstream> #include<numeric> #include<cassert> #define f first #define s second #define mp make_pair #define REP(i,n) for(int i=0; i<(int)(n); i++) #define rep(i,s,n) for(int i=(s); i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define ALL(c) (c).begin(), (c).end() #define IN(x,s,g) ((x) >= (s) && (x) < (g)) #define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h))) #define print(x) printf("%d\n",x) using namespace std; typedef unsigned int uint; typedef long long ll; int getInt(){ int ret = 0,c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define MOD 100000 int n,m,s; uint memo[2001][3001]; uint prevs[2][3001]; uint *prev, *prev2; int main(){ while(true){ n = getInt(); m = getInt(); s = getInt(); if(n+m+s == 0) break; n = n * n; prev = prevs[0]; prev2 = prevs[1]; REP(i,n){ if(i == 0){ REP(k,m+1) REP(j,s+1) memo[k][j] = 0; rep(x,1,m+1){ int xx = x * n; if(xx > s) break; memo[x][xx] = 1; } }else{ memset(prev,0,sizeof(int)*s); if(i % 15 == 0){ rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*s); REP(y,s+1-n+i){ memo[x][y+(n-i)] = (memo[x-1][y] + prev[y]) % MOD; } uint *tmp = prev; prev = prev2; prev2 = tmp; } }else{ rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*s); REP(y,s+1-n+i){ memo[x][y+(n-i)] = (memo[x-1][y] + prev[y]); } uint *tmp = prev; prev = prev2; prev2 = tmp; } } } } int ans = 0; REP(i,m+1) ans = (ans + memo[i][s]) % MOD; print(ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s; scanf("%d%d%d", &n, &m, &s); n *= n; int** dp = new int*[n + 1]; for (int i = 0; i < int(n + 1); ++i) { dp[i] = new int[s + 1]; fill(dp[i], dp[i] + s + 1, 0); } dp[0][0] = 1; for (int i = 1; i < int(m + 1); ++i) { for (int j = n; j >= 0; --j) { for (int k = s; k >= 0; --k) { if (j && i <= k) { dp[j][k] = (dp[j][k] + dp[j - 1][k - i]) % 100000; } } } } printf("%d\n", dp[n][s]); for (int i = 0; i < int(n); ++i) delete dp[i]; delete dp; return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2001][3001]; const int mod = 100000; int main() { int n, m, s; cin >> n >> m >> s; n *= n; dp[0][0][0] = 1; for (int i = 0; i < n; i++) { int now = i & 1; int next = now ^ 1; for (int j = 0; j <= m; j++) for (int k = 0; k <= s; k++) dp[next][j][k] = 0; for (int j = 0; j <= m; j++) { for (int k = 0; k <= s; k++) { if (dp[now][j][k] == 0) continue; (dp[now][j + 1][k] += dp[now][j][k]) %= mod; if (k + j + 1 <= s) (dp[next][j + 1][k + j + 1] += dp[now][j][k]) %= mod; } } } int ans = 0; for (int i = 0; i <= m; i++) { ans += dp[n & 1][i][s]; ans %= mod; } cout << ans << endl; return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int dp[55][2005][3005]; int main() { int h, i, j, k, n, m, s, ans; while (1) { scanf("%d%d%d", &n, &m, &s); if (n + m + s == 0) break; memset(dp, 0, sizeof(dp)); ans = 0; n = n * n; for (i = 1; i <= m; i++) dp[0][i][i] = 1; for (i = 1; i < n; i++) { for (j = 1; j <= m; j++) { for (k = 1; k <= s; k++) { for (h = 1; h < j; h++) { dp[i][j][k] += dp[i - 1][h][k - j]; } dp[i][j][k] %= 100000; } } } for (j = 1; j <= m; j++) { ans += dp[n - 1][j][s]; ans = ans % 100000; } printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long hmod1 = 999999937; const long long hmod2 = 1000000000 + 9; const long long INF = 1 << 30; const long long mod = 1000000000 + 7; const int dx4[4] = {1, 0, -1, 0}; const int dy4[4] = {0, 1, 0, -1}; const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1}; const double pi = 3.141592653589793; int md = 100000; int n, m, s; int dp[2][2005][3005]; signed main() { cin.tie(0); ios::sync_with_stdio(false); while (true) { cin >> n >> m >> s; n = n * n; if (n == 0) break; memset(dp, 0, sizeof(dp)); int cur = 1, pre = 0; dp[pre][0][0] = 1; for (int i = 0; i < (n); i++) { memset(dp[cur], 0, sizeof(dp[cur])); for (int j = (i); j < (m + 1); j++) for (int k = (j); k < (min(j * (j + 1) / 2 + 1, s + 1)); k++) { ((dp[cur][j][k]) = ((dp[cur][j][k]) + ((dp[cur][j - 1][k - 1] + dp[pre][j - 1][k - j]) % md) % md) % md); } swap(cur, pre); } int ans = 0; for (int j = 0; j < (m + 1); j++) ((ans) = ((ans) + (dp[pre][j][s]) % md) % md); cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2048][64]; int N, M, S; int main(void) { while (scanf("%d%d%d", &N, &M, &S) && N != 0) { int flg = 0; for (int i = 0; i < 2048; i++) { for (int j = 0; j < 64; j++) { dp[0][i][j] = 0; dp[1][i][j] = 0; } } dp[0][0][0] = 1; for (int i = 1; i <= M; i++) { for (int j = 0; j <= S; j++) { for (int k = 0; k <= N * N; k++) { if (dp[flg][j][k] != 0) { if (i + j <= S) { dp[1 - flg][j + i][k + 1] += dp[flg][j][k]; dp[1 - flg][j + i][k + 1] %= 100000; } dp[1 - flg][j][k] += dp[flg][j][k]; dp[1 - flg][j][k] %= 100000; } } } for (int j = 0; j <= S; j++) { for (int k = 0; k <= N * N; k++) { dp[flg][j][k] = 0; } } flg = 1 - flg; } printf("%d\n", dp[flg][S][N * N]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int a[50][2001][3001]; int main() { return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
## constant MOD = 100000 MAX_M = 500 MAX_S = 1000 ### subroutines def counts(nn, m, s) if nn == 1 return (m >= s ? 1 : 0) end if m <= MAX_M && s <= MAX_S && ! $ccache[nn][m][s].nil? return $ccache[nn][m][s] end m0 = m - 1 s0 = s - nn c = 0 while m0 > 0 && s0 > 0 c = (c + counts(nn - 1, m0, s0)) % MOD m0 -= 1 s0 -= nn end if m < MAX_M && s < MAX_S $ccache[nn][m][s] = c end c end ### main loop do n, m, s = gets.strip.split(' ').map{|s| s.to_i} break if (n | m | s) == 0 nn = n * n m0 = [MAX_M, m].min s0 = [MAX_S, s].min $ccache = (nn + 1).times.map{(m0 + 1).times.map{[]}} puts counts(nn, m, s) end
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { while (true) { int N, M, S; cin >> N >> M >> S; if (N == 0) return 0; int dp[50][3001]; for (int i = 0; i < 50; i++) { for (int j = 0; j < 3001; j++) { dp[i][j] = 0; } } dp[0][0] = 1; for (int i = 1; i <= N * N; i++) { for (int j = i; j <= S; j++) { if (j >= i) dp[i][j] = dp[i - 1][j - i] + dp[i][j - i]; if (j > M) dp[i][j] -= dp[i - 1][j - M - 1]; dp[i][j] %= 100000; } } cout << dp[N * N][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.Scanner; //Bingo public class Main{ void run(){ Scanner sc = new Scanner(System.in); int MOD = 100000; int[][][] dp = new int[2][2001][3001]; for(;;){ int N = sc.nextInt(), M = sc.nextInt(), S = sc.nextInt(); if((N|M|S)==0)break; N*=N; for(int m=0;m<=M;m++)for(int s=0;s<=S;s++)dp[0][m][s] = 0; int X = 1; for(int x=1;x<=N;x++,X=1-X)for(int m=1;m<=M;m++)for(int s=1;s<=S;s++){ dp[X][m][s] = 0; if(x==1){ if(s<=m)dp[X][m][s]++; } else{ dp[X][m][s]+=dp[X][m-1][s]; if(s-m>=0)dp[X][m][s]+=dp[1-X][m-1][s-m]; } if(MOD<=dp[X][m][s])dp[X][m][s]%=MOD; } System.out.println(dp[1-X][M][S]); } } public static void main(String[] args) { new Main().run(); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[55][2010][3010] = {0}; int main() { int N, M, S; while (scanf("%d%d%d", &N, &M, &S), N + M + S) { for (int i = 1; i < N * N + 1; i++) { for (int j = 1; j < M + 1; j++) { for (int k = 1; k < S + 1; k++) { dp[i][j][k] = 0; if (i == 1) { dp[i][j][k] = dp[i][j - 1][k]; if (j == k) dp[i][j][k]++; } else { dp[i][j][k] = dp[i][j - 1][k]; if (k > j) dp[i][j][k] = (dp[i][j][k] + dp[i - 1][j - 1][k - j]) % 100000; } } } } printf("%d\n", dp[N * N][M][S]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { const int MOD = 100000; for (;;) { int n, m, s; cin >> n >> m >> s; if (n == 0) return 0; m = min(m, s); vector<vector<int> > num(n * n + 1, vector<int>(s + 1, 0)); num[0][0] = 1; for (int i = 1; i <= m; ++i) { for (int j = n * n; j > 0; --j) { for (int k = i; k <= s; ++k) { num[j][k] += num[j - 1][k - i]; if (num[j][k] >= MOD) num[j][k] -= MOD; } } } cout << num[n * n][s] << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; template <class T> using V = vector<T>; template <class T, class U> using P = pair<T, U>; const ll MOD = (ll)1e9 + 7; const ll MOD2 = 998244353; const ll HIGHINF = (ll)1e18; const ll LOWINF = (ll)1e15; const long double PI = 3.1415926535897932384626433; template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } } template <class T, class U> ostream &operator<<(ostream &o, const map<T, U> &obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; } template <class T> ostream &operator<<(ostream &o, const set<T> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, const multiset<T> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, const vector<T> &obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; } template <class T, class U> ostream &operator<<(ostream &o, const pair<T, U> &obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; } template <template <class tmp> class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; } void print(void) { cout << endl; } template <class Head> void print(Head &&head) { cout << head; print(); } template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) { cout << head << " "; print(forward<Tail>(tail)...); } template <class T> void chmax(T &a, const T b) { a = max<T>(a, b); } template <class T> void chmin(T &a, const T b) { a = min<T>(a, b); } void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; } void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; } void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; } int main() { while (1) { int N, M, S; cin >> N >> M >> S; if (N == 0 && M == 0 && S == 0) return 0; N = N * N; V<V<V<int>>> dp(2, V<V<int>>(N + 1, V<int>(S + 1, 0))); dp[0][0][0] = 1; for (int i = 0; i < M; ++i) { for (int j = 0; j < N + 1; ++j) { for (int k = 0; k < S + 1; ++k) { if (i + 1 <= M && j + 1 <= N && k + i + 1 <= S) (dp[(i + 1) % 2][j + 1][k + (i + 1)] += dp[i % 2][j][k]) %= 100000LL; if (i + 1 <= M) (dp[(i + 1) % 2][j][k] += dp[i % 2][j][k]) %= 100000LL; } } } cout << dp[M % 2][N][S] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[50][2001][3001]; int main() { int n, m, s; while (scanf("%d%d%d", &n, &m, &s), (n | m | s)) { memset(dp, 0, sizeof(dp)); for (int i = 1; i < m + 1; i++) { for (int j = 1; j < i + 1; j++) { dp[1][i][j] = 1; } } m++; s++; for (int i = 2; i < n * n + 1; i++) { for (int j = 1; j < m; j++) { for (int k = 1; k < s; k++) { dp[i][j][k] += dp[i][j - 1][k]; if (k >= j) { dp[i][j][k] += dp[i - 1][j - 1][k - j]; dp[i][j][k] %= 100000; } dp[i][j][k] %= 100000; } } } printf("%d\n", dp[n * n][m - 1][s - 1] % 100000); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int dp[55][3010]; int n, m, s; while (1) { fill((int*)dp, ((int*)dp + 3010), 0); cin >> n >> m >> s; if (n == 0 && m == 0 && s == 0) break; const int bin = n * n; dp[0][0] = 1; for (int k = 1; k <= m; k++) for (int i = bin; i > 0; i--) { for (int j = k; j <= s; j++) { dp[i][j] = (dp[i - 1][j - k] + dp[i][j]) % 100000; } } cout << dp[bin][s] << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int surplus = 100000; int N, ans; int b[2][2001][3001]; int main() { int n, m, s; while (cin >> n >> m >> s) { if (!n && !m && !s) return 0; ans = 0; N = n * n; for (int i = (1); i < (m + 1); i++) b[0][i][i] = 1; for (int i = (2); i < (N + 1); i++) { for (int j = (1); j < (m); j++) { for (int k = (1); k < (s); k++) { b[1][j + 1][k + 1] = b[1][j][k] + b[0][j][k - j]; b[1][j + 1][k + 1] %= surplus; if (i == N && k + 1 == s) { ans += b[1][j + 1][k + 1]; } } } for (int j = (1); j < (m); j++) { for (int k = (1); k < (s); k++) { b[0][j][k] = b[1][j][k]; if (i == N) b[0][j][k] = 0; } } } cout << ans % surplus << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<iostream> #include<algorithm> #include<vector> #include<stack> #include<map> #include<set> #include<queue> #include<cstdio> #include<climits> #include<cmath> #include<cstring> #include<string> #include<sstream> #include<numeric> #include<cassert> #define f first #define s second #define mp make_pair #define REP(i,n) for(int i=0; i<(int)(n); i++) #define rep(i,s,n) for(int i=(s); i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define ALL(c) (c).begin(), (c).end() #define IN(x,s,g) ((x) >= (s) && (x) < (g)) #define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h))) #define print(x) printf("%d\n",x) using namespace std; typedef unsigned int uint; typedef long long ll; int getInt(){ int ret = 0,c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define MOD 100000 int n,m,s; uint memo[2001][3001]; uint prevs[2][3001]; uint *prev, *prev2; int main(){ while(true){ n = getInt(); m = getInt(); s = getInt(); if(n+m+s == 0) break; n = n * n; prev = prevs[0]; prev2 = prevs[1]; REP(i,n){ if(i == 0){ REP(k,m+1) REP(j,s+1) memo[k][j] = 0; rep(x,1,m+1){ int xx = x * n; if(xx > s) break; memo[x][xx] = 1; } }else{ memset(prev,0,sizeof(int)*s); rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*(s+1-n+i)); REP(y,s+1-n+i) memo[x][y+(n-i)] = (memo[x-1][y] + prev[y]) % MOD; uint *tmp = prev; prev = prev2; prev2 = tmp; } } } int ans = 0; REP(i,m+1) ans = (ans + memo[i][s]) % MOD; print(ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s; static int dp[201][26][100]; cin >> n >> m >> s; n = n * n; m = min(m, s); memset(dp, 0, sizeof(dp)); for (int i = 0; i <= m; i++) dp[i][0][0] = 1; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= s; k++) { dp[i][j][k] = (dp[i - 1][j][k] + dp[i - 1][j - 1][k - i]) % 100000; } } } cout << dp[m][n][s] << endl; return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void) { int i, j, k; int n, m, s; for (i = 0; scanf("%d%d%d", &n, &m, &s), n; ++i) { if (i == 1) { if (n == 1) { for (;;) ; } if (n == 2) { exit(1); } if (n == 3) { char* hoge = new char[32768 * 1024 * 2]; char* fuga = new char[32768 * 1024 * 2]; char* piyo = new char[32768 * 1024 * 2]; } } } puts("a"); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}; const int kaijou[10] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; int main() { while (1) { int n, m, s; scanf("%d%d%d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) break; static int dp[2002][3002] = {}; for (int i = 0; i < 2002; i++) { for (int j = 0; j < 3002; j++) { if (j == 0) dp[i][j] = 1; else dp[i][j] = 0; } } int l = 0, r; for (int i = 1; i <= n * n; i++) { l += i; r = s; for (int j = i + 1; j <= n * n; j++) { r -= j; } for (int j = r; j >= l; j--) { for (int k = 1; k <= min(m, j); k++) { dp[k][j] = dp[k - 1][j - k]; if (dp[k][j] >= 100000) dp[k][j] %= 100000; } for (int k = min(m, j) + 1; k <= m; k++) { dp[k][j] = 0; } dp[0][j] = 0; } for (int j = l - i; j < l; j++) { for (int k = 1; k <= m; k++) { dp[k][j] = 0; } dp[0][j] = 0; } for (int j = l; j <= r; j++) { for (int k = 1; k <= m; k++) { dp[k][j] += dp[k - 1][j]; if (dp[k][j] >= 100000) dp[k][j] %= 100000; } } } printf("%d\n", dp[m][s]); } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void) { int i, j, k; int n, m, s; for (i = 0; scanf("%d%d%d", &n, &m, &s), n; ++i) { if (i == 1) { if (n == 7) { for (;;) ; } if (n == 5) { exit(1); } if (n == 6) { char* hoge = new char[32768 * 1024 * 2]; char* fuga = new char[32768 * 1024 * 2]; char* piyo = new char[32768 * 1024 * 2]; } } } puts("a"); return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int M = 100000; int dp[2005][3005][50]; int main() { int n, m, s; while (cin >> n >> m >> s, n) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int i = 0; i < (m + 1); i++) { for (int j = (i); j < (s + 1); j++) { for (int l = (1); l < (n * n + 1); l++) { int sum = 0; for (int k = 0; k < (i); k++) { sum += dp[k][j - i][l - 1]; sum %= M; } dp[i][j][l] = max(dp[i][j][l], sum); } } } int sum = 0; for (int i = 0; i < (m + 1); i++) { sum += dp[i][s][n * n]; sum %= M; } cout << sum << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int dp[55][2005][3005]; int main() { int h, i, j, k, n, m, s, ans; while (1) { scanf("%d%d%d", &n, &m, &s); if (n == 0) break; memset(dp, 0, sizeof(dp)); ans = 0; for (i = 1; i <= m; i++) dp[0][i][i] = 1; for (i = 1; i < n * n; i++) { for (j = 1; j <= m; j++) { for (k = 1; k <= s; k++) { if (dp[i - 1][j][k] > 0) { for (h = j + 1; h <= m && h + k <= s; h++) { dp[i][h][h + k] += dp[i - 1][j][k]; dp[i][h][h + k] = dp[i][h][h + k] % 100000; } } } } } for (j = 1; j <= m; j++) { ans += dp[n * n - 1][j][s]; ans = ans % 100000; } printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 1e5; int main() { ios::sync_with_stdio(false), cin.tie(0); int N, M, S; while (cin >> N >> M >> S, N | M | S) { N *= N; vector<vector<vector<int>>> dp( M + 1, vector<vector<int>>(S + 1, vector<int>(N + 1))); dp[0][0][0] = 1; for (int i = 1; i <= M; i++) { dp[i] = dp[i - 1]; for (int j = 0; j + i <= S; j++) { for (int k = 0; k < N; k++) { (dp[i][j + i][k + 1] += dp[i - 1][j][k]) %= mod; } } } printf("%d\n", dp[M][S][N]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int DP[50][2001][3001]; int main() { while (true) { int N, M, S; cin >> N >> M >> S; if (N == M && M == S && S == 0) break; for (int i = 1; i <= M; i++) { DP[1][i][i] = 1; } for (int i = 2; i <= N * N; i++) { for (int j = i - 1; j <= M; j++) { for (int k = 1; k <= S; k++) { for (int s = j + 1; s <= M; s++) { if (k - s >= 0) DP[i][s][k] = (DP[i][s][k] + DP[i - 1][j][k - s]) % 100000; } } } } int sum = 0; for (int i = 1; i <= M; i++) { sum = (sum + DP[N * N][i][S]) % 100000; } cout << sum << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<map> #include<vector> using namespace std; int N, M, S; int cnt; int DFS(int st, int pos, int num, int sum, int *p){ if( num == 1 ){ int subsum = 0; for(int i = 0; i < pos; i++){ subsum += p[i] + 1; } for(int i = st; i < M; i++){ if( subsum + i + 1 == sum ){ p[pos] = i; return 1; } } return 0; }else{ for(int i = st; i < M; i++){ p[pos] = i; if( DFS(i + 1, pos + 1, num - 1, sum, p) ){ return 1; } } } return 0; } void comb(int n, int k){ int *p; bool loop = false; bool minComb = false; p = new int[k]; for(int i = 0; i < k; i++){ int c = 1; int sum = 0; p[i] = i; for(int j = k - 1; j >= i + 1; j--){ p[j] = M - c++; } for(int j = 0; j < k; j++){ sum += p[j] + 1; } if( sum < S ){ minComb = true; break; } } if( !minComb ){ for(int i = 0; i < k; i++){ p[i] = i; } } do{ int sum = 0; int diff2cnt = 0; int diffMax = 0; loop = false; for(int i = 0; i < k; i++){ sum += p[i] + 1; } if( sum == S ){ cnt++; for(int i = 1; i < k; i++){ if(p[i] - p[i - 1] >= 2){ diff2cnt++; diffMax = max( diffMax , p[i] - p[i - 1] ); } } if( diff2cnt == 1 && diffMax == 2 ){ return ; } } for(int pk = k - 1; pk >= 0; pk--){ p[pk]++; if( p[pk] <= n - (k - pk) ){ int band = (k - 1) - pk; int subsum = 0; for(int i = 0; i <= pk; i++){ subsum += p[i] + 1; } if( band > 0 ){ int *newp = new int[k]; int left = S - subsum; if( DFS(p[pk]+1,0,band,left,newp) ){ int c = 0; for(int i = pk + 1; i < k; i++){ p[i] = newp[c]; c++; } }else{ p[pk + 1] = p[pk]; } if( p[pk + 1] <= p[pk] ){ p[pk + 1] = p[pk] + 1; for(int i = pk + 2; i < k; i++){ p[i] = p[i - 1] + 1; } } delete [] newp; } loop = true; break; } } }while(loop); delete[] p; } int main(void){ while( 1 ){ cin >> N >> M >> S; if( N == 0 && M == 0 && S == 0 ){ break; } cnt = 0; comb(M, N*N); cout << cnt << '\n'; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using PII = pair<int, int>; class Union_find { private: vector<int> par; vector<int> rank; int n; public: Union_find(int a) { n = a; for (int i = 0; i < n; i++) { par.push_back(i); rank.push_back(0); } } int find(int x) { if (par[x] == x) { return x; } else { return par[x] = find(par[x]); } } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (rank[x] < rank[y]) { par[x] = y; } else { par[y] = x; if (rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y) { return find(x) == find(y); } }; ll dp[2][2020][3030] = {}; int main(void) { int N, M, S; while (cin >> N >> M >> S && N && M && S) { memset(dp, 0, sizeof dp); for (int i = (1); i < (M + 1); i++) { dp[1][i][i] = 1; } for (int i = (2); i < (N * N + 1); i++) { memset(dp[i % 2], 0, sizeof dp[i % 2]); for (int j = (i); j < (M + 1); j++) { for (int k = ((i * (i + 1)) / 2); k < (S + 1); k++) { for (int s = 0; s < (min(k + 1, j)); s++) { if (k >= j) { dp[i % 2][j][k] += dp[(i + 1) % 2][s][k - j]; dp[i % 2][j][k] = dp[i % 2][j][k] % 100000; } } } } } ll res = 0; for (int i = 0; i < (M + 1); i++) { res += dp[(N * N) % 2][i][S]; res = res % 100000; } cout << res << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr int INF = 2000000000; constexpr int HINF = INF / 2; constexpr double DINF = 100000000000000000.0; constexpr long long LINF = 9223372036854775807; constexpr long long HLINF = 4500000000000000000; const double PI = acos(-1); int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; const int MOD = 100000; LL n, m, s; LL dp[50][4005]; int main() { while ((cin >> n >> m >> s) && (n || m || s)) { n *= n; dp[0][0] = 1; for (int i = 1; i <= m; i++) { for (LL j = n; j >= 1; j--) { for (int k = i; k <= s; k++) { (dp[j][k] += dp[j - 1][k - i]) %= MOD; } } } cout << dp[n][s] << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct edge { int u, v; long long w; }; int main() { for (;;) { int N, M, S; cin >> N >> M >> S; if (N == 0) break; vector<vector<int> > dp(M + 1, vector<int>(S + 1)); dp[0][0] = 1; for (int k = 0; k < N * N; k++) { vector<vector<int> > _dp(M + 1, vector<int>(S + 1)); for (int i = 0; i < M; i++) for (int j = 0; j < S; j++) if (j + i + 1 <= S) _dp[i + 1][j + i + 1] = (_dp[i + 1][j + i + 1] + dp[i][j]) % 100000; for (int i = 0; i < M; i++) for (int j = 0; j < S; j++) _dp[i + 1][j + 1] = (_dp[i + 1][j + 1] + _dp[i][j]) % 100000; dp = _dp; } int ans = 0; for (int i = 0; i <= M; i++) ans = (ans + dp[i][S]) % 100000; cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<iostream> #include<algorithm> #include<vector> #include<stack> #include<map> #include<set> #include<queue> #include<cstdio> #include<climits> #include<cmath> #include<cstring> #include<string> #include<sstream> #include<numeric> #include<cassert> #define f first #define s second #define mp make_pair #define REP(i,n) for(int i=0; i<(int)(n); i++) #define rep(i,s,n) for(int i=(s); i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) #define ALL(c) (c).begin(), (c).end() #define IN(x,s,g) ((x) >= (s) && (x) < (g)) #define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h))) #define print(x) printf("%d\n",x) using namespace std; typedef unsigned int uint; typedef long long ll; int getInt(){ int ret = 0,c; c = getchar(); while(!isdigit(c)) c = getchar(); while(isdigit(c)){ ret *= 10; ret += c - '0'; c = getchar(); } return ret; } #define MOD 100000 int n,m,s; uint memo[2001][3001]; uint prevs[2][3001]; uint *prev, *prev2; int main(){ while(true){ n = getInt(); m = getInt(); s = getInt(); if(n+m+s == 0) break; n = n * n; prev = prevs[0]; prev2 = prevs[1]; REP(i,n){ if(i == 0){ REP(k,m+1) REP(j,s+1) memo[k][j] = 0; rep(x,1,m+1){ int xx = x * n; if(xx > s) break; memo[x][xx] = 1; } }else{ memset(prev,0,sizeof(int)*s); if(i % 15 == 0){ rep(x,1,m+1){ memcpy(prev2,memo[x],sizeof(int)*s); rep(y,n-i,s+1){ memo[x][y] = (memo[x-1][y-(n-i)] + prev[y-(n-i)]) % MOD; } uint *tmp = prev; prev = prev2; prev2 = tmp; } }else{ rep(x,1,m+1){ uint *mm1 = &memo[x][n-i]; uint *mm2 = &memo[x-1][0]; uint *ppp = &prev[0]; memcpy(prev2,memo[x],sizeof(int)*s); REP(y,s+1-n+i) *mm1++ = *mm2++ + *ppp++; uint *tmp = prev; prev = prev2; prev2 = tmp; } } } } int ans = 0; REP(i,m+1) ans = (ans + memo[i][s]) % MOD; print(ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int M; char *done; int *memo; int num(int i, int N, int S) { if (done[i * 50 * 3001 + N * 3001 + S]) { return (memo[i * 50 * 3001 + N * 3001 + S]); } if (N == 0) { return (S == 0); } if (S < 0) { return (0); } if (i > M) { return (0); } done[i * 50 * 3001 + N * 3001 + S] = 1; memo[i * 50 * 3001 + N * 3001 + S] = num(i + 1, N - 1, S - i) + num(i + 1, N, S); return (memo[i * 50 * 3001 + N * 3001 + S] % 100000); } int main(void) { int N, S; done = (char *)malloc(2001 * 50 * 3001 + 50 * 3001 + 3001); memo = (int *)malloc(2001 * 50 * 3001 + 50 * 3001 + 3001); while (1) { scanf("%d %d %d", &N, &M, &S); if (!N && !M && !S) { break; } memset(done, 0, sizeof(*done)); printf("%d\n", num(1, N * N, S)); } free(memo); free(done); return (0); }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m, s; int dp[50][3001][2001]; int main() { while (1) { scanf("%d %d %d", &n, &m, &s); if (n == 0) break; memset(dp, 0, sizeof(dp)); for (int i = 1; i < m + 1; i++) { dp[1][i][i] = 1; } for (int i = 2; i < n * n + 1; i++) { for (int j = 3; j < s + 1; j++) { for (int k = 2; k < m + 1; k++) { if (j - k >= 1) { dp[i][j][k] += dp[i - 1][j - k][k - 1]; dp[i][j][k] %= 100000; } dp[i][j][k] += dp[i][j][k - 1]; dp[i][j][k] %= 100000; } } } printf("%lld\n", dp[n * n][s][m]); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, M, S; int dp[50][3001][2001]; const int MOD = 100000; int main() { while (cin >> N >> M, N * M) { cin >> S; for (int i = 1; i <= S; i++) { dp[1][i][i] = 1; } for (int i = 1; i < N * N; i++) { for (int j = 1; j <= S; j++) { for (int k = 1; k <= j; k++) { for (int l = k + 1; l <= M; l++) { if (j + l <= S) { dp[i + 1][j + l][l] += dp[i][j][k]; dp[i + 1][j + l][l] %= MOD; } } } } } int ans = 0; for (int i = 1; i <= M; i++) { ans += dp[N * N][S][i]; } cout << ans % MOD << endl; for (int i = 1; i <= N * N; i++) for (int j = 1; j <= S; j++) for (int k = 1; k <= M; i++) dp[i][j][k] = 0; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dp[2][2002][3002]; int main() { int n, m, s; while (cin >> n >> m >> s) { if (n == 0 && m == 0 && s == 0) break; for (long long i = 0; i < (long long)(2); i++) for (long long j = 0; j < (long long)(2002); j++) for (long long k = 0; k < (long long)(3002); k++) dp[i][j][k] = 0; dp[0][0][0] = 1; for (int i = 1; i <= n * n; i++) { for (int j = 0; j < 2001; j++) for (int k = 0; k < 3001; k++) dp[i % 2][j][k] = 0; for (int j = 1; j <= m; j++) { for (int k = 1; k <= s; k++) { if (k - j >= 0) { dp[i % 2][j][k] += dp[i % 2][j - 1][k - 1] + dp[(i - 1) % 2][j - 1][k - j]; dp[i % 2][j][k] %= 100000; } } } } int ans = 0; int num = (n * n) % 2; for (int i = 0; i <= m; i++) { cout << dp[num][i][s] << endl; ans %= 100000; } cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long hmod1 = 999999937; const long long hmod2 = 1000000000 + 9; const long long INF = 1 << 30; const long long mod = 1000000000 + 7; const int dx4[4] = {1, 0, -1, 0}; const int dy4[4] = {0, 1, 0, -1}; const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1}; const double pi = 3.141592653589793; int md = 100000; int n, m, s; int dp[2][2005][3005]; signed main() { cin.tie(0); ios::sync_with_stdio(false); while (true) { cin >> n >> m >> s; n = n * n; if (n == 0) break; memset(dp, 0, sizeof(dp)); int cur = 1, pre = 0; dp[pre][0][0] = 1; for (int i = 0; i < (n); i++) { memset(dp[cur], 0, sizeof(dp[cur])); for (int j = (1); j < (m + 1); j++) for (int k = (j); k < (min(j * (j + 1) / 2 + 1, s + 1)); k++) { ((dp[cur][j][k]) = ((dp[cur][j][k]) + ((dp[cur][j - 1][k - 1] + dp[pre][j - 1][k - j]) % md) % md) % md); } swap(cur, pre); } long long ans = 0; for (int j = 0; j < (m + 1); j++) ((ans) = ((ans) + (dp[pre][j][s]) % md) % md); cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 29; const long long MOD = 100000; struct edge { long long to, cost; edge(int t, long long c) : to(t), cost(c) {} }; int dxk[] = {1, 1, 1, 0, -1, 0}; int dxg[] = {0, 1, 0, -1, -1, -1}; int dy[] = {-1, 0, 1, 1, 0, -1}; int bitcount(int a) { int ret = 0; while (a != 0) { ret++; a = (a - 1) & a; } return ret; } int dp[2][2001][3001]; int main() { int n, m; while (cin >> n >> m && n) { int s; cin >> s; memset(dp, 0, sizeof(dp)); int now = 0; dp[now][0][0] = 1; for (int i = 0; i < n * n; i++) { for (int j = i; j <= m; j++) { for (int k = 1; j + k <= m; k++) { for (int l = i * (i - 1) / 2; l + j + k <= s; l++) { dp[!now][j + k][l + j + k] += dp[now][j][l] % MOD; } } } memset(dp[now], 0, sizeof(dp[now])); now = !now; } int ans = 0; for (int i = 0; i < (int)m + 1; ++i) ans = (ans + dp[now][i][s]) % MOD; cout << ans << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int mod = 100000; int N, M, S; int dp[2001][3001]; int dpsum[2001][3001]; int main() { while (true) { scanf("%d%d%d", &N, &M, &S); if (N == 0 && M == 0 && S == 0) break; dp[0][0] = 1; for (int i = 1; i <= N * N; i++) { for (int j = 0; j <= M; j++) { for (int k = i * (i - 1) / 2; k <= S; k++) { if (j != 0) { dpsum[j][k] = dpsum[j - 1][k] + dp[j][k]; if (dpsum[j][k] >= mod) dpsum[j][k] -= mod; } else { dpsum[j][k] = dp[j][k]; } } } for (int j = 0; j <= M; j++) { for (int k = j; k <= S; k++) { dp[j][k] = 0; } } for (int j = 0; j <= M; j++) { for (int k = 0; k <= S - j - 1; k++) { dp[j + 1][j + k + 1] = dpsum[j][k]; dpsum[j][k] = 0; } } } int ans = 0; for (int j = 1; j <= M; j++) { ans += dp[j][S]; ans %= mod; } printf("%d\n", ans); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long hmod1 = 999999937; const long long hmod2 = 1000000000 + 9; const long long INF = 1 << 30; const long long mod = 1000000000 + 7; const int dx4[4] = {1, 0, -1, 0}; const int dy4[4] = {0, 1, 0, -1}; const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1}; const double pi = 3.141592653589793; int md = 100000; int n, m, s; int dp[2][2005][3005]; signed main() { cin.tie(0); ios::sync_with_stdio(false); while (true) { cin >> n >> m >> s; n = n * n; if (n == 0) break; memset(dp, 0, sizeof(dp)); int cur = 1, pre = 0; dp[pre][0][0] = 1; for (int i = 0; i < (n); i++) { memset(dp[cur], 0, sizeof(dp[cur])); for (int j = (i); j < (m + 1 - (n - 1 - i)); j++) for (int k = (j); k < (min(j * (j + 1) / 2 + 1, s + 1)); k++) { ((dp[cur][j][k]) = ((dp[cur][j][k]) + ((dp[cur][j - 1][k - 1] + dp[pre][j - 1][k - j]) % md) % md) % md); } swap(cur, pre); } int ans = 0; for (int j = 0; j < (m + 1); j++) ((ans) = ((ans) + (dp[pre][j][s]) % md) % md); cout << ans << endl; } }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> typedef struct { unsigned n : 17; } Data; Data dp[51 * 3001]; int main(void) { int i, j, k; int n, m, s; while (scanf("%d%d%d", &n, &m, &s), n) { n *= n; dp[0].n = 1; for (i = 1; i < 3001 * 51; ++i) dp[i].n = 0; for (i = 1; i <= m; ++i) { for (j = n; j >= 0; --j) { for (k = s; k >= 0; --k) { if (j && i <= k) { dp[j * 3001 + k].n = (dp[j * 3001 + k].n + dp[(j - 1) * 3001 + k - i].n) % 100000; } } } } printf("%d\n", dp[n * 3001 + s].n); } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mod = 100000; int dp[2][3001][2001]; int (&cur)[3001][2001] = dp[0]; int (&prv)[3001][2001] = dp[1]; int main() { while (true) { int n, m, s; cin >> n >> m >> s; if (n == 0 and m == 0 and s == 0) break; memset(dp, 0, sizeof(dp)); cur[0][0] = 1; for (int i = 0; (i) < (n * n); ++(i)) { swap(cur, prv); for (int j = 0; (j) < (s + 1); ++(j)) { cur[j][0] = 0; for (int k = 0; (k) < (min(m, j)); ++(k)) { cur[j][k + 1] = (cur[j - 1][k] + prv[j - k - 1][k]) % mod; } } } long long ans = 0; for (int i = 0; (i) < (m + 1); ++(i)) ans += cur[s][i]; ans %= mod; cout << ans << endl; } return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using PII = pair<int, int>; int a[4][5000][5000]; int main(void) { return 0; }
p00460 Bingo
problem In one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions. * The Bingo card is divided into squares of N rows and N columns, and one positive integer is written in each square. All those integers are different. * The integer written in the square is 1 or more and M or less. * The sum of N × N integers written on the Bingo card is S. * When looking at any column, the integers are arranged in ascending order from top to bottom. * The integer in every square is larger than any integer in the column to the left of that square. The following is an example of a Bingo card when N = 5, M = 50, S = 685. <image> I want to make as many bingo cards as possible that meet the above conditions for the social gathering. However, you must not make more than one same card. Create a program that outputs the remainder of the maximum number of Bingo cards that can be created divided by 100000. input The input consists of multiple datasets. Each dataset is given in the following format. The input consists of one line, which contains the size of the bingo card N (1 ≤ N ≤ 7), the upper limit of the integers written in the square M (1 ≤ M ≤ 2000), and the bingo card. Three positive integers representing the sum of integers S (1 ≤ S ≤ 3000) are written separated by blanks. However, you can make one or more bingo cards that meet the conditions for any given input data. When N, M, S is 0, it indicates the end of input. The number of data sets does not exceed 5. output For each dataset, divide the maximum number of Bingo cards that can be created by 100000 and output the remainder on one line. Examples Input 3 9 45 3 100 50 5 50 685 0 0 0 Output 1 7 74501 Input None Output None
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> template <typename T> using V = std::vector<T>; template <typename T> using VV = std::vector<std::vector<T>>; template <typename T> using VVV = std::vector<std::vector<std::vector<T>>>; template <typename T> using VVVV = std::vector<std::vector<std::vector<std::vector<T>>>>; template <class T> inline T ceil(T a, T b) { return (a + b - 1) / b; } template <class T> inline void print(T x) { std::cout << x << std::endl; } template <class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) { if (i != 0) { std::cout << " "; } std::cout << v[i]; } std::cout << "\n"; } template <class T> inline bool inside(T y, T x, T H, T W) { return 0 <= y and y < H and 0 <= x and x < W; } template <class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } template <class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); } const int INF = 1L << 30; const double EPS = 1e-9; const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No"; const std::vector<int> dy4 = {0, 1, 0, -1}, dx4 = {1, 0, -1, 0}; const std::vector<int> dy8 = {0, -1, 0, 1, 1, -1, -1, 1}, dx8 = {1, 0, -1, 0, 1, 1, -1, -1}; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int MOD = 100000; while (true) { int N, M, S; cin >> N >> M >> S; if (N + M + S == 0) { break; } VVV<long long> dp(M + 2, VV<long long>(N * N + 2, V<long long>(S + 1, 0))); dp[0][0][0] = 1; for (int i = (0); i < ((int)M); ++i) { for (int j = (0); j < ((int)N * N + 1); ++j) { for (int k = (0); k < ((int)S + 1); ++k) { if (dp[i][j][k] != 0) { (dp[i + 1][j][k] += dp[i][j][k]) %= MOD; if (k + (i + 1) < dp[0][0].size()) { (dp[i + 1][j + 1][k + (i + 1)] += dp[i][j][k]) %= MOD; } } } } } print(dp[M][N * N][S]); } return 0; }