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
p00056
C++
Time Limit Exceeded
#include <algorithm> #include <deque> #include <iostream> #include <stdio.h> using namespace std; void MakePrimeArray(deque<bool> &A, int n) { A[0] = A[1] = false; for (int i = 2; i < n; i++) { A[i] = true; } for (int i = 2; i * i < n; i++) { if (A[i]) { for (int j = i * i; j < n; j += i) { ...
#include <algorithm> #include <deque> #include <iostream> #include <stdio.h> using namespace std; void MakePrimeArray(deque<bool> &A, int n) { A[0] = A[1] = false; for (int i = 2; i < n; i++) { A[i] = true; } for (int i = 2; i * i < n; i++) { if (A[i]) { for (int j = i * i; j < n; j += i) { ...
replace
72
73
72
73
TLE
p00056
C++
Time Limit Exceeded
#include <iostream> #define STA 50000 using namespace std; int prime[50001]; int main() { int n; int cnt; for (int i = 2; i <= STA / 2; i++) { for (int j = 2; i * j <= STA; j++) { prime[i * j] = 1; } } while (1) { cnt = 0; cin >> n; if (n == 0) break; for (int i = 2; i <=...
#include <iostream> #define STA 50000 using namespace std; int prime[50001]; int main() { int n; int cnt; for (int i = 2; i <= STA / 2; i++) { for (int j = 2; i * j <= STA; j++) { prime[i * j] = 1; } } while (1) { cnt = 0; cin >> n; if (n == 0) break; for (int i = 2; i <=...
replace
20
26
20
22
TLE
p00056
C++
Runtime Error
#include <cstdio> #include <cstring> #define N 50 using namespace std; int main(void) { int p[N + 1] = {0}; int n, ans; for (int i = 2; i < N; i++) { if (p[i] == -1) continue; p[i] = 1; for (int j = i * 2; j < N; j += i) { p[j] = -1; } } while (scanf("%d", &n), n) { ans = 0...
#include <cstdio> #include <cstring> #define N 50000 using namespace std; int main(void) { int p[N + 1] = {0}; int n, ans; for (int i = 2; i < N; i++) { if (p[i] == -1) continue; p[i] = 1; for (int j = i * 2; j < N; j += i) { p[j] = -1; } } while (scanf("%d", &n), n) { ans ...
replace
3
4
3
4
0
p00056
C++
Time Limit Exceeded
#include <iostream> #define MAX 50000 using namespace std; bool is_prime[MAX]; void tenes(void) { for (int i = 0; i < MAX; i++) { is_prime[i] = true; } is_prime[0] = is_prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (is_prime[i]) { for (int j = i + i; j < MAX; j += i) { is_p...
#include <iostream> #define MAX 50000 using namespace std; bool is_prime[MAX]; void tenes(void) { for (int i = 0; i < MAX; i++) { is_prime[i] = true; } is_prime[0] = is_prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (is_prime[i]) { for (int j = i + i; j < MAX; j += i) { is_p...
replace
33
43
33
36
TLE
p00056
C++
Time Limit Exceeded
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { bool p[50001]; memset(p, 1, sizeof(p)); p[0] = p[1] = 0; for (int i = 0; i < 50001; i++) { if (p[i]) { for (int j = 2 * i; j < 50001; j += i) { p[j] = 0; } } } int n, sum; while (cin >> ...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { bool p[50001]; memset(p, 1, sizeof(p)); p[0] = p[1] = 0; for (int i = 0; i < 50001; i++) { if (p[i]) { for (int j = 2 * i; j < 50001; j += i) { p[j] = 0; } } } int n, sum; while (cin >> ...
replace
19
27
19
22
TLE
p00056
C++
Runtime Error
#include <bitset> #include <stdio.h> int main() { const int N = 5001; int i, j, n, c; std::bitset<N> p(3); p.flip(); for (i = 2; i * i < N; ++i) if (p[i]) for (j = i * 2; j < N; j += i) p[j] = 0; while (scanf("%d", &n), n) { for (c = i = 0, j = n; i <= j; ++i, --j) if (p[i] && p[...
#include <bitset> #include <stdio.h> int main() { const int N = 50001; int i, j, n, c; std::bitset<N> p(3); p.flip(); for (i = 2; i * i < N; ++i) if (p[i]) for (j = i * 2; j < N; j += i) p[j] = 0; while (scanf("%d", &n), n) { for (c = i = 0, j = n; i <= j; ++i, --j) if (p[i] && p...
replace
3
4
3
4
0
p00056
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; const int MAX = 1000100; bool prime[MAX]; void sieve() { fill(prime, prime + MAX, true); prime[0] = prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (!prime[i]) continue; for (int j = i * i; j < MAX; j += i) prime[j] = fals...
#include <iostream> #include <string> using namespace std; const int MAX = 1000100; bool prime[MAX]; void sieve() { fill(prime, prime + MAX, true); prime[0] = prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (!prime[i]) continue; for (int j = i * i; j < MAX; j += i) prime[j] = fals...
replace
25
29
25
29
TLE
p00056
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int MAX = 1000100; bool prime[MAX]; void sieve() { fill(prime, prime + MAX, true); prime[0] = prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (!prime[i]) continue; for (int j = i * i; j < MAX; j += i) prime[j] = false; } } int...
#include <bits/stdc++.h> using namespace std; const int MAX = 1000100; bool prime[MAX]; void sieve() { fill(prime, prime + MAX, true); prime[0] = prime[1] = false; for (int i = 2; i * i < MAX; i++) { if (!prime[i]) continue; for (int j = i * i; j < MAX; j += i) prime[j] = false; } } int...
replace
24
28
24
27
TLE
p00056
C++
Time Limit Exceeded
#include <iostream> using namespace std; const int max_lim = 50001; bool prime[max_lim]; void init() { for (int i = 0; i < max_lim; i++) prime[i] = true; prime[0] = prime[1] = false; for (int i = 2; i * i < max_lim; i++) for (int j = 2 * i; j < max_lim; j += i) prime[j] = false; } int main() { ...
#include <iostream> using namespace std; const int max_lim = 50001; bool prime[max_lim]; void init() { for (int i = 0; i < max_lim; i++) prime[i] = true; prime[0] = prime[1] = false; for (int i = 2; i * i < max_lim; i++) for (int j = 2 * i; j < max_lim; j += i) prime[j] = false; } int main() { ...
replace
23
27
23
26
TLE
p00056
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++) #define MAX 1000000 #define pb push_back using namespace std; int prime[MAX]; int main() { prime[0] = prime[1] = 0; REP(i, 2, MAX) { prime[...
#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++) #define MAX 1000000 #define pb push_back using namespace std; int prime[MAX]; int main() { prime[0] = prime[1] = 0; REP(i, 2, MAX) { prime[...
replace
30
49
30
33
TLE
p00056
C++
Runtime Error
#include <iostream> using namespace std; #define MAX 50004 #define MAXL 3000 int dp[MAX], d[MAX]; int main() { int n, m = 0; static bool c[MAX] = {true, true}; for (int i = 2; m < MAXL; i++) { if (!c[i]) { for (int j = 2; i * j < MAX; j++) c[i * j] = true; d[m++] = i; } } for (in...
#include <iostream> using namespace std; #define MAX 50004 #define MAXL 3000 int dp[MAX], d[MAX]; int main() { int n, m = 0; static bool c[MAX] = {true, true}; for (int i = 2; i < MAX; i++) { if (!c[i]) { for (int j = 2; i * j < MAX; j++) c[i * j] = true; d[m++] = i; } } for (int...
replace
9
10
9
10
-11
p00057
C++
Time Limit Exceeded
#include <iostream> #include <stdio.h> using namespace std; int keisan(int a) { if (a == 1) { return 2; } else { return a + keisan(a - 1); } } int main() { int n; while (1) { cin >> n; cout << keisan(n) << endl; } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int keisan(int a) { if (a == 1) { return 2; } else { return a + keisan(a - 1); } } int main() { int n; while (cin >> n) { cout << keisan(n) << endl; } return 0; }
replace
15
17
15
16
TLE
p00057
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main(void) { while (1) { int n; cin >> n; if (n == 0) break; cout << 1 + n * (n + 1) / 2 << endl; } }
#include <iostream> using namespace std; int main(void) { while (1) { int n; if (!(cin >> n)) break; cout << 1 + n * (n + 1) / 2 << endl; } }
replace
7
9
7
8
TLE
p00057
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { vector<ll> vec; vec[0] = 1; for (int i = 1; i <= 10000; i++) { vec[i] = vec[i - 1] + i; } int n; while (cin >> n) { cout << vec[n] << endl; } return 0; } // int main(){ // int n; // while(c...
#include <iostream> #include <vector> using namespace std; typedef long long ll; int main() { vector<ll> vec(10001); vec[0] = 1; for (int i = 1; i <= 10000; i++) { vec[i] = vec[i - 1] + i; } int n; while (cin >> n) { cout << vec[n] << endl; } return 0; } // int main(){ // int n; // ...
replace
8
9
8
9
-11
p00057
C++
Time Limit Exceeded
#include <iostream> int heimen(int nn) { int a; a = ((nn * nn) + nn + 2) / 2; return a; } using namespace std; int main() { int n, ans; while (cin >> n, n) { ans = heimen(n); cout << ans << endl; } }
#include <iostream> int heimen(int nn) { int a; a = ((nn * nn) + nn + 2) / 2; return a; } using namespace std; int main() { int n, ans; while (cin >> n) { ans = heimen(n); cout << ans << endl; } }
replace
11
12
11
12
TLE
p00058
C++
Runtime Error
#include <cstdio> int main() { float xA, yA, xB, yB, xC, yC, xD, yD; while (scanf("%f%f%f%f%f%f%f%f", xA, yA, xB, yB, xC, yC, xD, yD) != EOF) { if ((xA == xB && yC == yD) || (yA == yB && xC == xD)) { puts("YES"); continue; } else if (xA == xB || yC == yD || yA == yB || xC == xD) { puts("NO...
#include <cstdio> int main() { double xA, yA, xB, yB, xC, yC, xD, yD; while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &xA, &yA, &xB, &yB, &xC, &yC, &xD, &yD) != EOF) { if ((xA - xB) * (xC - xD) + (yA - yB) * (yC - yD) == 0) { puts("YES"); } else { puts("NO"); } } }
replace
2
14
2
6
-11
p00058
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1e9; int main() { vector<double> x(4); vector<d...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1e9; int main() { vector<double> x(4); vector<d...
replace
25
27
25
26
0
0 6 22.42 0
p00059
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define range(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define rep(i, n) range(i, 0, n) using namespace std; typedef complex<double> P; int main(void) { P p[4]; while (1) { rep(i, 4) { double x, y; cin >> x >> y; p[i] = {x, y}; } bool ok = true; if (...
#include <bits/stdc++.h> #define range(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define rep(i, n) range(i, 0, n) using namespace std; typedef complex<double> P; int main(void) { P p[4]; while (1) { rep(i, 4) { double x, y; cin >> x >> y; p[i] = {x, y}; } if (cin.eof()) bre...
insert
15
15
15
17
TLE
p00059
C++
Time Limit Exceeded
#include <iostream> using namespace std; typedef struct { double x, y; } _z; int main() { _z p[4]; while (1) { for (int i = 0; i < 4; i++) { cin >> p[i].x >> p[i].y; } if (p[3].x < p[0].x || p[2].x > p[1].x || p[2].y > p[1].y || p[3].y < p[0].y) { cout << "NO" << endl; } ...
#include <iostream> using namespace std; typedef struct { double x, y; } _z; int main() { _z p[4]; while (cin >> p[0].x >> p[0].y) { for (int i = 1; i < 4; i++) { cin >> p[i].x >> p[i].y; } if (p[3].x < p[0].x || p[2].x > p[1].x || p[2].y > p[1].y || p[3].y < p[0].y) { cout <...
replace
12
14
12
14
TLE
p00060
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { char buf; int buf_cnt = 0; int c[3]; int my_cards; int ok = 0; int cnt = 0; double probability; for (int i = 0; i < 3; i++) { c[i] = 0; } while ((buf = getchar()) != EOF) { if (buf >= '0' && buf <= '9') { buf -= '0'; c[buf_cnt] = c[buf_cnt] *...
#include <stdio.h> int main(void) { char buf; int buf_cnt = 0; int c[3]; int my_cards; int ok = 0; int cnt = 0; double probability; for (int i = 0; i < 3; i++) { c[i] = 0; } while ((buf = getchar()) != EOF) { if (buf >= '0' && buf <= '9') { buf -= '0'; c[buf_cnt] = c[buf_cnt] *...
delete
61
62
61
61
TLE
p00061
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; int main() { int number, suu, in; // result = 整理番号と正解数の対応 map<int, int> result; // rank = 順位表 need to include <functional> set<int, greater<int>> rank; while (sc...
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <functional> #include <iostream> #include <map> #include <set> using namespace std; int main() { int number, suu, in; // result = 整理番号と正解数の対応 map<int, int> result; // rank = 順位表 need to include <functional> set<int, greater<int>> rank; while (sc...
replace
15
16
15
16
TLE
p00061
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { map<int, int> M; vector<pair<int, int>> V; int a, b; while (scanf("%d,%d", &a, &b), a && b) { V.push_back(make_pair(b, a)); } sort(V.begin(), V.end()); reverse(V.begin(), V.end...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { map<int, int> M; vector<pair<int, int>> V; int a, b; while (scanf("%d,%d", &a, &b), a || b) { V.push_back(make_pair(b, a)); } sort(V.begin(), V.end()); reverse(V.begin(), V.end...
replace
10
11
10
11
0
p00061
C++
Time Limit Exceeded
#include <iostream> using namespace std; int a, b, x[1000], y[1000], p, sum, ok; char c; int main() { while (cin >> a >> c >> b) { if (a + b == 0) { break; } x[a] = b; p++; } sum = 1; for (int i = 30; i >= 0; i++) { ok = 0; for (int j = 1; j <= p; j++) { if (x[j] == i) { ...
#include <iostream> using namespace std; int a, b, x[1000], y[1000], p, sum, ok; char c; int main() { while (cin >> a >> c >> b) { if (a + b == 0) { break; } x[a] = b; p++; } sum = 1; for (int i = 30; i >= 0; i--) { ok = 0; for (int j = 1; j <= p; j++) { if (x[j] == i) { ...
replace
13
14
13
14
TLE
p00061
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { pair<int, int> a[1000]; int c = 0, t[1000]; char cc; while (1) { scanf("%d,%d", &a[c].second, &a[c].first); c++; if (a[c - 1].first == 0 && a[c - 1].second == 0) goto L; } L: c--; stable_sort(a, a + c); int r = 1; t[a[c - 1]....
#include <bits/stdc++.h> using namespace std; int main() { pair<int, int> a[1000]; int c = 0, t[1000]; char cc; while (1) { scanf("%d,%d", &a[c].second, &a[c].first); c++; if (a[c - 1].first == 0 && a[c - 1].second == 0) goto L; } L: c--; stable_sort(a, a + c); int r = 1; t[a[c - 1]....
replace
24
25
24
25
TLE
p00061
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int id, num; map<int, int> m; vector<int> v; while (1) { scanf("%d,%d", &id, &num); if (id | num) ; else break; m[id] = num; v.push_back(-num); } sor...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int id, num; map<int, int> m; vector<int> v; while (1) { scanf("%d,%d", &id, &num); if (id | num) ; else break; m[id] = num; v.push_back(-num); } sor...
replace
22
23
22
23
TLE
p00061
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <map> #include <vector> typedef std::pair<int, int> Entrant; bool descending_Entrant(const Entrant &e1, const Entrant &e2) { return e1.second > e2.second; } int main() { int num, points; std::vector<Entrant> v; std::map<int, int> m; while (scanf("%d,%d", &num...
#include <algorithm> #include <cstdio> #include <map> #include <vector> typedef std::pair<int, int> Entrant; bool descending_Entrant(const Entrant &e1, const Entrant &e2) { return e1.second > e2.second; } int main() { int num, points; std::vector<Entrant> v; std::map<int, int> m; while (scanf("%d,%d", &num...
replace
15
16
15
16
TLE
p00062
C++
Runtime Error
#include <stdio.h> int hoge(int x[]) { for (int j = 9; j >= 0; j++) { for (int i = 0; i < j; i++) { x[i] = (x[i] + x[i + 1]) % 10; } } return x[0]; } int main() { char a[15]; while (~scanf("%s", a)) { int c[10]; for (int i = 0; i < 10; i++) { c[i] = a[i] - '0'; } c[0]...
#include <stdio.h> int hoge(int x[]) { for (int j = 9; j > 0; j--) { for (int i = 0; i < j; i++) { x[i] = (x[i] + x[i + 1]) % 10; } } return x[0]; } int main() { char a[15]; while (~scanf("%s", a)) { int c[10]; for (int i = 0; i < 10; i++) { c[i] = a[i] - '0'; } c[0] ...
replace
4
5
4
5
-11
p00062
C++
Runtime Error
#include <cstdio> int main() { char top[10]; while (scanf("%s", top) != EOF) { int nums[10]; for (int i = 0; i < 10; i++) nums[i] = top[i] - '0'; int res = nums[0] + nums[1] * 9 + nums[2] * 36 + nums[3] * 84 + nums[4] * 126 + nums[5] * 126 + nums[6] * 84 + nums[7] * 36 + ...
#include <iostream> using namespace std; int main(void) { char tmp[10]; char buf; while (cin >> buf) { tmp[0] = buf - '0'; for (int i = 1; i < 10; i++) { cin >> buf; tmp[i] = buf - '0'; } for (int i = 8; i >= 0; i--) { for (int j = 0; j <= i; j++) { tmp[j] = (tmp[j] + tmp...
replace
0
12
0
17
0
p00062
C++
Runtime Error
#include <stdio.h> int main() { char b[10]; while (~scanf("%s", b)) { int c[10]; for (int i = 0; i < 10; i++) c[i] = b[i] - '0'; for (int i = 9; i > 0; i--) for (int j = 0; j < i; j++) c[j] = (c[j] + c[j + 1]) % 10; printf("%d\n", c[0]); } }
#include <stdio.h> int main() { char b[15]; while (~scanf("%s", b)) { int c[10]; for (int i = 0; i < 10; i++) c[i] = b[i] - '0'; for (int i = 9; i > 0; i--) for (int j = 0; j < i; j++) c[j] = (c[j] + c[j + 1]) % 10; printf("%d\n", c[0]); } }
replace
3
4
3
4
0
p00062
C++
Time Limit Exceeded
#include <stdio.h> int main() { char a[10]; while (scanf("%s", a) != 0) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9 - i; j++) { a[j] = a[j] + a[j + 1] - '0'; if (a[j] - '0' > 9) a[j] -= 10; } } printf("%c\n", a[0]); } }
#include <stdio.h> int main() { char a[10]; while (scanf("%s", a) != EOF) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9 - i; j++) { a[j] = a[j] + a[j + 1] - '0'; if (a[j] - '0' > 9) a[j] -= 10; } } printf("%c\n", a[0]); } }
replace
3
4
3
4
TLE
p00062
C++
Runtime Error
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
replace
29
30
29
30
0
p00062
C++
Runtime Error
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char input[10]; int field[9][9]; while (scanf("%s", input) != EOF) { memset(field, 0, sizeof(field)); for (int i = 0; i < 9; i++) { field[0][i] = (input[i] - '0' + input[i + 1] - '0') % 10; } for (i...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char input[20]; int field[20][20]; while (scanf("%s", input) != EOF) { memset(field, 0, sizeof(field)); for (int i = 0; i < 9; i++) { field[0][i] = (input[i] - '0' + input[i + 1] - '0') % 10; } for ...
replace
5
7
5
7
0
p00063
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; int main() { char str[51]; int count = 0; while (cin >> str) { int len = strlen(str); bool isPal = true; for (int i = 0; i < len / 2; i++) { if (str[i] != str[len - i - 1]) { isPal = false; break; } } if...
#include <cstring> #include <iostream> using namespace std; int main() { char str[101]; int count = 0; while (cin >> str) { int len = strlen(str); bool isPal = true; for (int i = 0; i < len / 2; i++) { if (str[i] != str[len - i - 1]) { isPal = false; break; } } i...
replace
6
7
6
7
0
p00063
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { string str, inv; int cnt = 0; while (cin >> str, str.length()) { inv.resize(str.length()); for (int i = 0; i < str.length(); i++) { inv[i] = str[str.length() - 1 - i]; } if (str == inv) { cnt++; } } cout <...
#include <iostream> #include <string> using namespace std; int main() { string str, inv; int cnt = 0; while (getline(cin, str), str.length() != 0) { inv.resize(str.length()); for (int i = 0; i < str.length(); i++) { inv[i] = str[str.length() - 1 - i]; } if (str == inv) { cnt++; } ...
replace
7
8
7
8
TLE
p00063
C++
Runtime Error
#include <stdio.h> #include <string.h> int main(void) { char str[100]; int cnt = 0; while (scanf("%s", str) != EOF) { int i, j; for (i = 0, j = strlen(str) - 1; i <= j; i++, j--) { if (str[i] != str[j]) break; } if (i > j) cnt++; } printf("%d\n", cnt); return 0; }
#include <stdio.h> #include <string.h> int main(void) { char str[200]; int cnt = 0; while (scanf("%s", str) != EOF) { int i, j; for (i = 0, j = strlen(str) - 1; i <= j; i++, j--) { if (str[i] != str[j]) break; } if (i > j) cnt++; } printf("%d\n", cnt); return 0; }
replace
4
5
4
5
0
p00063
C++
Runtime Error
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char ss[100]; int i, c; c = 0; while (0 <= scanf("%s", ss)) { for (i = 0; i <= strlen(ss) - 1; i++) { if (ss[i] != ss[strlen(ss) - i - 1]) break; } if (i == strlen(ss)) ++c; } printf("%d\n", c); retur...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char ss[110]; int i, c; c = 0; while (0 <= scanf("%s", ss)) { for (i = 0; i <= strlen(ss) - 1; i++) { if (ss[i] != ss[strlen(ss) - i - 1]) break; } if (i == strlen(ss)) ++c; } printf("%d\n", c); retur...
replace
5
6
5
6
0
p00064
C++
Runtime Error
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, a, b) for (int i = a; i < b; ++i) t...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, a, b) for (int i = a; i < b; ++i) t...
insert
45
45
45
46
0
p00064
C++
Runtime Error
#include <cctype> #include <iostream> using namespace std; string sentence; typedef string::const_iterator State; int parse(State &it) { int ret = 0; while (isdigit(*it)) { ret = ret * 10; ret = ret + *it - '0'; it++; } return ret; } int main(void) { int sum = 0; while (cin >> sentence) { ...
#include <cctype> #include <iostream> using namespace std; string sentence; typedef string::const_iterator State; int parse(State &it) { int ret = 0; while (isdigit(*it)) { ret = ret * 10; ret = ret + *it - '0'; it++; } return ret; } int main(void) { int sum = 0; while (cin >> sentence) { ...
insert
23
23
23
24
0
p00064
C++
Time Limit Exceeded
#include <cstdio> using namespace std; int main() { int n; int ans = 0; while (scanf("%[0-9]", &n) != EOF) { ans += n; } printf("%d\n", ans); return (0); }
#include <cstdio> using namespace std; int main() { int n; int ans = 0; while (~scanf("%*[^0-9]%d", &n)) { ans += n; } printf("%d\n", ans); return (0); }
replace
7
8
7
8
TLE
p00064
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using db = double; using ll = long long; using vi = vector<int>; #define op operator #define pb push_back int main() { cout << fixed << setprecision(9); ios ::sync_with_stdio(0); int ans = 0; for (string s; getline(cin, s);) { s += ' '; string t = ""; ...
#include <bits/stdc++.h> using namespace std; using db = double; using ll = long long; using vi = vector<int>; #define op operator #define pb push_back int main() { cout << fixed << setprecision(9); ios ::sync_with_stdio(0); int ans = 0; for (string s; getline(cin, s);) { s += ' '; string t = ""; ...
replace
20
21
20
21
-6
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
p00064
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #include <iostream> // #include<algorithm> // #include<cmath> // #include<string> // #include<cctype> // #include <vector> using namespace std; int main() { int s, a = 0; while (scanf("%*[^0-9]%d", &s) != 0) a += s; cout << a << endl; return 0; }
#define _CRT_SECURE_NO_WARNINGS #include <iostream> // #include<algorithm> // #include<cmath> // #include<string> // #include<cctype> // #include <vector> using namespace std; int main() { int s, a = 0; while (~scanf("%*[^0-9]%d", &s)) a += s; cout << a << endl; return 0; }
replace
10
11
10
11
TLE
p00064
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, sum = 0; char c; while ((c = getchar())) { if (c >= '0' && c <= '9') { n *= 10; n += (c - ('0')); } else { sum += n; n = 0; } } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, sum = 0; char c; while ((c = getchar()) != EOF) { if (c >= '0' && c <= '9') { n *= 10; n += (c - ('0')); } else { sum += n; n = 0; } } cout << sum << endl; }
replace
5
6
5
6
TLE
p00065
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, l, n) for (int i = l; i < n; i++) #define rer(i, l, n...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, l, n) for (int i = l; i < n; i++) #define rer(i, l, n...
replace
42
43
42
43
-11
p00065
C++
Runtime Error
#include <iostream> #include <string> using namespace std; string S; int x[100000][2]; int c = 0; int main() { while (getline(cin, S)) { if (S.size() == 0) { c++; } string T[2]; int ok = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == ',') { ok++; } else { T[o...
#include <iostream> #include <string> using namespace std; string S; int x[100000][2]; int c = 0; int main() { while (getline(cin, S)) { if (S.size() == 0) { c++; continue; } string T[2]; int ok = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == ',') { ok++; } el...
insert
10
10
10
11
-6
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
p00066
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main(void) { string s; while (true) { cin >> s; for (int i = 0; i < 3; ++i) { if (s[0 + 3 * i] == s[1 + 3 * i] && s[1 + 3 * i] == s[2 + 3 * i] && s[2 + 3 * i] == 'o') { cout << "o" << endl; goto end; } if (s[0 + ...
#include <bits/stdc++.h> using namespace std; int main(void) { string s; while (true) { cin >> s; if (cin.fail()) break; for (int i = 0; i < 3; ++i) { if (s[0 + 3 * i] == s[1 + 3 * i] && s[1 + 3 * i] == s[2 + 3 * i] && s[2 + 3 * i] == 'o') { cout << "o" << endl; go...
replace
7
8
7
9
TLE
p00066
C++
Time Limit Exceeded
#include <iostream> using namespace std; char table[3][3]; int main(void) { while (true) { for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) cin >> table[x][y]; int judge = 0; for (int y = 0; y < 3; y++) { if (table[0][y] == table[1][y] && table[1][y] == table[2][y] && ...
#include <iostream> using namespace std; char table[3][3]; int main(void) { while (true) { for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) cin >> table[x][y]; if (cin.eof()) break; int judge = 0; for (int y = 0; y < 3; y++) { if (table[0][y] == table[1][y] && table...
insert
11
11
11
13
TLE
p00066
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { while (1) { string s; cin >> s; char a[3][3]; a[0][0] = s[0]; a[0][1] = s[1]; a[0][2] = s[2]; a[1][0] = s[3]; a[1][1] = s[4]; a[1][2] = s[5]; a[2][0] = s[6]; a[2][1] = s[7]; a[2][2] = s[8]; char S = 's'; ...
#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin >> s) { char a[3][3]; a[0][0] = s[0]; a[0][1] = s[1]; a[0][2] = s[2]; a[1][0] = s[3]; a[1][1] = s[4]; a[1][2] = s[5]; a[2][0] = s[6]; a[2][1] = s[7]; a[2][2] = s[8]; char S = 's'; bool...
replace
5
8
5
8
TLE
p00067
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; char a[12][12]; void irand(int i, int j) { a[i][j] == '0'; if (i > 0 && a[i - 1][j] == '1') irand(i - 1, j); if (j > 0 && a[i][j - 1] == '1') irand(i, j - 1); if (i < 11 && a[i + 1][j] == '1') irand(i + 1, j); if (j < 11 && a[i][j + 1] == ...
#include <cstdio> #include <iostream> using namespace std; char a[12][12]; void irand(int i, int j) { a[i][j] = '0'; if (i > 0 && a[i - 1][j] == '1') irand(i - 1, j); if (j > 0 && a[i][j - 1] == '1') irand(i, j - 1); if (i < 11 && a[i + 1][j] == '1') irand(i + 1, j); if (j < 11 && a[i][j + 1] == '...
replace
5
6
5
6
-11
p00067
C++
Time Limit Exceeded
#include <iostream> using namespace std; char nyuryoku[12][12]; void fun(int y, int x, char masume) { if ((x < 0) || (12 <= x) || (y < 0) || (12 <= y)) { return; } if (masume != nyuryoku[y][x]) return; else nyuryoku[y][x] = '+'; fun(y + 1, x, masume); fun(y - 1, x, masume); fun(y, x + 1, mas...
#include <iostream> using namespace std; char nyuryoku[12][12]; void fun(int y, int x, char masume) { if ((x < 0) || (12 <= x) || (y < 0) || (12 <= y)) { return; } if (masume != nyuryoku[y][x]) return; else nyuryoku[y][x] = '+'; fun(y + 1, x, masume); fun(y - 1, x, masume); fun(y, x + 1, mas...
replace
20
22
20
24
TLE
p00067
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> using namespace std; bool isLand[12][12]; bool deleteOneLand(int x, int y) { if (!isLand[y][x]) return false; isLand[y][x] = false; if (x > 0) deleteOneLand(x - 1, y); if (y > 0) deleteOneLand(x, y - 1); if (x < 11) deleteOneLand(x + 1, y); if (y < 11)...
#include <cstdio> #include <iostream> using namespace std; bool isLand[12][12]; bool deleteOneLand(int x, int y) { if (!isLand[y][x]) return false; isLand[y][x] = false; if (x > 0) deleteOneLand(x - 1, y); if (y > 0) deleteOneLand(x, y - 1); if (x < 11) deleteOneLand(x + 1, y); if (y < 11)...
replace
35
36
35
37
TLE
p00067
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> #define MAX_L 12 using namespace std; char table[MAX_L][MAX_L]; int fdx[] = {1, 0, -1, 0}, fdy[] = {0, 1, 0, -1}; void dfs(int y, int x) { if (x < 0 || x >= MAX_L || y < 0 || y >= MAX_L || table[y][x] == '0') return; table[y][x]--; for (int r = 0; r < 4; r++) { dfs(y...
#include <cstdio> #include <iostream> #define MAX_L 12 using namespace std; char table[MAX_L][MAX_L]; int fdx[] = {1, 0, -1, 0}, fdy[] = {0, 1, 0, -1}; void dfs(int y, int x) { if (x < 0 || x >= MAX_L || y < 0 || y >= MAX_L || table[y][x] == '0') return; table[y][x]--; for (int r = 0; r < 4; r++) { dfs(y...
replace
20
21
20
22
TLE
p00067
C++
Time Limit Exceeded
#include <iostream> using namespace std; int cnt; char field[13][13]; void solve(int x, int y) { field[y][x] = '0'; if (x + 1 < 12) if (field[y][x + 1] == '1') solve(x + 1, y); if (x - 1 >= 0) if (field[y][x - 1] == '1') solve(x - 1, y); if (y + 1 < 12) if (field[y + 1][x] == '1') ...
#include <iostream> using namespace std; int cnt; char field[13][13]; void solve(int x, int y) { field[y][x] = '0'; if (x + 1 < 12) if (field[y][x + 1] == '1') solve(x + 1, y); if (x - 1 >= 0) if (field[y][x - 1] == '1') solve(x - 1, y); if (y + 1 < 12) if (field[y + 1][x] == '1') ...
insert
27
27
27
29
TLE
p00067
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, init, n) for (int i = init; i < (n); i++) using namespace std; using ll = long long int; using P = pair<int, int>; using T = tuple<int, int, int>; using edge = struct { int to, cost; }; const int MOD = 1e9 + 7; const int iINF =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define REP(i, init, n) for (int i = init; i < (n); i++) using namespace std; using ll = long long int; using P = pair<int, int>; using T = tuple<int, int, int>; using edge = struct { int to, cost; }; const int MOD = 1e9 + 7; const int iINF =...
replace
50
52
50
52
TLE
p00067
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int masu[14][14]; int cont; void saiki(int x, int y) { masu[x][y] = 0; if (masu[x + 1][y] == 1) saiki(x + 1, y); if (masu[x][y + 1] == 1) saiki(x, y + 1); ...
#include <algorithm> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int masu[14][14]; int cont; void saiki(int x, int y) { masu[x][y] = 0; if (masu[x + 1][y] == 1) saiki(x + 1, y); if (masu[x][y + 1] == 1) saiki(x, y + 1); ...
replace
34
36
34
35
TLE
p00067
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; string str; int xs[] = {0, 1, 0, -1}, ys[] = {1, 0, -1, 0}; bool m[10][10]; void dfs(int x, int y) { for (int i = 0; i < 4; i++) { int tx = x + xs[i], ty = y + ys[i]; if (tx < 0 || tx >= 12 || ty < 0 || ty >= 12) continue; ...
#include <algorithm> #include <iostream> #include <string> using namespace std; string str; int xs[] = {0, 1, 0, -1}, ys[] = {1, 0, -1, 0}; bool m[20][20]; void dfs(int x, int y) { for (int i = 0; i < 4; i++) { int tx = x + xs[i], ty = y + ys[i]; if (tx < 0 || tx >= 12 || ty < 0 || ty >= 12) continue; ...
replace
6
7
6
7
0
p00067
C++
Runtime Error
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; char shima[13][13]; void tansaku(int ...
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; char shima[13][13]; void tansaku(int ...
replace
32
33
32
35
-11
p00067
C++
Time Limit Exceeded
#include "bits/stdc++.h" #include <sstream> #include <string> using namespace std; int data[12][12]; vector<string> s(12); int dx[] = {1, 0, -1, 0}; int dy[] = {0, -1, 0, 1}; void dfs(int x, int y) { s[y][x] = '0'; for (int i = 0; i < 4; ++i) { int px = x + dx[i]; int py = y + dy[i]; if (px < 0 || px >...
#include "bits/stdc++.h" #include <sstream> #include <string> using namespace std; int data[12][12]; vector<string> s(12); int dx[] = {1, 0, -1, 0}; int dy[] = {0, -1, 0, 1}; void dfs(int x, int y) { s[y][x] = '0'; for (int i = 0; i < 4; ++i) { int px = x + dx[i]; int py = y + dy[i]; if (px < 0 || px >...
replace
29
30
29
30
TLE
p00067
C++
Time Limit Exceeded
//============================================================================ // Name : aoj0067.cpp // Author : afterCmidday // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================...
//============================================================================ // Name : aoj0067.cpp // Author : afterCmidday // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================...
replace
27
28
27
28
TLE
p00068
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define np string::...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define np string::...
insert
133
133
133
136
-6
terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append
p00068
C++
Time Limit Exceeded
#include <iostream> using namespace std; struct point { double x; double y; bool operator!=(point &p) { return (x != p.x || y != p.y); } bool operator==(point &p) { return (x == p.x && y == p.y); } }; point getLeftPoint(int n, point *points); double getCrossProduct(const point &a, const point &b, const poin...
#include <iostream> using namespace std; struct point { double x; double y; bool operator!=(point &p) { return (x != p.x || y != p.y); } bool operator==(point &p) { return (x == p.x && y == p.y); } }; point getLeftPoint(int n, point *points); double getCrossProduct(const point &a, const point &b, const poin...
replace
24
25
24
25
TLE
p00068
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; // #define int long long #define DBG 1 #define dump(o) \ if (DBG) { \ cerr << #o << " " << (o) << endl; ...
#include "bits/stdc++.h" using namespace std; // #define int long long #define DBG 0 #define dump(o) \ if (DBG) { \ cerr << #o << " " << (o) << endl; ...
replace
4
5
4
5
0
CH 0 1 1 0 2 1 1 2 CH -940.2 -877.2 -361.62 -970 667.54 430.49 -859.32 -64.84 -509.94 892.63 551.12 828.21
p00068
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #...
insert
114
114
114
117
-6
terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append
p00069
C++
Runtime Error
#include <cassert> #include <iostream> #include <utility> #include <vector> using namespace std; int n, m, h, d; vector<string> F; bool judge(vector<string> f) { int now = m; for (int i = 0; i < f.size(); i++) { assert(now != 0); if (f[i][now - 1] == '1') { now = now - 1; } else if (f[i][now] ==...
#include <cassert> #include <iostream> #include <utility> #include <vector> using namespace std; int n, m, h, d; vector<string> F; bool judge(vector<string> f) { int now = m; for (int i = 0; i < f.size(); i++) { assert(now != 0); if (f[i][now - 1] == '1') { now = now - 1; } else if (f[i][now] ==...
replace
27
28
27
28
0
p00069
C++
Time Limit Exceeded
#include <stdio.h> bool Simulation(char line[][15], int start, int goal, int m) { int pos = start; for (int i = 0; i < m; i++) { if (line[i][pos] == '1') { pos++; } else if (line[i][pos - 1] == '1') { pos--; } } return (pos == goal); } int main(void) { int n, m; int start; int g...
#include <stdio.h> bool Simulation(char line[][15], int start, int goal, int m) { int pos = start; for (int i = 0; i < m; i++) { if (line[i][pos] == '1') { pos++; } else if (line[i][pos - 1] == '1') { pos--; } } return (pos == goal); } int main(void) { int n, m; int start; int g...
insert
23
23
23
26
TLE
p00069
C++
Runtime Error
#include <iostream> #include <vector> class level { int num; int size; int to_b(const int &n) { if (n == 0) return 0; else return (to_b(n / 10) << 1) + (n % 10); } public: int test(const int &n) { return (((num << (n + 1)) >> size) & 1) - (((num << n) >> size) & 1); } level(const ...
#include <iostream> #include <vector> class level { int num; int size; int to_b(const int &n) { if (n == 0) return 0; else return (to_b(n / 10) << 1) + (n % 10); } public: int test(const int &n) { return (((num << (n + 1)) >> size) & 1) - (((num << n) >> size) & 1); } level(const ...
replace
53
63
53
61
0
p00069
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int N, M, G, D; bool c(vector<string> m) { int y = M - 1; for (int x = 0; x < D + 1; x++) { if (y < N - 1 && m[x][y] == '1') { y++; } else if (0 < y && m[x][y - 1] == '1') { y--; } } if (y...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int N, M, G, D; bool c(vector<string> m) { int y = M - 1; for (int x = 0; x < D; x++) { if (y < N - 1 && m[x][y] == '1') { y++; } else if (0 < y && m[x][y - 1] == '1') { y--; } } if (y == ...
replace
10
11
10
11
-11
p00070
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; bool used[10]; int sum; int dp[11][1000]; void saiki(int c, int d) { // c?????§??§d dp[c][d]++; if (c == 10) { return; } for (int e = 0; e < 10; e++)...
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; bool used[10]; int sum; int dp[11][10005]; void saiki(int c, int d) { // c?????§??§d dp[c][d]++; if (c == 10) { return; } for (int e = 0; e < 10; e++...
replace
11
12
11
12
0
p00070
C++
Runtime Error
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
replace
32
33
32
33
0
p00070
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; //--------------------------------------------------- //??...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; //--------------------------------------------------- //??...
replace
43
54
43
50
-11
p00070
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make_pair #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, c) ...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make_pair #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, c) ...
replace
45
46
45
49
0
p00070
C++
Runtime Error
#include <bits/stdc++.h> #define range(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define rep(i, n) range(i, 0, n) using namespace std; int n, s; int memo[11][1010]; void rec(int index, int sum, int mask) { memo[index][sum]++; if (index == 10) return; rep(i, 10) { if (mask & (1 << i)) continue;...
#include <bits/stdc++.h> #define range(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define rep(i, n) range(i, 0, n) using namespace std; int n, s; int memo[11][1010]; void rec(int index, int sum, int mask) { memo[index][sum]++; if (index == 10) return; rep(i, 10) { if (mask & (1 << i)) continue;...
replace
26
27
26
30
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
replace
25
27
25
27
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
replace
25
28
25
30
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
#include <cstring> #include <iostream> using namespace std; int dp[11][1 << 10][331]; int ans(int n, int x, int s); int main() { int n, m; memset(dp, -1, sizeof(dp)); while (cin >> n >> m) { if (n > 10 || 330 < m) { cout << "0" << endl; } else { cout << ans(n, 0, m) << endl; } } return...
replace
25
27
25
27
0
p00070
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int number[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; long long int dp[10][10001]; long long int factorial(int x) { long long int ret = 1; for (int i = 1; i <= x; i++) ret *= i; return ret; } int main() { do { int sum = 0; for (int i = 0; i...
#include <algorithm> #include <iostream> using namespace std; int number[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; long long int dp[10][10001]; long long int factorial(int x) { long long int ret = 1; for (int i = 1; i <= x; i++) ret *= i; return ret; } int main() { do { int sum = 0; for (int i = 0; i...
replace
24
25
24
25
TLE
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; const int N_MAX = 10; const int S_MAX = 330; int results[N_MAX + 1][S_MAX + 1]; bool used[10 + 1]; int i; void permutations(int p, int sum) { if (p == 0) { results[i][sum]++; } else { for (int i = 0; i < 10; i++) { if (used[i]) conti...
#include <cstring> #include <iostream> using namespace std; const int N_MAX = 10; const int S_MAX = 330; int results[N_MAX + 1][S_MAX + 1]; bool used[10 + 1]; int i; void permutations(int p, int sum) { if (p == 0) { results[i][sum]++; } else { for (int i = 0; i < 10; i++) { if (used[i]) conti...
replace
30
31
30
34
0
p00070
C++
Runtime Error
// 23 #include <iostream> #include <map> using namespace std; int m[11][1000]; void calc(int p, int d, int u) { if (d <= 10) { for (int i = 0; i <= 9; i++) { if (!(u & 1 << i)) { int cs = p + i * d; m[d][cs]++; calc(cs, d + 1, u | 1 << i); } } } } int main() { calc(...
// 23 #include <iostream> #include <map> using namespace std; int m[11][1000]; void calc(int p, int d, int u) { if (d <= 10) { for (int i = 0; i <= 9; i++) { if (!(u & 1 << i)) { int cs = p + i * d; m[d][cs]++; calc(cs, d + 1, u | 1 << i); } } } } int main() { calc(...
replace
23
24
23
24
0
p00070
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using name...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using name...
insert
47
47
47
49
TLE
p00070
C++
Runtime Error
// AOJ 0070 #include <algorithm> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int integer; const integer NMAX = 11, SMAX = 1000; integer dp[NMAX][SMAX], factorial[NMAX]; void solve() { factorial[0] = 1; for (int i = 1; i <= 10; i++) { factoria...
// AOJ 0070 #include <algorithm> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int integer; const integer NMAX = 20, SMAX = 1000; integer dp[NMAX][SMAX], factorial[NMAX]; void solve() { factorial[0] = 1; for (int i = 1; i <= 10; i++) { factoria...
replace
7
8
7
8
0
p00070
C++
Runtime Error
#include <iostream> using namespace std; int bit_one(int b) { int r = 0; while (b) { r += b % 2; b >>= 1; } return r; } int dp[400][1 << 10]; void set() { for (int i = 0; i < 300; i++) { for (int j = 0; j < (1 << 10); j++) { dp[i][j] = 0; } } dp[0][0] = 1; for (int i = 0; i < 30...
#include <iostream> using namespace std; int bit_one(int b) { int r = 0; while (b) { r += b % 2; b >>= 1; } return r; } int dp[400][1 << 10]; void set() { for (int i = 0; i < 300; i++) { for (int j = 0; j < (1 << 10); j++) { dp[i][j] = 0; } } dp[0][0] = 1; for (int i = 0; i < 30...
insert
36
36
36
40
0
p00070
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(5) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; typ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(5) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; typ...
replace
26
27
26
27
MLE
p00070
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(5) typedef vector<int> vi; typedef vector<string> vs; typedef pair<short, short> P;...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(5) typedef vector<int> vi; typedef vector<string> vs; typedef pair<short, short> P;...
replace
26
27
26
27
MLE
p00070
C++
Time Limit Exceeded
#define _USE_MATH_DEFINES #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory...
#define _USE_MATH_DEFINES #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory...
replace
33
34
33
35
TLE
p00070
C++
Runtime Error
#include <iostream> #define INF 99999999 using namespace std; int n, s, cnt; int dp[(1 << 10) + 1][1000][11]; int rec(int S, int sum, int cnt) { if (sum < 0 || cnt < 0) return 0; if (dp[S][sum][cnt] != INF) return dp[S][sum][cnt]; if (cnt == 0) { if (sum == 0) return 1; else return ...
#include <iostream> #define INF 99999999 using namespace std; int n, s, cnt; int dp[(1 << 10) + 1][1000][11]; int rec(int S, int sum, int cnt) { if (sum < 0 || sum > 1000 || cnt < 0 || cnt > 10) return 0; if (dp[S][sum][cnt] != INF) return dp[S][sum][cnt]; if (cnt == 0) { if (sum == 0) return...
replace
8
9
8
9
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9696]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9697]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
replace
8
9
8
9
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9690]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9699]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
replace
8
9
8
9
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9600]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9700]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
replace
8
9
8
9
0
p00070
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][9000]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0; ...
#include <cstring> #include <iostream> using namespace std; // http://d.hatena.ne.jp/Nekonyan/20110508 // Nekonyanツつウツづアツづ個コツーツドツづーツ参ツ考ツづ可つオツづ慊つオツつスツ。 int table[10 + 1][10000]; int memo[10]; void numnum(int size, int depth, int sum) { if (size + 1 == depth) { table[size][sum]++; } else { for (int i = 0;...
replace
8
9
8
9
0
p00070
C++
Runtime Error
#include <cstdio> using namespace std; int ans[11][410]; void dfs(int dpt, int sum, int bit) { ++ans[dpt][sum]; for (int i = 0; i < 10; ++i) { if (bit >> i & 1) { dfs(dpt + 1, sum + i * (dpt + 1), bit ^ (1 << i)); } } } int main() { dfs(0, 0, 0x3ff); int n, s; while (scanf("%d%d", &n, &s) !...
#include <cstdio> using namespace std; int ans[11][410]; void dfs(int dpt, int sum, int bit) { ++ans[dpt][sum]; for (int i = 0; i < 10; ++i) { if (bit >> i & 1) { dfs(dpt + 1, sum + i * (dpt + 1), bit ^ (1 << i)); } } } int main() { dfs(0, 0, 0x3ff); int n, s; while (scanf("%d%d", &n, &s) !...
delete
19
20
19
19
0
p00070
C++
Runtime Error
#include <bits/stdc++.h> #define range(i, a, n) for (int(i) = (a); (i) < (n); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int n, s; vector<int> used(10); int memo[11][1000]; int sum; void dfs(int d) { memo[d][sum]++; if (d == 10) return; rep(i, 10) { if (used[i]) ...
#include <bits/stdc++.h> #define range(i, a, n) for (int(i) = (a); (i) < (n); (i)++) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; int n, s; vector<int> used(10); int memo[11][1000]; int sum; void dfs(int d) { memo[d][sum]++; if (d == 10) return; rep(i, 10) { if (used[i]) ...
replace
30
31
30
34
0
p00070
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, s, dp[12][331][1030]; int solve(int now, int sum, int a) { int ans = 0; if (dp[now][sum][a] != -1) return dp[now][sum][a]; if (sum > s) return dp[now][sum][a] = 0; if (now == n + 1) { if (sum == s) return dp...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, s, dp[12][331][1030]; int solve(int now, int sum, int a) { int ans = 0; if (dp[now][sum][a] != -1) return dp[now][sum][a]; if (sum > s) return dp[now][sum][a] = 0; if (now == n + 1) { if (sum == s) return dp...
replace
25
28
25
28
0
p00070
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int dp[10][331][2048]; int main() { dp[0][0][0] = 1; for (int i = 0; i < 10; i++) { for (int j = 0; j <= 330; j++) { for (int k = 0; k < 2048; k++) { if (dp[i][j][k]) { for (int l = 0; l <= 9; l++) { if ((~k) & (1 << l)) { ...
#include <bits/stdc++.h> using namespace std; int dp[20][500][2048]; int main() { dp[0][0][0] = 1; for (int i = 0; i < 10; i++) { for (int j = 0; j <= 330; j++) { for (int k = 0; k < 2048; k++) { if (dp[i][j][k]) { for (int l = 0; l <= 9; l++) { if ((~k) & (1 << l)) { ...
replace
3
4
3
4
-11
p00070
C++
Runtime Error
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define r...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define r...
insert
45
45
45
47
0
p00070
C++
Runtime Error
#include <bits/stdc++.h> #define SIZE 300005 #define MOD 1000000007LL #define INF 1 << 30 #define LLINF 1LL << 60 #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = a; i <= b; i++) #define DOWN(i, b, a) for (int i = b; i >= a; i--) #define SET(a, c) memset(a, c, sizeof a) #define FORALL(i, ...
#include <bits/stdc++.h> #define SIZE 300005 #define MOD 1000000007LL #define INF 1 << 30 #define LLINF 1LL << 60 #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = a; i <= b; i++) #define DOWN(i, b, a) for (int i = b; i >= a; i--) #define SET(a, c) memset(a, c, sizeof a) #define FORALL(i, ...
replace
58
59
58
59
0
p00070
C++
Time Limit Exceeded
#include <iostream> void solve(const int &sum, const int &s, int limit, long long int &cnt, const int &used) { int tmp; int est_sum; for (int i = 0; i < 10; ++i) { if ((used & (1 << i)) == 0) { tmp = i * limit + sum; if (limit > 1) { est_sum = 9 * (limit - 1) * (limit - 1); ...
#include <iostream> void solve(const int &sum, const int &s, int limit, long long int &cnt, const int &used) { int tmp; int est_sum; for (int i = 0; i < 10; ++i) { if ((used & (1 << i)) == 0) { tmp = i * limit + sum; if (limit > 1) { est_sum = 9 * (limit - 1) * (limit - 1); ...
insert
19
19
19
21
TLE
p00070
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int table[10][10001]; int perm[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int factorial(int n) { if (n == 1) return 1; return n * factorial(n - 1); } int main() { do { int sum = 0; for (int i = 1; i <= 10; i++) { sum += i * perm[i - 1];...
#include <algorithm> #include <iostream> using namespace std; int table[10][10001]; int perm[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int factorial(int n) { int ret = 1; for (int i = 1; i <= n; i++) ret *= i; return ret; } int main() { do { int sum = 0; for (int i = 1; i <= 10; i++) { sum += i...
replace
8
11
8
12
TLE
p00070
C++
Runtime Error
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) #define FOR(i, j, k) for (int i = j; i < k; i++) const int INF = ...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) #define FOR(i, j, k) for (int i = j; i < k; i++) const int INF = ...
replace
50
51
50
51
0
p00070
C++
Runtime Error
#include <iostream> #include <string.h> using namespace std; int m[11][1024]; int n, s; void dfs(int b, int d, int s) { m[d][s]++; for (int i = 0; i < 10; i++) if ((b >> i) & 1) dfs(b - (1 << i), d + 1, s + (1 + d) * i); } int main() { memset(m, 0, sizeof(m)); dfs(1023, 0, 0); while (cin >> n >> s...
#include <iostream> #include <string.h> using namespace std; int m[21][11024]; int n, s; void dfs(int b, int d, int s) { m[d][s]++; for (int i = 0; i < 10; i++) if ((b >> i) & 1) dfs(b - (1 << i), d + 1, s + (1 + d) * i); } int main() { memset(m, 0, sizeof(m)); dfs(1023, 0, 0); while (cin >> n >> ...
replace
4
5
4
5
0
p00070
C++
Runtime Error
#include <iostream> #include <string.h> using namespace std; int memo[11][400]; void recursive(int depth, int sum, bool flag[10]) { ++memo[depth][sum]; for (int i = 0; i < 10; ++i) { if (flag[i]) { continue; } flag[i] = true; recursive(depth + 1, sum + (depth + 1) * i, flag); flag[i] = f...
#include <iostream> #include <string.h> using namespace std; int memo[11][400]; void recursive(int depth, int sum, bool flag[10]) { ++memo[depth][sum]; for (int i = 0; i < 10; ++i) { if (flag[i]) { continue; } flag[i] = true; recursive(depth + 1, sum + (depth + 1) * i, flag); flag[i] = f...
replace
24
25
24
29
0
p00070
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int a[10][331] = {0}; int p[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int q[10] = {362880, 40320, 5040, 720, 120, 24, 6, 2, 1}; int s, n; do { s = 0; for (int i = 0; i < 10; ++i) { s += (i + 1) * p[i]; a[i][s]++; }...
#include <algorithm> #include <iostream> using namespace std; int main() { int a[10][331] = {0}; int p[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int q[10] = {362880, 40320, 5040, 720, 120, 24, 6, 2, 1, 1}; int s, n; do { s = 0; for (int i = 0; i < 10; ++i) { s += (i + 1) * p[i]; a[i][s]++; ...
replace
7
8
7
8
0