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 posi...
{ "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() { dp[0][0] = 1; for (long long i = 1; i <= 2000; i++) { for (long long j = 49; j >= 1; j--) { for (long long k = i; k <= 3000; k++) { dp[j][k] = (dp[j][k] + dp[j - 1][k...
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 posi...
{ "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; vector<int> mem[50][2001]; int num(int n, int m, int s) { if (s < mem[n][m].size() && mem[n][m][s] != 0) { return mem[n][m][s] - 1; } if (n == 1) { if (s <= m) { return 1; } else { return 0; } } int ret = 0; for (int i = ...
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 posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
/** * _ _ __ _ _ _ _ _ _ _ * | | | | / / | | (_) | (_) | | (_) | | * | |__ __ _...
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 posi...
{ "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][2][3001]; int main() { while (1) { int i; int n, m, s; int square; int first_val; int sum = 0; scanf("%d %d %d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) { return 0; } square = n * n; first_val = square * (square + 1) / 2; for (...
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 posi...
{ "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][1001][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)...
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 posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
python3
def listrep(n,m,s): tab = [[[0]*(s+1) for j in range(n+1)] tab[0][0] = 1 for i in range(1,n+1): for k in range(s+1): if i <= k: tab[i][k] += tab[i][k-i] + tab[i-1][k-i] if j-1 >= m: tab[i][k] -= tab[i-1][j-1-m] return tab[n][m][s] while Tr...
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 posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <stdio.h> #include <string.h> int M; int done[2001][50][3001]; int memo[2001][50][3001]; int num(int i, int N, int S) { if (done[i][N][S]){ return (memo[i][N][S]); } if (N == 0){ return (S == 0); } if (S < 0){ return (0); } if (i > 2000){ return (0); } done[i][N][S] = 1; memo[i][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 posi...
{ "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, MAXM = 2010, MAXS = 3000 + 10; int n, m, s; int dp[MAXN * MAXN + 1][MAXM][MAXS]; int main() { while (cin >> n >> m >> s && n) { memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int i_n = 0; i_n < n * n + 1; i_n++) for (int i_m = 0; i_...
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 posi...
{ "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][4096][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 < 4096; i++) { for (int j = 0; j < 64; j++) { dp[0][i][j] = 0; dp[1][i][j] = 0; } } dp[0][0][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 posi...
{ "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> unsigned int dp[2][2001][3001]; int main() { while (1) { int i; int n, m, s; unsigned int sum; scanf("%d %d %d", &n, &m, &s); if (n == 0 && m == 0 && s == 0) return 0; for (i = 0; i < 2; i++) { int j; for (j = 1; j <= m; j++) { int k; for (k...
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 posi...
{ "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; int dp[50][3001]; signed main() { int n, m, s; while (cin >> n >> m >> s && n) { n = n * n; memset(dp, 0, sizeof(dp)); const int MOD = 100000; dp[0][0] = 1; for (int i = 1; i <= m; i++) { for (int j = n; j > 0; j++) { ...
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 posi...
{ "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; short 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...
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 posi...
{ "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 = 0; j <= M; j++) { for (int k = 0; k <= S; k++) { dp[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 posi...
{ "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 == 2) for (;;) ; else if (n == 4) 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 posi...
{ "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][2048][4096]; int N, M, S; int main() { scanf("%d%d%d", &N, &M, &S); dp[0][0][0] = 1; int cur = 0, tar = 1; for (int i = 0; i < N * N; i++) { cur = i & 1, tar = cur ^ 1; memset(dp[tar], 0, sizeof dp[tar]); for (int j = 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 posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
python3
def listrep(n,m,s): tab = [[[0]*(s+1) for i in range(m+1)] for j in range(n+1)] for i in range(m+1): tab[0][i][0] = 1 for i in range(1,n+1): for j in range(1,m+1): for k in range(1,s+1): tab[i][j][k] = tab[i][j-1][k] if j <= k: ...
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 posi...
{ "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 memo_func[50][3001][2001]; int N, M, S; void set_func(int masu, int sum, int max); void dbg_print(); int main() { int i, j, k; int ans; while (1) { scanf("%d %d %d\n", &N, &M, &S); if (!N && !M && !S) break; for (i = 0; i < N * N; i++) { for (j = 1; j <= M; j++) { ...
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 posi...
{ "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 a[2][1501][2940]; int main() { int n, m, s, h, i, j, k, z, p, t; for (; scanf("%d%d%d", &n, &m, &s), n *= n;) { m = min(m - n, s += n * ~n / 2); t = s / n; for (i = min(1500, s - t); i >= 0; i--) { a[0][i][i] = 1; } z = 0; for (i = 2; i...
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 posi...
{ "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 ...
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 posi...
{ "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; #define SUM 30010 #define DIV 100000 int table[49][SUM]={0}; int solve(int N,int M,int S){ for(int i=0;i<N;i++) for(int j=0;j<=S;j++)table[i][j]=0; for(int i=1;i<=M;i++){ for(int j=N-1;j>=0;j--){ for(int k=1;k<S;k++){ if ( table[j][k] == 0)continue; if ( k+i >S)break; ta...
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 posi...
{ "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) { if (n == 0) break; 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;...
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 posi...
{ "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; template <class T> void debug(T begin, T end) { for (T i = begin; i != end; ++i) cerr << *i << " "; cerr << endl; } inline bool valid(int x, int y, int W, int H) { return (x >= 0 && y >= 0 && x < W && y < H); } const int INF = 100000000; const double EPS = 1e-8; const...
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 posi...
{ "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, d, e; 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; ...
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 posi...
{ "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 = 1000 MAX_S = 2000 ### 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 - ...
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 posi...
{ "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...
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 posi...
{ "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(...
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 posi...
{ "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 == 4) { for (;;) ; } if (n == 5) { exit(1); } if (n == 6) { char* hoge = new char[3276...
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 posi...
{ "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...
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 posi...
{ "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 = m; i >= 0; i--) { for (int j = 0; j <= s; j++) { for (int k = n * n; k >= 0; k--) { i...
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 posi...
{ "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[59][3001]; int main(void) { while (1) { int num, max, sum; cin >> num >> max >> sum; if (num + max + sum == 0) return 0; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int m = 1; m <= max; ++m) { for (int n = num * num; n >= 1; --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 posi...
{ "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_...
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 posi...
{ "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 ...
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 posi...
{ "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> unsigned short dp[162617]; int main(void) { int i, j, k; int n, m, s; while (scanf("%d%d%d", &n, &m, &s), n) { n *= n; dp[0] = 0; dp[1] = 0x8000; for (i = 2; i < 162617; ++i) dp[i] = 0; for (i = 1; i <= m; ++i) { for (j = n; j >= 0; --j) { for (k = s; k >...
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 posi...
{ "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...
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 posi...
{ "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]; const int MOD = 100000; int main() { while (cin >> N >> M >> S, N * M) { dp[0][0] = 1; for (int m = 1; m <= M; m++) { for (int n = N * N; n > 0; n--) { for (int s = m; s <= S; s++) { dp[n][s] += dp[n - 1][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 posi...
{ "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 dp1[50][3001]; int dp2[50][3001]; int mod = 100000; int n, m, s; while (scanf("%d%d%d", &n, &m, &s)) { if (n == 0 && m == 0 && s == 0) break; memset(dp1, 0, sizeof(dp1)); dp1[0][0] = 1; for (int i = 1; i <= m; i++) { memset(d...
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 posi...
{ "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 int D = 100000; int dp[2][50][3000]; int n, m, s; void set() { int x, y, z; for (x = 0; x < 2; x++) { for (y = 0; y < 50; y++) { for (z = 0; z < 3000; z++) { dp[x][y][z] = 0; } } } dp[0][0][0] = 1; for (y = 1; y <= m; y++) { ...
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 posi...
{ "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...
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 posi...
{ "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, d, e, f, g; 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 ...
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 posi...
{ "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 ...
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 posi...
{ "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, ...
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 posi...
{ "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 main() { for (int n, m, sum; scanf("%d%d%d", &n, &m, &sum), n;) { n *= n; static int dp[2001][3001], next[2001][3001]; for (int d = 0; d < (m + 1); d++) dp[d][0] = 1; for (int i = 0; i < (n); i++) { for (int d = 1; d <= m; d...
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 posi...
{ "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; namespace std { template <> class hash<tuple<int, int, int>> { public: size_t operator()(const tuple<int, int, int>& x) const { return hash<int>()(get<0>(x)) ^ hash<int>()(get<1>(x)) ^ hash<int>()(get<2>(x)); } }; } // namespace std unordered_map<tuple<...
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 posi...
{ "input": [ "3 9 45\n3 100 50\n5 50 685\n0 0 0" ], "output": [ "1\n7\n74501" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { final int MOD = (int)1e5; int N,M,S; int[][][] dp; public int dfs(int n,int m,int s){ if(n == N * N){ if(s == S){ return 1; } return 0; } if(dp[n][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 posi...
{ "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 T[2001][3001]; int main() { while (scanf("%d %d %d", &N, &M, &S)) { if (N == 0 && M == 0 && S == 0) break; for (int j = 1; j <= M; j++) { for (int k = 1; k <= S; k++) { dp[0][j][k] = 0; } } int mm...
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 posi...
{ "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-9; static const double PI = acos(-1.0); int n, m, s; const int MOD = 100000; int dp[2][2010][3010]; int main() { while (scanf("%d %d %d", &n, &m, &s) > 0) { memset((dp), 0, sizeof(dp)); for (int i = (0); i <= (int)(m); i++) { dp[...
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 posi...
{ "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) { if (n == 0) break; 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...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #define per(i,n) peri(i,0,n) #define all(c) begin(c),end(c) #define mp mak...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cstring> #include <cctype> #include <algorithm> #include <string> #include <complex> #include <list> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <sstream...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cstring> #include <cctype> #include <algorithm> #include <string> #include <complex> #include <list> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <sstream...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <map> #include <set> #include <algorithm> using namespace std; struct edge{ int u, v, cost; edge(int u_, int v_, int cost_){ u = u_; v = v_; cost = cost_; } }; bool operator<(const edge &a, const edge &b){ return a.cost < b.cost; } // Union-Find struct union_find{...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #define INF 100000000 #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #inclu...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> #include<algorithm> #include<climits> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define IINF (INT_MAX) #define MAX 200 using namespace std; struct Data{ int from,to,cost,index; Data(int from=-1,int to=-1,int cost=-1,int index=-1):from(from),to(to),cos...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <cmath> #include <string> #include <cctype> #include <map> #include <iomanip> using namespace std; #define eps 1e-8 #define pi acos(-1.0) #define inf 1<<30 #d...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
//58 #include<iostream> #include<vector> #include<set> using namespace std; struct E{ int x,y,c; }; int n,m; int p[100]; int find(int x){ return p[x]==x?x:p[x]=find(p[x]); } void unite(int a,int b){ p[find(a)]=find(b); } int ds(vector<E> v){ for(int i=0;i<n;i++){ p[i]=i; } for(int i=0;i<v.size();i...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cstring> #include <cctype> #include <algorithm> #include <string> #include <complex> #include <list> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <sstream...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define MAX 110 #define INF INT_MAX typedef pair<int, int> pii; struct Edge { int from, to, cost; Edge(int from, int to, int cost) : from(from), to(to), cost(cost) {} }; int N, M; vector<Edge> G[MAX], cycle; int color[MAX]; void dfs(int v, vector<Ed...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <sstream> #include <string> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cassert> using namespace std; #define FOR(i,k,n) for(int i=(k); i<(int)(n);...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <set> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <algorithm> using namespace std; #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) typedef long long LL; #define ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <queue> #include <vector> #include <algorithm> #include <complex> #include <cmath> #include <cstdio> using namespace std; #define RESIDUE(s,t) (capacity[s][t]-flow[s][t]) #define INF (1ll<<60) #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #define INF 100000000 #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #inclu...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <vector> #include <numeric> #include <algorithm> class unionfind { private: int size_; std::vector<int> parent; std::vector<int> rank; public: unionfind() : size_(0), parent(std::vector<int>()), rank(std::vector<int>()) {}; unionfind(int size__) : size_(size__), parent(std::vector<int>(size_)), rank(std:...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pf push_front #define mp make_pair #define fr first #define sc second #define Rep(i, n) for ( int i = 0 ; i < (n); i++ ) #define All(v) v.begin(), v.end() typedef pair<int, int> Pii; typedef pair<int, Pii> Pip; const int...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <string> #include <queue> using namespace std; #define SZ(v) ((int)(v).size()) const int maxint = -1u>>1; const int maxn = 100 + 30; typedef long long ll; int n, m; ll adj[maxn][maxn...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> #include<cassert> #include<queue> using namespace std; #define rep(i, n) for (int i = 0 ; i < int(n); ++i) int main() { while (true) { long long n, m; cin >> n >> m; if (n == 0 && m == 0) break; assert(n >= m); long long sum = 0, mn = 1234567890123456789LL, m...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <set> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <iterator> #include <b...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cassert> #include <cstring> #include <vector> #include <valarray> #include <array> #include <queue> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <algorithm> #include <cmath> #include <complex> #include <random> using namespace ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cmath> #include<cstdio> #include<vector> #include<algorithm> #include<cassert> #include<climits> #include<map> #include<set> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define IINF (INT_MAX) #define MAX 200 using namespace std; struct Data{ int from,to,cost,inde...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <string> #include <cmath> #include <cstdio> #include <cstring> #include <cstdlib> #include <ctime> #include <queue> #include <stack> #include <list> #include <algorithm> using namespace std; #define typec long long #define V 111 typec g[V][V], w[V]; typec a[V], v[V], na[V]; typec Stoer_W...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; using Int = long long; struct SCC{ int n; vector<vector<int> > G,rG,T,C; vector<int> vs,used,belong; SCC(){}; SCC(int sz):n(sz),G(sz),rG(sz),used(sz),belong(sz){} void add_edge(int from,int to){ G[from].push_back(to); rG[to].push_back(from); } voi...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <cfloat> #include <ctime> #include <cassert> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<algorithm> #include<vector> #include<queue> using namespace std; const int D_MAX_V=210; const int D_v_size=210; struct D_wolf{ int t,r; long long c; D_wolf(){t=c=r=0;} D_wolf(int t1,long long c1,int r1){ t=t1;c=c1;r=r1; } }; vector<D_wolf>D_G[D_MAX_V]; int D_level[D_MAX_V]; int D_iter[...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int inf = 0x3f3f3f3f ; const int maxw = 1000 ; int g[105][105] , w[105] ; int a[105] , v[105] , na[105] ; int n , m ; int mincut( int n ) { int i , j, pv , zj ; int best = inf ; for( i = 0 ; i < n; i ++ ) { v[i] = i ; } whil...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int N, M, E; static int[] from; static long[] cost; static boolean disjoint() { UnionFind uf = new UnionFind(N); for (int i = 0; i < N; ++i) { if (from[i] != -1) uf.union(i, from[i]);...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
python3
# AOJ 1065 The House of Huge Family # Python3 2018.7.10 bal4u # UNION-FIND library class UnionSet: def __init__(self, nmax): self.size = [1]*nmax self.id = [i for i in range(nmax+1)] def root(self, i): while i != self.id[i]: self.id[i] = self.id[self.id[i]] i = self.id[i] return i def connected(self, ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<algorithm> #include<vector> struct S{int f,t,c;}s; int C(S l,S r){return l.c>r.c;} int u[100],r[100]; int F(int x) { return (u[x]-x?u[x]=F(u[x]):x); } void U(int x,int y) { x=F(x),y=F(y); if(r[x]>r[y])u[y]=x; else if(r[x]<r[y])u[x]=y; else u[x]=y,++r[y]; } int main() { int n,m,i,a; whi...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<queue> #include<cstdio> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; const int INF=1<<29; template<class T> struct AdjMatrix:public vector< vector<T> >{ AdjMatrix(int n,const vector<T> &v=vector<T>()):vector< vector<T> >(n,v){} }; template<class T> T augment(const AdjMatrix<T> &capa,int s...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; //The House of Huge Family public class Main{ class E{ int s, t, c, id; public E(int s, int t, int c, int id) { this.s = s; this.t = t; this.c = c; this.id = id; } } int n, m; List<E>[] adj; boolean isCon(int f1, i...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; //The House of Huge Family public class Main{ class E{ int s, t, c, id; public E(int s, int t, int c, int id) { this.s = s; this.t = t; this.c = c; this.id = id; } } int n, m; List<E>[] adj; boolean isCon(int f1, i...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #define INF 100000000 #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #inclu...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
// I'm the Topcoder //C #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #include <time.h> //C++ #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <cctype> #include <stack> #include <string> #include ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <string.h> #define MaxN 110 const int oo = 0x7fffffff; int g[MaxN][MaxN], d[MaxN]; bool used[MaxN], vst[MaxN]; int main() { int min, n, m, max, tmp, pre, cur, a, b, w, cnt; while (scanf("%d%d", &n, &m), n) { min = oo, cnt = 0; memset(g, 0, sizeof(g)); memse...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cstring> #include <cctype> #include <algorithm> #include <string> #include <complex> #include <list> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <sstream...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; //The House of Huge Family public class Main{ class E{ int s, t, id; long c; public E(int s, int t, long c, int id) { this.s = s; this.t = t; this.c = c; this.id = id; } } int n, m; List<E>[] adj; boolean isCon(i...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #define INF 100000000 #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #inclu...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> #include <time.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #define INF 100000000 #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #inclu...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<string.h> long m,n,a,b,c; long val[105]; long v[105][105]; int getans(){ int ans,i,j,k,r,s1,s2; long a[105]; long mark[105]; long w[105]; memset(w,0,sizeof(w)); if (n==2){ return val[0]; } a[0]=0; for (i=0;i<n;i++) mark[i]=1; ans=val[a[0]]; for (i=1;i<=n-1;i++){ r=0; m...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cstring> #include <cctype> #include <algorithm> #include <string> #include <complex> #include <list> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <sstream...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define N 105 using namespace std; struct edge{ int to, num; }; int n, m; vector<edge> G[N]; int A, B, minuscost; int used[N], cost[N]; int dfs(int x){ if(used[x]) return 0; used[x]=1; int res=0; for(int i=0;i<G[x].size();i++){ if(A==G[x][i].num) continue; if(B==G[...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; using Int = long long; struct Fordfulerson{ const int INF = 1<<28; struct edge{ int to,cap,rev; edge(){}; edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}; }; int n; vector<vector<edge> > G; vector<int> used; Fordfulerson(){}; Fordfulerso...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstdio> #include<cmath> #include<climits> #include<ctime> #include<cstdlib> #include<vector> #include<algorithm> #include<cassert> using namespace std; #define REP(i,b,n) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define mp make_pair #define ALL(C) (C).begin(),(...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int v, e, f[100]; vector<int> G[100]; void dfs(int n, int a) { f[n] = a; for (int i = 0; i < (int)G[n].size(); i++) if (!f[G[n][i]]) dfs(G[n][i], a); } int main() { for (; cin >> v >> e && v;) { int r = 1e9, ch = 0; fill(f, f + 100, 0); for (int i = 0;...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long g[111][111], w[111]; long long a[111], v[111], na[111]; long long Stoer_Wagner(int n) { long long i, j, pv, zj, I = 1; long long best = I << 32; for (i = 0; i < n; i++) v[i] = i; while (n > 1) { for (a[v[0]] = 1, i = 1; i < n; i++) { a[v[i]] = 0;...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { while (true) { long long n, m; cin >> n >> m; if (n == 0 && m == 0) break; assert(n >= m); long long sum = 0; vector<pair<long long, long long> > edge[n]; for (int i = 0; i < int(m); ++i) { long long x, y, c; cin >> x >...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int x[100], y[100], c[100]; int r[100], tmp1, tmp2; int cost, total; int i, j; while (1) { cin >> n >> m; if (!n && !m) break; total = 0; for (i = 0; i < m; i++) { cin >> x[i] >> y[i] >> c[i]; total += c[i]; ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) { v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t) { stringstream ss; ss << f; ss >> t; } static const int INF = 1 << 24; template <class ...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int inf; using namespace std; struct edge { int u, v, next, f, pre; } e[100000]; int num, rnum; int n, m, N; int source, sink; int head[132], rhead[132], start[132]; int d[132], numb[132]; int p[132]; void Init() { memset(head, -1, sizeof(head)); memset(rhead, -1, sizeof(rhead)); memset...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> inline bool minimize(T1& a, T2 b) { return b < a && (a = b, 1); } template <class T1, class T2> inline bool maximize(T1& a, T2 b) { return a < b && (a = b, 1); } int const inf = 1 << 29; struct unicycle_graph { int N; using graph_edge_t...
p00650 The House of Huge Family
Mr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future. Mr. Dango's family, the huge family, is getting their new house. Scale of the house is as large as...
{ "input": [ "3 2\n0 1 2\n1 2 1\n2 1\n0 1 100\n2 1\n0 1 0\n2 1\n0 1 -1\n0 0" ], "output": [ "1\n100\n0\n-1" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include<vector> #include<iostream> #include<algorithm> #include<map> #include<set> #include<queue> #include<string> #include<cctype> #include<cassert> #include<cmath> #include<climits> #define all(c) (c).begin(),(c).end() using namespace std; typedef unsigned int uint; typedef long long ll; struct edge{ll to,cap,...