problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p00202
C++
Runtime Error
#include <iostream> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; bool prime[1000001]; int main() { int n, x; rep(i, 1000002) prime[i] = true; prime[0] = prime[1] = false; loop(i, 2, 1010) for (int j = i * 2; j < 1000001; j += i) prime[j] = false; whi...
#include <iostream> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; bool prime[1000001]; int main() { int n, x; rep(i, 1000002) prime[i] = true; prime[0] = prime[1] = false; loop(i, 2, 1010) for (int j = i * 2; j < 1000001; j += i) prime[j] = false; whi...
replace
17
18
17
18
0
p00202
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define COUNT(i, n) for ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define COUNT(i, n) for ...
replace
51
52
51
52
-6
malloc(): corrupted top size
p00202
C++
Memory Limit Exceeded
#include <cmath> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) bool is_prime(int n) { if (n % 2 == 0) return false; for (int i = 3; i <= std::sqrt(n); i += 2) if (n % i == 0) return false; return true; } int main() { int n, x; while (std::cin >> n >> x && n > 0 && x > 0) {...
#include <cmath> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) bool is_prime(int n) { if (n % 2 == 0) return false; for (int i = 3; i <= std::sqrt(n); i += 2) if (n % i == 0) return false; return true; } int main() { int n, x; while (std::cin >> n >> x && n > 0 && x > 0) {...
insert
37
37
37
38
MLE
p00202
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; bool isPrim...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; bool isPrim...
replace
45
46
45
47
0
p00202
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back bool isp(int n) { if (n == 2) return true; if (n == 1) return false; if ...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back bool isp(int n) { if (n == 2) return true; if (n == 1) return false; if ...
replace
44
46
44
46
0
p00202
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define shosu(n) setprecision(n) #define INF 999999999 using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<double> vd; typedef vector<char> vc; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define shosu(n) setprecision(n) #define INF 999999999 using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<double> vd; typedef vector<char> vc; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<...
replace
31
33
31
34
0
p00202
C++
Runtime Error
#include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, n) for (int i = 1; i <= n; i++) int sosu[1111111]; int dp[1211111]; int main() { sosu[0] = 1; sosu[1] = 1; for (int i = 2; ...
#include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, n) for (int i = 1; i <= n; i++) int sosu[1111111]; int dp[1211111]; int main() { sosu[0] = 1; sosu[1] = 1; for (int i = 2; ...
replace
45
46
45
50
0
p00202
C++
Runtime Error
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 30) using namespace std; const int kN = 1000005; void primeNumber(bool prime[kN]) { rep(i, kN) prim...
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 30) using namespace std; const int kN = 1000005; void primeNumber(bool prime[kN]) { rep(i, kN) prim...
insert
27
27
27
29
-6
*** stack smashing detected ***: terminated
p00202
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <vector> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define debug(x) cout << "debug ...
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <vector> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define debug(x) cout << "debug ...
replace
33
34
33
38
0
p00202
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> const int Max = 1000001; int dishes[31]; bool dish[Max]; bool isPrime[Max]; int main() { for (int i = 2; i < Max; i++) isPrime[i] = true; for (int i = 2; i < std::sqrt(Max); i++) { if (isPrime[i]) { for (int j = i * 2; j ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> const int Max = 1000001; int dishes[31]; bool dish[Max]; bool isPrime[Max]; int main() { for (int i = 2; i < Max; i++) isPrime[i] = true; for (int i = 2; i < std::sqrt(Max); i++) { if (isPrime[i]) { for (int j = i * 2; j ...
replace
36
37
36
38
0
p00202
C++
Memory Limit Exceeded
#include <iostream> #include <math.h> #define VMAX 1000000 #define KMAX 30 using namespace std; int K[KMAX]; int T[KMAX][VMAX]; void eratos(int n, bool prime[]) { for (int i = 0; i <= n; i++) prime[i] = false; for (int i = 3; i <= n; i += 2) prime[i] = true; prime[2] = true; int lim = (int)sqrt((dou...
#include <iostream> #include <math.h> #define VMAX 1000000 #define KMAX 30 using namespace std; int K[KMAX]; char T[KMAX][VMAX]; void eratos(int n, bool prime[]) { for (int i = 0; i <= n; i++) prime[i] = false; for (int i = 3; i <= n; i += 2) prime[i] = true; prime[2] = true; int lim = (int)sqrt((do...
replace
9
10
9
10
MLE
p00202
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, x; int v[30], dp[1000001]; bool sosu[1000001]; int main() { for (int i = 2; i < 1000000; i++) { if (!sosu[i]) { for (int j = 2; j * i <= 1000000; j++) { sosu[i * j] = 1; } } } while (1) { cin >> n >> x; if (n == 0 && x == 0) ...
#include <bits/stdc++.h> using namespace std; int n, x; int v[30], dp[1000001]; bool sosu[1000001]; int main() { for (int i = 2; i < 1000000; i++) { if (!sosu[i]) { for (int j = 2; j * i <= 1000000; j++) { sosu[i * j] = 1; } } } while (1) { cin >> n >> x; if (n == 0 && x == 0) ...
replace
24
25
24
25
0
p00202
C++
Runtime Error
#include <cstring> #include <iostream> #define MAX 1000000 using namespace std; int n, x, d[31]; bool p[MAX + 1], dp[MAX + 1]; void isPrime() { memset(p, 1, sizeof(p)); p[0] = p[1] = false; for (int i = 2; i * i <= MAX; i++) { for (int j = i + i; j <= MAX; j += i) p[j] = false; } } int main() { i...
#include <cstring> #include <iostream> #define MAX 1000000 using namespace std; int n, x, d[31]; bool p[MAX + 1], dp[MAX + 1]; void isPrime() { memset(p, 1, sizeof(p)); p[0] = p[1] = false; for (int i = 2; i * i <= MAX; i++) { for (int j = i + i; j <= MAX; j += i) p[j] = false; } } int main() { i...
replace
28
29
28
29
0
p00202
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string.h> #include <utility> #include <vector> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i, n) for (i = 0; i < n; i++) using namespace...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string.h> #include <utility> #include <vector> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i, n) for (i = 0; i < n; i++) using namespace...
replace
32
33
32
33
0
p00202
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string.h> #include <vector> #define pb push_back #define MAX 1000000 int dp[MAX]; using namespace std; int main(void) { int n, x; int i1, i2; while (1) { cin >> n >> x; if (n + x == 0) break; vector<int> v(n); memset(dp, 0, sizeof(dp))...
#include <algorithm> #include <iostream> #include <string.h> #include <vector> #define pb push_back #define MAX 1000000 int dp[MAX]; using namespace std; int main(void) { int n, x; int i1, i2; while (1) { cin >> n >> x; if (n + x == 0) break; vector<int> v(n); memset(dp, 0, sizeof(dp))...
replace
32
33
32
34
0
p00202
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
replace
84
85
84
85
TLE
p00202
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; bool dp[1000120]; bool notPrime[1000120]; int main() { notPrime[0] = notPrime[1] = true; for (int i = 2; i * i < 1000010; i++) { for (int j = 2 * i; j < 1000010; j += i) { notPrime[j] = true; } } int n, x; while (cin >> n >> x, n) { ...
#include <algorithm> #include <iostream> using namespace std; bool dp[1000120]; bool notPrime[1000120]; int main() { notPrime[0] = notPrime[1] = true; for (int i = 2; i * i < 1000010; i++) { for (int j = 2 * i; j < 1000010; j += i) { notPrime[j] = true; } } int n, x; while (cin >> n >> x, n) { ...
replace
19
20
19
20
0
p00202
C++
Runtime Error
#include <algorithm> #include <cstring> #include <iostream> constexpr int MAX_N = 31, MAX_C = 1000001; int n, max; int cost[MAX_N]; bool dp[MAX_C]; bool prime_num[MAX_C]; int main() { while (1) { std::cin >> n >> max; if (n + max == 0) break; std::memset(prime_num, false, sizeof(prime_num)); s...
#include <algorithm> #include <cstring> #include <iostream> constexpr int MAX_N = 31, MAX_C = 1000001; int n, max; int cost[MAX_N]; bool dp[MAX_C]; bool prime_num[MAX_C]; int main() { while (1) { std::cin >> n >> max; if (n + max == 0) break; std::memset(prime_num, false, sizeof(prime_num)); s...
replace
31
32
31
32
0
p00203
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int W, H, mas[16][16]; while (cin >> W >> H, W) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> mas[i][j]; } } vector<vector<int>> dp(H + 1, vector<int>(W, 0)); for (int i = 0; i < W; i++) { if...
#include <bits/stdc++.h> using namespace std; int main() { int W, H, mas[16][16]; while (cin >> W >> H, W) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> mas[i][j]; } } vector<vector<int>> dp(H + 1, vector<int>(W, 0)); for (int i = 0; i < W; i++) { if...
replace
32
33
32
33
0
p00203
C++
Time Limit Exceeded
#include <cstdio> int main() { while (true) { int X, Y; scanf("%d%d", &X, &Y); int field[16][17] = {{0}}; for (int y = 1; y <= Y; y++) { for (int x = 1; x <= X; x++) { scanf("%d", &(field[y][x])); } } int dp[16][17] = {{0}}; for (int x = 1; x <= X; x++) { if (fie...
#include <cstdio> int main() { while (true) { int X, Y; scanf("%d%d", &X, &Y); if (X == 0 || Y == 0) { break; } int field[16][17] = {{0}}; for (int y = 1; y <= Y; y++) { for (int x = 1; x <= X; x++) { scanf("%d", &(field[y][x])); } } int dp[16][17] = {{0}}; ...
insert
6
6
6
9
TLE
p00204
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define inf (1 << 29) #define EPS (1e-8) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdlib> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define inf (1 << 29) #define EPS (1e-8) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -...
replace
173
174
173
174
-6
107cc6a8-a1a2-4d92-9dcc-32961919b3e1.out: /home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00204/C++/s585032916.cpp:167: int main(): Assertion `abs(e) > abs(ufo[i].p)' failed.
p00205
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int a[5] = {0}; int guu = 0, tyoki = 0, paa = 0; int n = 1; int i = 0; while (n != 0) { for (i = 0; i < 5; i++) { scanf("%d", &a[i]); if (a[i] == 0) { break; } else if (a[i] == 1) { guu = 1; } else if (a[i] == 2) { tyoki ...
#include <stdio.h> int main(void) { int a[5] = {0}; int guu = 0, tyoki = 0, paa = 0; int n = 1; int i = 0; while (n != 0) { for (i = 0; i < 5; i++) { scanf("%d", &a[i]); if (a[i] == 0) { break; } else if (a[i] == 1) { guu = 1; } else if (a[i] == 2) { tyoki ...
insert
19
19
19
22
TLE
p00205
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { while (true) { int cur = 0, d[5]; rep(i, 5) cin >> d[i], d[i]--, cur |= (1 << d[i]); if (__builtin_popcount(cur) == 2) { rep(i, 5) cout << 2 - !!count(d, d + 5, (d[i] + 1) % 3) <<...
#include <algorithm> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { while (true) { int cur = 0, d[5]; rep(i, 5) { if (cin >> d[i]) d[i]--, cur |= (1 << d[i]); else return 0; } if (__builtin_popcount(cur) == 2) { rep...
replace
7
8
7
13
TLE
p00205
C++
Time Limit Exceeded
#include <iostream> int main() { while (1) { int s[6], g[4] = {0}, n = -2, v = 0, i; for (i = 5; i; i--) { std::cin >> s[i]; if (!*s) goto l; if (!g[s[i]]) { n++; g[s[i]] = 1; if (v - 1 == s[i] % 3 || !v) v = s[i]; } } for (i = 5; i; i-...
#include <iostream> int main() { while (1) { int s[6], g[4] = {0}, n = -2, v = 0, i; for (i = 5; i; i--) { std::cin >> s[i]; if (!s[5]) goto l; if (!g[s[i]]) { n++; g[s[i]] = 1; if (v - 1 == s[i] % 3 || !v) v = s[i]; } } for (i = 5; i; ...
replace
6
7
6
7
TLE
p00205
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; int main(void) { for (;;) { int a[5]; int b[5]; int r = 0, p = 0, s = 0; for (int i = 0; i < 5; i++) { cin >> a[i]; if (a[i] == 0) break; else if (a[i] == 1)...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; int main(void) { for (;;) { int a[5]; int b[5]; int r = 0, p = 0, s = 0; for (int i = 0; i < 5; i++) { cin >> a[i]; if (a[i] == 0) break; else if (a[i] == 1)...
insert
24
24
24
26
TLE
p00207
C++
Runtime Error
#include <iostream> using namespace std; int Board[102][102]; // Board[j, x, w][i, y, h] bool isOK; // 迷路がOKかNGか int xs, ys, xg, yg; // StartとGoalの座標 void DFS(int c, int x, int y) { if (Board[x][y] != c) { return; } else if (x == xg && y == yg) { isOK = true; // Goalなら迷路はOK return; } B...
#include <iostream> using namespace std; int Board[102][102]; // Board[j, x, w][i, y, h] bool isOK; // 迷路がOKかNGか int xs, ys, xg, yg; // StartとGoalの座標 void DFS(int c, int x, int y) { if (Board[x][y] != c) { return; } else if (x == xg && y == yg) { isOK = true; // Goalなら迷路はOK return; } B...
replace
33
34
33
34
-11
p00207
C++
Runtime Error
#include <iostream> #include <queue> #include <vector> using namespace std; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; class cordinate { public: int x; int y; }; int main() { while (1) { int w; int h; cin >> w >> h; if (w == 0 && h == 0) { break; } int xs; int ys;...
#include <iostream> #include <queue> #include <vector> using namespace std; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; class cordinate { public: int x; int y; }; int main() { while (1) { int w; int h; cin >> w >> h; if (w == 0 && h == 0) { break; } w = 110; h = 11...
insert
24
24
24
27
0
p00207
C++
Runtime Error
#include <iostream> using namespace std; char F[102][102]; bool MazeJudge; int xg, yg; char ItoC(int i) { if (i == 1) { return '1'; } else if (i == 2) { return '2'; } else if (i == 3) { return '3'; } else if (i == 4) { return '4'; } else if (i == 5) { return '5'; } } void DFS(int X, i...
#include <iostream> using namespace std; char F[102][102]; bool MazeJudge; int xg, yg; char ItoC(int i) { if (i == 1) { return '1'; } else if (i == 2) { return '2'; } else if (i == 3) { return '3'; } else if (i == 4) { return '4'; } else if (i == 5) { return '5'; } } void DFS(int X, i...
replace
40
47
40
45
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[102][102]; void DFS(int Y, int X, int A) { if (F[Y][X] != A) return; F[Y][X] = 7; DFS(Y - 1, X, A); DFS(Y, X + 1, A); DFS(Y + 1, X, A); DFS(Y, X - 1, A); } int main() { int w, h; int xs, ys; int xg, yg; int n; int c, d, x, y; while (true) ...
#include <iostream> using namespace std; int F[102][102]; void DFS(int Y, int X, int A) { if (F[Y][X] != A) return; F[Y][X] = 7; DFS(Y - 1, X, A); DFS(Y, X + 1, A); DFS(Y + 1, X, A); DFS(Y, X - 1, A); } int main() { int w, h; int xs, ys; int xg, yg; int n; int c, d, x, y; while (true) ...
replace
61
66
61
77
-11
p00207
C++
Time Limit Exceeded
#include <iostream> using namespace std; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; int w, h, xs, ys, xg, yg, n, cc; int field[100][100]; bool flag; void dfs(int x, int y, int c) { if (flag) return; if (x == xg && y == yg) { flag = true; return; } for (int i = 0; i < 4; i++) { int nx = x...
#include <iostream> using namespace std; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; int w, h, xs, ys, xg, yg, n, cc; int field[100][100]; bool flag; void dfs(int x, int y, int c) { if (flag) return; if (x == xg && y == yg) { flag = true; return; } for (int i = 0; i < 4; i++) { int nx = x...
delete
21
22
21
21
TLE
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[102][102]; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, xg, yg, n; while (1) { cin >> w >> h; if (w == ...
#include <iostream> using namespace std; int F[102][102]; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, xg, yg, n; while (1) { cin >> w >> h; if (w == ...
replace
24
27
24
27
-11
p00207
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, j, k) for (int i = j; i < k; i++) int w, h, xs, ys, xg, yg, n; int m[102][102]; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; bool DFS(int x, int y, int c) { if (m[x][y] != c) return false; if (x == xg && y == yg) return true; m[x][y] = ...
#include <bits/stdc++.h> using namespace std; #define rep(i, j, k) for (int i = j; i < k; i++) int w, h, xs, ys, xg, yg, n; int m[102][102]; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; bool DFS(int x, int y, int c) { if (m[x][y] != c) return false; if (x == xg && y == yg) return true; m[x][y] = ...
replace
38
39
38
42
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[102][102]; int xg, yg, w, h; void DFS(int Y, int X, int c) { // if(Y < 1 || X < 1) // return; if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; whi...
#include <iostream> using namespace std; int F[102][102]; int xg, yg, w, h; void DFS(int Y, int X, int c) { // if(Y < 1 || X < 1) // return; if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; whi...
replace
28
29
28
29
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c || Y > w || X > h) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >>...
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (Y < 1 || X < 1) return; if (F[Y][X] != c || Y > w || X > h) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int x...
insert
7
7
7
9
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >> w >> h; if (w...
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >> w >> h; if (w...
replace
24
26
24
26
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >> w >> h; if (w...
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >> w >> h; if (w...
replace
48
49
48
52
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -2000; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, n; while (1) { cin >> w >> h; if...
#include <iostream> using namespace std; int F[105][105]; int xg, yg; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -2000; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, n; while (1) { cin >> w >> h; if...
replace
35
36
35
36
-11
p00207
C++
Time Limit Exceeded
#include <iostream> using namespace std; int block[100][100]; int xs, ys, xg, yg, n, w, h; bool dfs(int x, int y, int c) { if (block[x][y] != c || block[x][y] == 0) return false; if (x == xg && y == yg) return true; bool b = false; block[x][y] = 0; if (x < w - 1) b |= dfs(x + 1, y, c); if (x >...
#include <iostream> using namespace std; int block[100][100]; int xs, ys, xg, yg, n, w, h; bool dfs(int x, int y, int c) { if (block[x][y] != c || block[x][y] == 0) return false; if (x == xg && y == yg) return true; bool b = false; block[x][y] = 0; if (x < w - 1) b |= dfs(x + 1, y, c); if (x >...
delete
21
22
21
21
TLE
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c || Y > w || X > h) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >>...
#include <iostream> using namespace std; int F[105][105]; int xg, yg, w, h; void DFS(int Y, int X, int c) { if (F[Y][X] != c || Y > w || X > h) { return; } F[Y][X] = -1; DFS(Y + 1, X, c); DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y, X - 1, c); } int main() { int xs, ys, n; while (1) { cin >>...
replace
26
27
26
27
-11
p00207
C++
Runtime Error
#include <algorithm> // require sort next_permutation count etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> #include <cstdio> // require printf #include <cstdlib> // require abs #include <cstring> // require memset #include <deque> #include <fstream> // requi...
#include <algorithm> // require sort next_permutation count etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> #include <cstdio> // require printf #include <cstdlib> // require abs #include <cstring> // require memset #include <deque> #include <fstream> // requi...
replace
25
27
25
27
0
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[105][105]; int xg, yg; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -2000; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, n; while (1) { cin >> w >> h; if...
#include <iostream> using namespace std; int F[105][105]; int xg, yg; void DFS(int Y, int X, int c) { if (F[Y][X] != c) { return; } F[Y][X] = -2000; DFS(Y - 1, X, c); DFS(Y, X + 1, c); DFS(Y + 1, X, c); DFS(Y, X - 1, c); } int main() { int w, h, xs, ys, n; while (1) { cin >> w >> h; if...
replace
38
39
38
39
-11
p00207
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int w, h; int gx, gy; int vx[] = {0, 1, 0, -1}; int vy[] = {1, 0, -1, 0}; int block[100][100]; bool check[100][100]; bool flag; void dfs(int y, int x) { /* for(int i = 0; i < h; ++i) { for(int j = 0; j < w; ++j) { if(i == y && j == x) cout << 'P'; el...
#include <bits/stdc++.h> using namespace std; int w, h; int gx, gy; int vx[] = {0, 1, 0, -1}; int vy[] = {1, 0, -1, 0}; int block[100][100]; bool check[100][100]; bool flag; void dfs(int y, int x) { /* for(int i = 0; i < h; ++i) { for(int j = 0; j < w; ++j) { if(i == y && j == x) cout << 'P'; el...
replace
43
44
43
44
TLE
p00207
C++
Runtime Error
#include <iostream> using namespace std; int F[102][102]; bool DFS(int X, int Y, int Xg, int Yg, int c) { if (F[Y][X] != c) { return false; } else if (F[Y][X] == c && X == Xg && Y == Yg) { return true; } F[Y][X] = -1; if (DFS(X, Y - 1, Xg, Yg, c)) { return true; } else if (DFS(X + 1, Y, Xg, Yg...
#include <iostream> using namespace std; int F[102][102]; bool DFS(int X, int Y, int Xg, int Yg, int c) { if (F[Y][X] != c) { return false; } else if (F[Y][X] == c && X == Xg && Y == Yg) { return true; } F[Y][X] = -1; if (DFS(X, Y - 1, Xg, Yg, c)) { return true; } else if (DFS(X + 1, Y, Xg, Yg...
replace
58
60
58
64
-11
p00207
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <queue> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define reg(i, a, b) for (int i = (a); i <= (b); i++) #define irep(i, n) for (int i = ((int)(n)) - 1; i >= 0; i--) #define...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <queue> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define reg(i, a, b) for (int i = (a); i <= (b); i++) #define irep(i, n) for (int i = ((int)(n)) - 1; i >= 0; i--) #define...
replace
64
65
64
65
-11
p00207
C++
Runtime Error
#include <iostream> using namespace std; #define MAX_H 100 #define MAX_W 100 #define INF 1000; int h, w; int field[MAX_H][MAX_W]; int dx[4] = {0, -1, 0, 1}, dy[4] = {-1, 0, 1, 0}; void dfs(int y, int x, const int sc) { if (y <= 0 || x <= 0 || y > h || x > w) return; if (field[y][x] == sc) { field[y][x] = 0;...
#include <iostream> using namespace std; #define MAX_H 100 #define MAX_W 100 #define INF 1000; int h, w; int field[MAX_H + 1][MAX_W + 1]; int dx[4] = {0, -1, 0, 1}, dy[4] = {-1, 0, 1, 0}; void dfs(int y, int x, const int sc) { if (y <= 0 || x <= 0 || y > h || x > w) return; if (field[y][x] == sc) { field[y]...
replace
6
7
6
7
0
p00207
C++
Runtime Error
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> int needleX[4] = {-1, 0, 1, 0}; int needleY[4] = {0, 1, 0, -1}; bool dfs(int start, int goal, int x, int y, int goalx, int goaly, st...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> int needleX[4] = {-1, 0, 1, 0}; int needleY[4] = {0, 1, 0, -1}; bool dfs(int start, int goal, int x, int y, int goalx, int goaly, st...
replace
98
99
98
99
0
p00207
C++
Time Limit Exceeded
#include <cstring> #include <iostream> using namespace std; int map[110][110]; int com[110][110]; int lx, ly, sx, sy, gx, gy; int py[4] = {1, 0, -1, 0}; int px[4] = {0, 1, 0, -1}; int fl; int mei(int zx, int zy, int cei[][110]) { int i; if (zx == gx && zy == gy) { fl = 1; return 0; } cei[zy][zx] = 1; ...
#include <cstring> #include <iostream> using namespace std; int map[110][110]; int com[110][110]; int lx, ly, sx, sy, gx, gy; int py[4] = {1, 0, -1, 0}; int px[4] = {0, 1, 0, -1}; int fl; int mei(int zx, int zy, int cei[][110]) { int i; if (zx == gx && zy == gy) { fl = 1; return 0; } cei[zy][zx] = 1; ...
delete
24
25
24
24
TLE
p00208
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { while (1) { int a, j = 0; cin >> a; j = a; string s = ""; int b = 0; for (b = 1; b * 8 <= a; b *= 8) { } for (int c = b; c != 1; c /= 8) { int o = a / c; switch (a / c) { case 0: case 1: case 2: ...
#include <iostream> using namespace std; int main() { while (1) { int a, j = 0; cin >> a; if (a == 0) break; j = a; string s = ""; int b = 0; for (b = 1; b * 8 <= a; b *= 8) { } for (int c = b; c != 1; c /= 8) { int o = a / c; switch (a / c) { case 0: ...
insert
7
7
7
9
TLE
p00208
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int x[8] = {0, 1, 2, 3, 5, 7, 8, 9}; int n, ok, k; int main() { while (true) { ok = 0; cin >> n; if (!n) { break; } for (int i = 10; i >= 0; i++) { k = (n / (int)pow(8, i)) % 8; if (k > 0) { ok = 1; } i...
#include <cmath> #include <iostream> using namespace std; int x[8] = {0, 1, 2, 3, 5, 7, 8, 9}; int n, ok, k; int main() { while (true) { ok = 0; cin >> n; if (!n) { break; } for (int i = 10; i >= 0; i--) { k = (n / (int)pow(8, i)) % 8; if (k > 0) { ok = 1; } i...
replace
12
13
12
13
TLE
p00208
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, num[100]; while (cin >> n, n) { int k = -1; do { num[++k] = n % 8; if (num[k] >= 5) num[k] += 2; else if (num[k] >= 4) ++num[k]; } while (n /= 8); for (int i = k; i >= 0; --i) cout << num[i]; c...
#include <iostream> using namespace std; int main() { int n, num[100]; while (cin >> n, n) { int k = -1; do { num[++k] = n % 8; if (num[k] >= 5) num[k] += 2; else if (num[k] >= 4) ++num[k]; } while (n /= 8); for (int i = k; i >= 0; --i) cout << num[i]; c...
replace
19
20
19
20
1
p00208
C++
Time Limit Exceeded
#include <stdio.h> int main() { int n, i, c; char s[16]; while (scanf("%d", &n)) { sprintf(s, "%o", n); for (i = 0; c = s[i]; i++) { c -= 48; printf("%d", c + c / 4 + c / 5); } printf("\n"); } }
#include <stdio.h> int main() { int n, i, c; char s[16]; while (scanf("%d", &n), n) { sprintf(s, "%o", n); for (i = 0; c = s[i]; i++) { c -= 48; printf("%d", c + c / 4 + c / 5); } printf("\n"); } }
replace
5
6
5
6
TLE
p00209
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define mp make_pair...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define mp make_pair...
replace
26
27
26
27
-11
p00209
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <iostream> #include <list> #include <set> #include <string> #include <unordered_map> #include <vector> #define P pair<int, int> using namespace std; int a, b; vector<P> V; unordered_map<int, unordered_map<int, int>> c; unordered_map<int, unordered_map<int, int>> f; unord...
#include <algorithm> #include <cstdio> #include <iostream> #include <list> #include <set> #include <string> #include <unordered_map> #include <vector> #define P pair<int, int> using namespace std; int a, b; vector<P> V; int c[100][100]; int f[50][50]; int g[50][50]; void kaiten() { int sum = 0; for (int i = 0; i <...
replace
13
16
13
16
TLE
p00209
C++
Runtime Error
#include <iostream> using namespace std; int n, m, a[111][111], b[55][55]; void rotate() { int z[55][55]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { z[i][j] = b[m - j - 1][i]; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { b[i][j] = z[i][j]; } } } ...
#include <iostream> using namespace std; int n, m, a[111][111], b[55][55]; void rotate() { int z[55][55]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { z[i][j] = b[m - j - 1][i]; } } for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { b[i][j] = z[i][j]; } } } ...
replace
10
12
10
12
0
p00211
C++
Time Limit Exceeded
// 26 #include <iostream> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int main() { for (int n; cin >> n, n;) { int d[10], v[10]; for (int i = 0; i < n; i++) { cin >> d[i] >> v[i]; } int m[9]; for (int i = 0; i < n - 1; i++) { for (l...
// 26 #include <iostream> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int main() { for (int n; cin >> n, n;) { int d[10], v[10]; for (int i = 0; i < n; i++) { cin >> d[i] >> v[i]; } int m[9]; for (int i = 0; i < n - 1; i++) { m[i] =...
replace
15
21
15
16
TLE
p00211
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (a == 0 || b == 0) return 0; while (a != b) { if (a > b) a ...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } ll lcm(ll a, ll b...
replace
12
22
12
16
TLE
p00212
C++
Memory Limit Exceeded
#include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; struct node { int cost; int c; int now; node(int C, int cc, int n) : cost(C), c(cc), now(n) {} bool operator>(const node &e) const { return cost > e.cost; } }; int main() { int c, n, m, s, d; for (; cin >> c ...
#include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; struct node { int cost; int c; int now; node(int C, int cc, int n) : cost(C), c(cc), now(n) {} bool operator>(const node &e) const { return cost > e.cost; } }; int main() { int c, n, m, s, d; for (; cin >> c ...
insert
38
38
38
40
MLE
p00212
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1 << 28 using namespace std; typedef pair<int, int> P; struct edge { int to; int cost; edge(int to, int cost)...
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1 << 28 using namespace std; typedef pair<int, int> P; struct edge { int to; int cost; edge(int to, int cost)...
replace
78
79
78
79
0
p00212
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespac...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespac...
replace
74
75
74
75
0
p00212
C++
Time Limit Exceeded
#include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; const int INF = 10000000; int city[101][101]; int solve(int s, int d, int c, int n) { int dist[11][101]; int history[101]; for (int i = 0; i < 11; i++) { for (int j = 1; j < 101; j++) { dist[i][j] = IN...
#include <functional> #include <iostream> #include <queue> #include <vector> using namespace std; const int INF = 10000000; int city[101][101]; int solve(int s, int d, int c, int n) { int dist[11][101]; int history[101]; for (int i = 0; i < 11; i++) { for (int j = 1; j < 101; j++) { dist[i][j] = IN...
replace
48
49
48
49
TLE
p00212
C++
Runtime Error
#include <iostream> #include <queue> #include <vector> using namespace std; struct state { int node; int ticket; int cost; state(int n, int t, int c) : node(n), ticket(t), cost(c) {} bool operator<(const state &s) const { return cost > s.cost; } }; int main() { int c, n, m, s, d; while (cin >> c >> n >>...
#include <iostream> #include <queue> #include <vector> using namespace std; struct state { int node; int ticket; int cost; state(int n, int t, int c) : node(n), ticket(t), cost(c) {} bool operator<(const state &s) const { return cost > s.cost; } }; int main() { int c, n, m, s, d; while (cin >> c >> n >>...
replace
30
31
30
31
0
p00212
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <queue> #define mp make_pair using namespace std; typedef pair<int, int> pii; const int inf = 1 << 29; int adj[100][100], memo[100][11]; bool visited[100][11]; int main() { for (int c, m, n, src, dst; scanf("%d%d%d%d%d", &c, &m, &n, &src, &dst), c;) { src--, ds...
#include <algorithm> #include <cstdio> #include <queue> #define mp make_pair using namespace std; typedef pair<int, int> pii; const int inf = 1 << 29; int adj[100][100], memo[100][11]; bool visited[100][11]; int main() { for (int c, n, m, src, dst; scanf("%d%d%d%d%d", &c, &n, &m, &src, &dst), c;) { src--, ds...
replace
15
16
15
16
0
p00212
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; #define INF 100000000 struct edge { int to, cost; }; int main() { int c, n, m, s, d; while (cin >> c >> n >> m >> s >> d) { if (c == 0 && n == 0 && m == 0 && s == 0 && d == 0) { break; } vector<edge> ff[101]; vector<vector<int>> ...
#include <iostream> #include <vector> using namespace std; #define INF 100000000 struct edge { int to, cost; }; int main() { int c, n, m, s, d; while (cin >> c >> n >> m >> s >> d) { if (c == 0 && n == 0 && m == 0 && s == 0 && d == 0) { break; } vector<edge> ff[101]; vector<vector<int>> ...
replace
59
70
59
68
TLE
p00212
C++
Runtime Error
#include <algorithm> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> const int MAX_V = 101; const int INF = 0x3f3f3f3f; //??? T???cap??????rev????????°???????????§?????£??????????????? struct Edge { int to; int cost; Edge(int to_, int cost_) : to(to...
#include <algorithm> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> const int MAX_V = 101; const int INF = 0x3f3f3f3f; //??? T???cap??????rev????????°???????????§?????£??????????????? struct Edge { int to; int cost; Edge(int to_, int cost_) : to(to...
replace
81
82
81
82
0
p00212
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <st...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <st...
replace
56
57
56
57
TLE
p00212
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define LO...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define LO...
replace
69
70
69
70
0
p00212
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define fi first #define se second template <typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } ret...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define fi first #define se second template <typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } ret...
replace
64
66
64
66
0
p00212
C++
Runtime Error
#include <cstdio> #include <iostream> #include <queue> #include <vector> #define reep(i, n, m) for (int i = (n); i < (m); i++) #define rep(i, n) reep(i, 0, n) using namespace std; class Edge { public: int to; int cost; Edge(int to, int cost) : to(to), cost(cost) {} }; class Node { public: int distance; in...
#include <cstdio> #include <iostream> #include <queue> #include <vector> #define reep(i, n, m) for (int i = (n); i < (m); i++) #define rep(i, n) reep(i, 0, n) using namespace std; class Edge { public: int to; int cost; Edge(int to, int cost) : to(to), cost(cost) {} }; class Node { public: int distance; in...
replace
61
62
61
62
-11
p00212
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repl(i, 0, n) #define mp(a, b) make_pair((a), (b)) #define pb(a) push_back((a)) #define all(x) (x).begin(), (x).end() #define uniq(x) sort(all(x)), (x).erase(unique(all(x)), end(x)) #define fi...
#include <bits/stdc++.h> using namespace std; #define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repl(i, 0, n) #define mp(a, b) make_pair((a), (b)) #define pb(a) push_back((a)) #define all(x) (x).begin(), (x).end() #define uniq(x) sort(all(x)), (x).erase(unique(all(x)), end(x)) #define fi...
replace
49
50
49
50
0
p00212
C++
Runtime Error
// AOJ 0212 #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cstdio> #include <functional> #include <queue> #include <vector> #define rep(i, a) for (int i = 0; i != (a); ++i) typedef std::pair<int, int> P; typedef std::pair<P, int> PP; const int INF = 1 << 30; int c, n, m, s, d; std::vector<P> G[100]; ...
// AOJ 0212 #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cstdio> #include <functional> #include <queue> #include <vector> #define rep(i, a) for (int i = 0; i != (a); ++i) typedef std::pair<int, int> P; typedef std::pair<P, int> PP; const int INF = 1 << 30; int c, n, m, s, d; std::vector<P> G[100]; ...
replace
53
54
53
54
0
p00213
C++
Time Limit Exceeded
#include <iostream> #include <vector> using vec = std::vector<int>; using Land = std::vector<std::vector<int>>; int W, H, N; Land s; std::vector<Land> res; bool check(int h, int w, int a, int b, int num) { if (h + a > H || w + b > W) { return false; } for (int i = h; i < h + a; i++) { for (int j = w; j...
#include <iostream> #include <vector> using vec = std::vector<int>; using Land = std::vector<std::vector<int>>; int W, H, N; Land s; std::vector<Land> res; bool check(int h, int w, int a, int b, int num) { if (h + a > H || w + b > W) { return false; } for (int i = h; i < h + a; i++) { for (int j = w; j...
insert
21
21
21
33
TLE
p00213
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typed...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typed...
replace
38
41
38
41
0
p00217
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <math.h> #include <sstream> #include <stdio.h> #include <string.h> #include <string> using namespace std; int main(void) { for (int u = 0; u < 50; u++) { long n; long id[51], a[51], b[51]; int p = -1; int q = 0; ...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <math.h> #include <sstream> #include <stdio.h> #include <string.h> #include <string> using namespace std; int main(void) { for (int u = 0; u < 50; u++) { long n; long id[10000], a[10000], b[10000]; int p = -1; int q...
replace
15
16
15
16
0
p00217
C++
Runtime Error
#include <iostream> using namespace std; struct k { int bangou; int score; }; int main() { int n; int d1, d2, b; k id[1000]; while (cin >> n, n) { for (int i = 0; i < n; i++) { cin >> b >> d1 >> d2; id[i].bangou = b; id[i].score = (d1 + d2); } int max = 0; int ans_b; fo...
#include <iostream> using namespace std; struct k { int bangou; int score; }; int main() { int n; int d1, d2, b; k id[10001]; while (cin >> n, n) { for (int i = 0; i < n; i++) { cin >> b >> d1 >> d2; id[i].bangou = b; id[i].score = (d1 + d2); } int max = 0; int ans_b; f...
replace
9
10
9
10
0
p00218
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { vector<vector<int>> p(10000, vector<int>(3)); vector<char> ans(10000); int n; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> p[i][0] >> p[i][1] >> p[i][2]; i...
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { vector<vector<int>> p(10000, vector<int>(3)); vector<char> ans(10000); int n; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> p[i][0] >> p[i][1] >> p[i][2]; i...
delete
30
32
30
30
0
p00218
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int number, pm, pe, pj, temp; while (1) { scanf("%d", &number); for (int i = number; i > 0; i--) { scanf("%d %d %d", &pm, &pe, &pj); if (pm == 100 || pe == 100 || pj == 100 || (pe + pm) / 2 >= 90 || (pe + pm + pj) / 3 >= 80) { printf("A\n");...
#include <stdio.h> int main(void) { int number, pm, pe, pj, temp; while (1) { scanf("%d", &number); if (number == 0) { break; } for (int i = number; i > 0; i--) { scanf("%d %d %d", &pm, &pe, &pj); if (pm == 100 || pe == 100 || pj == 100 || (pe + pm) / 2 >= 90 || (pe + pm...
insert
6
6
6
9
TLE
p00219
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n, t; while (cin >> n, n) { int c[10]; fill(c, c + 10, 0); for (int i = 0; i < n; i++) cin >> t, c[t]++; for (int i = 0; i < n; i++) { if (!c[i]) cout << '-'; else for (int j = 0; j < c[i]; j++) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, t; while (cin >> n, n) { int c[10]; fill(c, c + 10, 0); for (int i = 0; i < n; i++) cin >> t, c[t]++; for (int i = 0; i < 10; i++) { if (!c[i]) cout << '-'; else for (int j = 0; j < c[i]; j++) ...
replace
9
10
9
10
TLE
p00219
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> using namespace std; int main() { int n; int buy; int ice[10]; while (scanf("%d", &n), n != 0) { for (int i = 0; i < 10; i++) { ice[i] = 0; } for (int i = 0; i < n; i++) { scanf("%d", &buy); ice[buy]++; } for (int i = 0; i < n; i++)...
#include <cstdio> #include <iostream> using namespace std; int main() { int n; int buy; int ice[10]; while (scanf("%d", &n), n != 0) { for (int i = 0; i < 10; i++) { ice[i] = 0; } for (int i = 0; i < n; i++) { scanf("%d", &buy); ice[buy]++; } for (int i = 0; i < 10; i++...
replace
19
20
19
20
TLE
p00219
C++
Time Limit Exceeded
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" int m...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" int m...
insert
15
15
15
17
TLE
p00219
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define FOR(I, F, N) for (int I = F; I < (int...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define FOR(I, F, N) for (int I = F; I < (int...
replace
33
35
33
35
-6
*** stack smashing detected ***: terminated
p00219
C++
Time Limit Exceeded
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(void) { int a, n; while (1) { map<int, string> str; cin >> n; for (a = 0; a < n; a++) { int b; cin >> b; str[b].push_back('*'); } for (a = 0; a <= 9; a++) { if (str.size...
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(void) { int a, n; while (1) { map<int, string> str; cin >> n; if (n == 0) break; for (a = 0; a < n; a++) { int b; cin >> b; str[b].push_back('*'); } for (a = 0; a <=...
insert
12
12
12
14
TLE
p00219
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int n, a; cin >> n; int b[10] = {}; while (cin >> a) { b[a] += 1; } for (int i = 0; i < 10; i++) { if (b[i] > 0) { string s(b[i], '*'); cout << s << endl; } else { cout << '-' << endl; } } return ...
#include <iostream> #include <string> using namespace std; int main() { int n, a; while (cin >> n, n) { int b[10] = {}; for (int i = 0; i < n; i++) { cin >> a; b[a] += 1; } for (int i = 0; i < 10; i++) { if (b[i] > 0) { string s(b[i], '*'); cout << s << endl; ...
replace
7
18
7
20
0
p00220
C++
Runtime Error
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { char c; while (1) { string str; long long a, b; getline(cin, str); if (str[0] == '-') { break; } a = b = 0; int i = 0; while (str[i] != '.') { a *= 10; a += str[i] - '0'; ...
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { char c; while (1) { string str; long long a, b; getline(cin, str); if (str[0] == '-') { break; } a = b = 0; int i = 0; while (str[i] != '.' && i < str.size()) { a *= 10; a +=...
replace
16
17
16
17
0
p00221
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int M, N; while (cin >> M >> N, M != 0 && N != 0) { bool flag[1005] = {}; int jb = 0; int cnt = 1; int d = 0; bool lock = false; while (cnt <= N) { string S; cin >> S; while (!lock) { if (S == "FizzBuzz") ...
#include <bits/stdc++.h> using namespace std; int main() { int M, N; while (cin >> M >> N, M != 0 && N != 0) { bool flag[1005] = {}; int jb = 0; int cnt = 1; int d = 0; bool lock = false; while (cnt <= N) { string S; cin >> S; if (!lock) { if (S == "FizzBuzz") { ...
replace
15
16
15
16
TLE
p00221
C++
Runtime Error
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n, m, j, suu; while ((cin >> m >> n) && m != 0 || n != 0) { int check[101] = {0}; for (int i = 1; i <= m; i++) check[i] = i; j = 1; suu = m; for (int i = 1; i...
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n, m, j, suu; while ((cin >> m >> n) && m != 0 || n != 0) { int check[1001] = {0}; for (int i = 1; i <= m; i++) check[i] = i; j = 1; suu = m; for (int i = 1; ...
replace
9
10
9
10
0
p00221
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #defi...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #defi...
replace
56
57
56
58
0
p00221
C++
Runtime Error
#include <list> #include <stdio.h> #include <string.h> int main() { using namespace std; int i, n, m, ps; char opn[10], ans[10]; bool ff, bf; list<int> player; list<int>::iterator it; do { scanf("%d %d", &m, &n); if (!m && !n) break; for (i = 0; i < m; i++) player.push_back(i + 1)...
#include <list> #include <stdio.h> #include <string.h> int main() { using namespace std; int i, n, m, ps; char opn[20], ans[20]; bool ff, bf; list<int> player; list<int>::iterator it; do { scanf("%d %d", &m, &n); if (!m && !n) break; for (i = 0; i < m; i++) player.push_back(i + 1)...
replace
7
8
7
8
0
p00221
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; string to_s(int n) { string s; while (n) { s += n % 10 + '0'; n /= 10; } reverse(s.begin(), s.end()); return s; } string FizzBuzz(int n) { if (n % 3 == 0 && n % 5 == 0) return "FizzBuzz"; if (n % 3 == 0) retur...
#include <algorithm> #include <iostream> #include <string> using namespace std; string to_s(int n) { string s; while (n) { s += n % 10 + '0'; n /= 10; } reverse(s.begin(), s.end()); return s; } string FizzBuzz(int n) { if (n % 3 == 0 && n % 5 == 0) return "FizzBuzz"; if (n % 3 == 0) retur...
replace
35
36
35
36
0
p00222
C++
Time Limit Exceeded
#include <iostream> using namespace std; const int nmax = 10000000; char nums[nmax]; int main() { int n; for (int i = 2; i < nmax; i++) { nums[i] = '1'; } for (int i = 2; i * i < nmax; i++) { for (int k = 2; k * i < nmax; k++) { nums[i * k] = '0'; } } while (cin >> n) { if (n == 0) ...
#include <iostream> using namespace std; const int nmax = 10000000; char nums[nmax]; int main() { int n; for (int i = 2; i < nmax; i++) { nums[i] = '1'; } for (int i = 2; i * i < nmax; i++) { if (nums[i] == '1') { for (int k = 2; k * i < nmax; k++) { nums[i * k] = '0'; } } } ...
replace
12
14
12
16
TLE
p00222
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define dump(x) cerr << #x << " = " << (x) << endl #define rep(i, n) for (int i = 0; i < (n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back bool era[10...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define dump(x) cerr << #x << " = " << (x) << endl #define rep(i, n) for (int i = 0; i < (n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back bool era[10...
replace
20
25
20
22
TLE
p00222
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) const int N = 10010; bool isprime[N]; int makePrime() { REP(i, N) isprime[i] = true; isprime[0] = false; isprime[1] = false; for (int i = 2; (i * i) <= N; i++) { if (!isprime[i]) continue; f...
#include <iostream> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) const int N = 10000000; bool isprime[N]; int makePrime() { REP(i, N) isprime[i] = true; isprime[0] = false; isprime[1] = false; for (int i = 2; (i * i) <= N; i++) { if (!isprime[i]) continue; ...
replace
4
5
4
5
0
p00222
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int F[11451419]; #define EPS 1e-14 bool prime(int p) { if (F[p] == 0) return false; if (F[p] == 1) return true; for (int i = 2; i * i <= p; i++) { if (F[i] == 0) continue; if (p % i == 0) { F[p] = 0; return false; } } F[p] = ...
#include <bits/stdc++.h> using namespace std; int F[11451419]; #define EPS 1e-14 bool prime(int p) { if (F[p] == 0) return false; if (F[p] == 1) return true; for (int i = 2; i * i <= p; i++) { if (F[i] == 0) continue; if (p % i == 0) { F[p] = 0; return false; } } F[p] = ...
insert
38
38
38
42
TLE
p00222
C++
Memory Limit Exceeded
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long #define fi first #define se second using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; type...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repb(i, a, b) for (int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl // #define int long long #define fi first #define se second using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; t...
replace
5
6
5
6
MLE
p00222
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; inline bool isPrime(int n) { int sq = sqrt(n); for (int i = 3; i <= sq; i += 2) { if (n % i == 0) return false; } return true; } int main() { int n; while (cin >> n) { if (n == 0) break; int ans = -1; if (n % 10 == 9) n++; ...
#include "bits/stdc++.h" using namespace std; inline bool isPrime(int n) { int sq = sqrt(n); for (int i = 3; i <= sq; i += 2) { if (n % i == 0) return false; } return true; } int main() { int n; while (cin >> n) { if (n == 0) break; int ans = -1; if (n % 10 == 9) n++; ...
replace
27
36
27
31
TLE
p00222
C++
Time Limit Exceeded
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" long...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" long...
replace
28
29
28
29
TLE
p00222
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; const int SIZE = 10000000; bool isprime[SIZE + 1]; vector<int> prime; void make_prime() { for (int i = 2; i <= SIZE; i++) { isprime[i] = true; } isprime[0] = false; isprime[1] = false; for (int i = 2; i <= SIZE; i++) { if (isprime[i] == false)...
#include <iostream> #include <vector> using namespace std; const int SIZE = 10000000; bool isprime[SIZE + 1]; vector<int> prime; void make_prime() { for (int i = 2; i <= SIZE; i++) { isprime[i] = true; } isprime[0] = false; isprime[1] = false; for (int i = 2; i <= SIZE; i++) { if (isprime[i] == false)...
replace
34
35
34
35
0
p00222
C++
Memory Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; ll prime[10000001]; void Eratosthenes(int n) { rep(i, n) prime[i] = true; prime[1...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> #define REP(i, k, n) for (int i = k; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; bool prime[10000001]; void Eratosthenes(int n) { rep(i, n) prime[i] = true; prime...
replace
12
13
12
13
MLE
p00222
C++
Runtime Error
#include <iostream> using namespace std; const int MAX_N = 1000100; bool prime[MAX_N]; int num[MAX_N]; int main() { prime[0] = prime[1] = false; for (int i = 2; i < MAX_N; i++) { prime[i] = true; } for (int i = 2; i * i < MAX_N; i++) { if (prime[i]) { for (int j = i * i; j < MAX_N; j += i) ...
#include <iostream> using namespace std; const int MAX_N = 10001000; bool prime[MAX_N]; int num[MAX_N]; int main() { prime[0] = prime[1] = false; for (int i = 2; i < MAX_N; i++) { prime[i] = true; } for (int i = 2; i * i < MAX_N; i++) { if (prime[i]) { for (int j = i * i; j < MAX_N; j += i) ...
replace
4
5
4
5
0
p00222
C++
Runtime Error
#include <cstdio> #include <iostream> #include <string> #define N 10000001 using namespace std; int main() { int i, j, n, a[N]; for (i = 2; i < N; i++) a[i] = 1; for (i = 2; i * 2 <= N; i++) { if (a[i] == 1) { for (j = i * 2; j <= N; j += i) a[j] = 0; } } while (1) { cin >> n; ...
#include <cstdio> #include <iostream> #include <string> #define N 10000001 using namespace std; int main() { int i, j, n; bool a[N]; for (i = 2; i < N; i++) a[i] = 1; for (i = 2; i * 2 <= N; i++) { if (a[i] == 1) { for (j = i * 2; j <= N; j += i) a[j] = 0; } } while (1) { cin...
replace
7
8
7
9
-11
p00222
C++
Memory Limit Exceeded
#include <cstdio> int prmt[10000005] = {}; int rest[10000005] = {}; int main(void) { int n, i, j; prmt[0] = -1; prmt[1] = -1; for (i = 2; i <= 10000000; i++) { if (prmt[i] == -1) continue; prmt[i] = 1; j = i * 2; while (j <= 10000000) { prmt[j] = -1; j += i; } } j = ...
#include <cstdio> char prmt[10000005] = {}; int rest[10000005] = {}; int main(void) { int n, i, j; prmt[0] = -1; prmt[1] = -1; for (i = 2; i <= 10000000; i++) { if (prmt[i] == -1) continue; prmt[i] = 1; j = i * 2; while (j <= 10000000) { prmt[j] = -1; j += i; } } j =...
replace
2
3
2
3
MLE