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
p00170
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
insert
69
69
69
71
TLE
p00170
C++
Time Limit Exceeded
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
replace
98
99
98
99
TLE
p00170
C++
Time Limit Exceeded
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef...
insert
58
58
58
62
TLE
p00173
C++
Runtime Error
#include <cstdio> int main() { char n[32]; int m, a; for (int i = 0; i < 9; i++) { scanf("%s%d%d", n, &m, &a); printf("%s %d %d\n", m + a, m * 200 + a * 300); } return 0; }
#include <cstdio> int main() { char n[32]; int m, a; for (int i = 0; i < 9; i++) { scanf("%s%d%d", n, &m, &a); printf("%s %d %d\n", n, m + a, m * 200 + a * 300); } return 0; }
replace
7
8
7
8
-11
p00173
C++
Runtime Error
#include <stdio.h> int main(void) { char a; int s, z, i, f, g; while (scanf("%s %d %d", &a, &s, &z) != EOF) { f = s + z; g = (s * 200) + (z * 300); printf("%c %d %d\n", a, f, g); s = 0; z = 0; f = 0; g = 0; } return 0; }
#include <stdio.h> int main(void) { int a, s, d, f[10], h[10], i, j; char g[16][10]; for (i = 1; i <= 9; i++) { scanf("%s %d %d", g[i], &s, &d); f[i] = s * 200 + d * 300; h[i] = s + d; printf("%s %d %d\n", g[i], h[i], f[i]); } return 0; }
replace
2
12
2
9
0
p00174
C++
Runtime Error
#include <stdio.h> #include <string.h> int main() { char ss[40]; int i, j, a, b; while (~scanf(" %s ", ss)) { if (ss[0] == '0') break; i = 1; a = 0; b = 0; while (1) { if (ss[i] == '\0') break; if (ss[i] == 'A') ++a; if (ss[i] == 'B') ++b; ...
#include <stdio.h> #include <string.h> int main() { char ss[110]; int i, j, a, b; while (~scanf(" %s ", ss)) { if (ss[0] == '0') break; i = 1; a = 0; b = 0; while (1) { if (ss[i] == '\0') break; if (ss[i] == 'A') ++a; if (ss[i] == 'B') ++b; ...
replace
4
5
4
5
0
p00174
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { string s; int a, b; while (true) { for (int i = 0; i < 3; i++) { a = b = 0; cin >> s; if (s[0] == '0') break; for (int j = 1; j < s.length(); j++) { if (s[j] == 'A') a++; else b++; ...
#include <iostream> using namespace std; int main() { string s; int a, b; while (true) { for (int i = 0; i < 3; i++) { a = b = 0; cin >> s; if (s[0] == '0') return 0; for (int j = 1; j < s.length(); j++) { if (s[j] == 'A') a++; else b++; ...
replace
11
12
11
12
TLE
p00175
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main(void) { int i, j, k, cnt = 1, flg; int n; int fo[10] = {1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144}; while (1) { cin >> n; flg = 0; if (n == -1) break; for (i = 10; i >= 0; i--) { if (n == 0 && flg == 0) { cout <...
#include <bits/stdc++.h> using namespace std; int main(void) { int i, j, k, cnt = 1, flg; int n; int fo[10] = {1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144}; while (1) { cin >> n; flg = 0; if (n == -1) break; for (i = 9; i >= 0; i--) { if (n == 0 && flg == 0) { cout <<...
replace
11
12
11
12
0
p00175
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int a[100]; int n; int index; while (1) { scanf("%d", &n); if (n == -1) break; index = 0; do { a[index++] = (n & 0x3); n >> 2; } while (n != 0); index--; while (index >= 0) { printf("%d", a[index--]); } puts("");...
#include <stdio.h> int main(void) { int a[100]; int n; int index; while (1) { scanf("%d", &n); if (n == -1) break; index = 0; do { a[index++] = (n & 0x3); n >>= 2; } while (n != 0); index--; while (index >= 0) { printf("%d", a[index--]); } puts("")...
replace
14
15
14
15
TLE
p00178
C++
Runtime Error
#include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) #define MH 100 using namespace std; bool ck(int *f) { rep(i, 5) if (!f[i]) return 0; return 1; } int main() { int n; while (cin >> n, n) { int d, l, x, y, c = 0; int field[MH][5] = {0}; rep(i, n) { cin >> d >> l >> x, y = MH, x-...
#include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) #define MH 5000 using namespace std; bool ck(int *f) { rep(i, 5) if (!f[i]) return 0; return 1; } int main() { int n; while (cin >> n, n) { int d, l, x, y, c = 0; int field[MH][5] = {0}; rep(i, n) { cin >> d >> l >> x, y = MH, x...
replace
2
3
2
3
0
p00178
C++
Runtime Error
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
replace
59
60
59
60
0
p00179
C++
Time Limit Exceeded
#include <iostream> #include <queue> #include <string> using namespace std; queue<int> q; int t[59049]; int INF = 100000; int encode(vector<int> vc) { int p = 0; for (int i = 0; i < vc.size(); i++) { p = p * 3 + vc[i]; } return p; } vector<int> decode(int p, int n) { vector<int> vc(n); for (int i = 0; i...
#include <iostream> #include <queue> #include <string> using namespace std; queue<int> q; int t[59049]; int INF = 100000; int encode(vector<int> vc) { int p = 0; for (int i = 0; i < vc.size(); i++) { p = p * 3 + vc[i]; } return p; } vector<int> decode(int p, int n) { vector<int> vc(n); for (int i = 0; i...
insert
28
28
28
30
TLE
p00179
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> using namespace std; class Data { public: string bc; int t; Data(string bc, int t) : bc(bc), t(t) {} Data() {} }; bool judge(string s, int l) { for (int i = 0; i < l - 1; ++i) { if (s[i] != s[i + 1]) return fa...
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <string> using namespace std; class Data { public: string bc; int t; Data(string bc, int t) : bc(bc), t(t) {} Data() {} }; bool judge(string s, int l) { for (int i = 0; i < l - 1; ++i) { if (s[i] != s[i + 1]) return fa...
replace
37
38
37
38
TLE
p00179
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef pair<string, int> P; //???????????????????????????????????? bool judge(string str) { for (int i = 0; i < str.size(); ++i) { if (str[0] != str[i]) return false; } return true; } //??£?????????2?????????????????§????????????????????? char color(cha...
#include <bits/stdc++.h> using namespace std; typedef pair<string, int> P; //???????????????????????????????????? bool judge(string str) { for (int i = 0; i < str.size(); ++i) { if (str[0] != str[i]) return false; } return true; } //??£?????????2?????????????????§????????????????????? char color(cha...
insert
39
39
39
40
MLE
p00179
C++
Time Limit Exceeded
#include <stdio.h> #include <stdlib.h> #include <string.h> #define QUEUE_NUM (10192) struct Data { char color[15]; int cnt; }; typedef struct { int top, bottom; Data data[QUEUE_NUM]; } Queue; // Q‚Édata‚ð’ljÁ void push(Queue *Q, Data data) { Q->data[Q->bottom] = data; Q->bottom = (Q->bottom + 1); } // ...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define QUEUE_NUM (20386) struct Data { char color[15]; int cnt; }; typedef struct { int top, bottom; Data data[QUEUE_NUM]; } Queue; // Q‚Édata‚ð’ljÁ void push(Queue *Q, Data data) { Q->data[Q->bottom] = data; Q->bottom = (Q->bottom + 1); } // ...
replace
4
5
4
5
TLE
p00180
C++
Runtime Error
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int n, m; vector<set<pair<int, int>>> cost(100, set<pair<int, int>>()); int prim() { int res = 0; set<int> v; v.insert(0); while (v.size() < n) { pair<int, int> mini(100000007, -1); for (set<int>::iterator ...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int n, m; vector<set<pair<int, int>>> cost(200, set<pair<int, int>>()); int prim() { int res = 0; set<int> v; v.insert(0); while (v.size() < n) { pair<int, int> mini(100000007, -1); for (set<int>::iterator ...
replace
8
9
8
9
0
p00180
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> using namespace std; // disjoint-set int parent[100]; void init(int n) { for (int i = 0; i < n; i++) parent[i] = i; } int root(int a) { if (parent[a] == a) return a; return (parent[a] = root(parent[a])); } bool same_set_p(int a, int b) { return root(a) == root(b...
#include <algorithm> #include <cstdio> using namespace std; // disjoint-set int parent[100]; void init(int n) { for (int i = 0; i < n; i++) parent[i] = i; } int root(int a) { if (parent[a] == a) return a; return (parent[a] = root(parent[a])); } bool same_set_p(int a, int b) { return root(a) == root(b...
replace
33
34
33
34
TLE
p00180
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; struct Dset { Dset *parent; int rank; Dset() { clear(); } void clear() { parent = NULL; rank = 0; } Dset *find() { if (!parent) { return this; } else { parent = parent->find(); return parent; } } boo...
#include <algorithm> #include <iostream> using namespace std; struct Dset { Dset *parent; int rank; Dset() { clear(); } void clear() { parent = NULL; rank = 0; } Dset *find() { if (!parent) { return this; } else { parent = parent->find(); return parent; } } boo...
replace
61
62
61
62
0
p00180
C++
Runtime Error
// kruskal tree #include <algorithm> #include <iostream> using namespace std; #define M 101 int parent[M], a[M], b[M]; pair<int, int> node[M]; int root(int a) { if (parent[a] == a) return a; return parent[a] = root(parent[a]); } int unite(int a, int b) { if (root(a) == root(b)) return 0; parent[root(a)]...
// kruskal tree #include <algorithm> #include <iostream> using namespace std; #define M 9999 int parent[M], a[M], b[M]; pair<int, int> node[M]; int root(int a) { if (parent[a] == a) return a; return parent[a] = root(parent[a]); } int unite(int a, int b) { if (root(a) == root(b)) return 0; parent[root(a)...
replace
4
5
4
5
0
p00180
C++
Time Limit Exceeded
#include <climits> #include <iostream> #include <vector> using namespace std; int main() { int br[100][100]; bool f[100]; int tr[100]; int n, m; while (1) { cin >> n >> m; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) br[i][j] = -1; tr[i] = INT_MAX; f[i] = 0; ...
#include <climits> #include <iostream> #include <vector> using namespace std; int main() { int br[100][100]; bool f[100]; int tr[100]; int n, m; while (1) { cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) br[i][j] = -1; ...
insert
13
13
13
15
TLE
p00180
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; const int inf = 999999; int prim(int a[101][101], int n) { int r = 0, mcost[101]; bool vis[101]; fill(mcost, mcost + 101, inf); fill(vis, vis + 101, false); mcost[0] = 0; while (1) { int v = -1; for (int i = 0; i < n; i++) { i...
#include <algorithm> #include <iostream> using namespace std; const int inf = 999999; int prim(int a[101][101], int n) { int r = 0, mcost[101]; bool vis[101]; fill(mcost, mcost + 101, inf); fill(vis, vis + 101, false); mcost[0] = 0; while (1) { int v = -1; for (int i = 0; i < n; i++) { i...
replace
47
48
47
48
-6
*** stack smashing detected ***: terminated
p00181
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <numeric> #include <string.h> #define INT_INF 2000000 int m, n; int a[100 + 1]; int memo[20 + 1][100 + 1]; int search(int i, int j) { if (memo[i][j] >= 0) return memo[i][j]; if (i == 1) return memo[i][j] = std::accumulate(a + j, a + n, 0); int am =...
#include <algorithm> #include <iostream> #include <numeric> #include <string.h> #define INT_INF 2000000 int m, n; int a[100 + 1]; int memo[20 + 1][100 + 1]; int search(int i, int j) { if (memo[i][j] >= 0) return memo[i][j]; if (i == 1) return memo[i][j] = std::accumulate(a + j, a + n, 0); int am =...
replace
23
25
23
25
TLE
p00181
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> using namespace std; int n, m; int hon[101]; int nibun() { int R, L; R = L = 0; for (int i = 0; i < m; i++) { L += hon[i]; } while (1) { if (R == L) { return R; } double H = (double)(R + L) / 2; int dan = 0; int at = 0; for (int i = 0...
#include <algorithm> #include <cstdio> using namespace std; int n, m; int hon[101]; int nibun() { int R, L; R = L = 0; for (int i = 0; i < m; i++) { L += hon[i]; } while (1) { if (R == L) { return R; } double H = (double)(R + L) / 2; int dan = 0; int at = 0; for (int i = 0...
insert
46
46
46
49
TLE
p00181
C++
Time Limit Exceeded
#include <iostream> using namespace std; int m, n, w[100]; int calc(int t) { int sum = 0, ret = 1; for (int i = 0; i < n; i++) { if (w[i] > t) return 1500001; if (sum + w[i] > t) { sum = 0; ret++; } sum += w[i]; } return ret; } int main() { while (1) { cin >> m >> n; ...
#include <iostream> using namespace std; int m, n, w[100]; int calc(int t) { int sum = 0, ret = 1; for (int i = 0; i < n; i++) { if (w[i] > t) return 1500001; if (sum + w[i] > t) { sum = 0; ret++; } sum += w[i]; } return ret; } int main() { while (1) { cin >> m >> n; ...
insert
23
23
23
25
TLE
p00181
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
#include <bits/stdc++.h> using namespace std; #define int long long typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define all(v) (v).begin(), (v).end() #define each(it, v) ...
replace
45
46
45
46
TLE
p00182
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; bool dfs(int i); int n, a[50]; bool fil[50]; bool dfs2(int i, int j, int rem) { if (rem == 0) return dfs(i + 1); if (j == n) return false; if (!fil[j] && a[j] <= rem) { fil[j] = true; if (dfs2(i, j + 1...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; bool dfs(int i); int n, a[50]; bool fil[50]; bool dfs2(int i, int j, int rem) { if (rem == 0) return dfs(i + 1); if (j == n) return false; if (!fil[j] && a[j] <= rem) { fil[j] = true; if (dfs2(i, j + 1...
replace
34
35
34
35
-11
p00182
C++
Time Limit Exceeded
#include <algorithm> #include <stdio.h> using namespace std; int c[60]; int v[60]; int u[60]; int n; int solve(int a, int b) { if (b == 0) { bool ok = true; for (int i = 0; i < n; i++) if (!u[i]) { ok = false; break; } if (ok) return 1; int at = 0; for (int i = 0;...
#include <algorithm> #include <stdio.h> using namespace std; int c[60]; int v[60]; int u[60]; int n; int solve(int a, int b) { if (b == 0) { bool ok = true; for (int i = 0; i < n; i++) if (!u[i]) { ok = false; break; } if (ok) return 1; int at = 0; for (int i = 0;...
insert
26
26
26
28
TLE
p00182
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <set> using namespace std; typedef long long ll; int n; int lim[52], vol[52]; set<ll> no[52]; bool solve(int idx); bool distribute(int idx, int next) { if (idx == n) { return false; } ll bit = 0; for (int i = idx; i < n; i++) { bit <<= 1; if (v...
#include <algorithm> #include <iostream> #include <set> using namespace std; typedef long long ll; int n; int lim[52], vol[52]; set<ll> no[52]; bool solve(int idx); bool distribute(int idx, int next) { if (idx == n) { return false; } ll bit = 0; for (int i = idx; i < n; i++) { bit <<= 1; if (v...
insert
36
36
36
38
TLE
p00182
C++
Memory Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define F...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define F...
insert
36
36
36
42
MLE
p00182
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; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
replace
26
27
26
28
TLE
p00184
C++
Runtime Error
#include <iostream> using namespace std; int judge(int); int main() { int n, age; for (;;) { int cnt[7] = {0}; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> age; cnt[judge(age)]++; } for (int i = 0; i < 7; i++) cout << cnt[i] << endl; } r...
#include <iostream> using namespace std; int judge(int); int main() { int n, age; for (;;) { int cnt[7] = {0}; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> age; cnt[judge(age)]++; } for (int i = 0; i < 7; i++) cout << cnt[i] << endl; } r...
replace
26
27
26
27
0
p00185
C++
Runtime Error
#define SIZE 100001 #include <iostream> using namespace std; int main() { int a, d, n; bool prime[SIZE]; for (int i = 0; i < SIZE; i++) { prime[i] = 1; } prime[0] = prime[1] = 0; for (int i = 2; i < SIZE; i++) { if (prime[i]) { for (int j = 2; j * i < SIZE; j++) { prime[j * i] = 0; ...
#define SIZE 1000001 #include <iostream> using namespace std; int main() { int a, d, n; bool prime[SIZE]; for (int i = 0; i < SIZE; i++) { prime[i] = 1; } prime[0] = prime[1] = 0; for (int i = 2; i < SIZE; i++) { if (prime[i]) { for (int j = 2; j * i < SIZE; j++) { prime[j * i] = 0;...
replace
0
1
0
1
0
p00185
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { bool prime[1000001] = {true, true}; vector<int> ps; for (int i = 4; i <= 1000000; i += 2) prime[i] = true; for (int i = 3; i * i <= 1000000; i += 2) { for (int j = i * 2; j <= 1000000; j += i) prime[j] = ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { bool prime[1000001] = {true, true}; vector<int> ps; for (int i = 4; i <= 1000000; i += 2) prime[i] = true; for (int i = 3; i * i <= 1000000; i += 2) { for (int j = i * 2; j <= 1000000; j += i) prime[j] = ...
replace
23
24
23
25
TLE
p00185
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
replace
58
67
58
60
TLE
p00185
C++
Runtime Error
#include <iostream> using namespace std; #define MAX 50100 int prime[MAX - 4]; void is_prime() { for (int i = 0; i < MAX; i++) prime[i] = 0; prime[0] = prime[1] = 1; for (int i = 4; i < MAX; i += 2) prime[i] = 1; for (int i = 3; i * i < MAX; i++) { if (prime[i]) continue; for (int j = i...
#include <iostream> using namespace std; #define MAX 1000100 int prime[MAX - 4]; void is_prime() { for (int i = 0; i < MAX; i++) prime[i] = 0; prime[0] = prime[1] = 1; for (int i = 4; i < MAX; i += 2) prime[i] = 1; for (int i = 3; i * i < MAX; i++) { if (prime[i]) continue; for (int j =...
replace
2
3
2
3
-11
p00185
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #include <vector> using namespace std; int p[5000000]; bool prime(int x) { if (x == 2) return false; if (x < 1 || x % 2 == 0) return false; int i = 3; while (i <= sqrt(x)) { if (x % i == 0) return false; i += 2; } return true; } int main() { ...
#include <cmath> #include <iostream> #include <vector> using namespace std; int p[5000000]; bool prime(int x) { if (x == 2) return false; if (x < 1 || x % 2 == 0) return false; int i = 3; while (i <= sqrt(x)) { if (x % i == 0) return false; i += 2; } return true; } int main() { ...
replace
35
43
35
38
TLE
p00185
C++
Runtime Error
#include <iostream> using namespace std; #define MN 500001 bool pr[MN] = {0}; int main() { for (int i = 2; i < MN; i++) { pr[i] = 1; } for (int i = 2; i * i < MN; i++) { if (pr[i]) for (int j = i * 2; j < MN; j += i) { pr[j] = 0; } } int n, c; while (cin >> n, n) { c = 0; ...
#include <iostream> using namespace std; #define MN 1000001 bool pr[MN] = {0}; int main() { for (int i = 2; i < MN; i++) { pr[i] = 1; } for (int i = 2; i * i < MN; i++) { if (pr[i]) for (int j = i * 2; j < MN; j += i) { pr[j] = 0; } } int n, c; while (cin >> n, n) { c = 0;...
replace
3
4
3
4
0
p00185
C++
Runtime Error
/*1000000ˆÈ‰º‚Ì‘f”‚Å“ü—Í‚µ‚½nˆÈ‰º‚̍őå‚Ì‘f”‚ðo—Í‚·‚éƒvƒƒOƒ‰ƒ€*/ #include <iostream> const int MAX = 1000001; const int P_NUM = 78498; using namespace std; bool p[MAX]; int a[79000] = {}; void f() { for (int i = 0; i < MAX; i++) { p[i] = (i <= 1) ? false : true; } for (int i = 2; i * i <= MAX + 1; i++) ...
/*1000000ˆÈ‰º‚Ì‘f”‚Å“ü—Í‚µ‚½nˆÈ‰º‚̍őå‚Ì‘f”‚ðo—Í‚·‚éƒvƒƒOƒ‰ƒ€*/ #include <iostream> const int MAX = 1000001; const int P_NUM = 78498; using namespace std; bool p[MAX]; int a[79000] = {}; void f() { for (int i = 0; i < MAX; i++) { p[i] = (i <= 1) ? false : true; } for (int i = 2; i * i <= MAX + 1; i++) ...
replace
33
51
33
36
0
p00185
C++
Time Limit Exceeded
#include <iostream> using namespace std; int prime[200]; int main() { int count = 0; for (int i = 3; i < 1000; i += 2) { bool t = true; for (int j = 0; j < count; j++) if (i % prime[j] == 0) t = false; if (t == true) { prime[count] = i; count++; } } int n; while (true...
#include <iostream> using namespace std; int prime[200]; int main() { int count = 0; for (int i = 3; i < 1000; i += 2) { bool t = true; for (int j = 0; j < count; j++) if (i % prime[j] == 0) t = false; if (t == true) { prime[count] = i; count++; } } int n; while (true...
insert
18
18
18
20
TLE
p00185
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define PB push_back #define INF INT_MAX / 3 #define ALL(a) (a).begin(), (a).end() #...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define PB push_back #define INF INT_MAX / 3 #define ALL(a) (a).begin(), (a).end() #...
replace
18
19
18
19
TLE
p00186
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> using namespace std; void failed() { cout << "NA" << endl; } int main() { int Q1, B, C1, C2, Q2; while (cin >> Q1) { if (Q1 == 0) break; cin >> B >> C1 >> C2 >> Q2; assert(Q2 >= 1); /* if(B/C1 == 0) { ...
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> using namespace std; void failed() { cout << "NA" << endl; } int main() { int Q1, B, C1, C2, Q2; while (cin >> Q1) { if (Q1 == 0) break; cin >> B >> C1 >> C2 >> Q2; assert(Q2 >= 0); /* if(B/C1 == 0) { ...
replace
20
21
20
21
0
p00186
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> #include <sstream> using namespace std; void failed() { cout << "NA" << endl; } int main() { int Q1, B, C1, C2, Q2; while (cin >> Q1) { if (Q1 == 0) break; cin >> B >> C1 >> C2 >> Q2; stringstream ss; ss << "Q...
#include <algorithm> #include <cassert> #include <cmath> #include <iostream> #include <sstream> using namespace std; void failed() { cout << "NA" << endl; } int main() { int Q1, B, C1, C2, Q2; while (cin >> Q1) { if (Q1 == 0) break; cin >> B >> C1 >> C2 >> Q2; assert(Q2 >= 0); /* ...
replace
21
26
21
22
0
p00186
C++
Time Limit Exceeded
#include <cstdio> int q1, b, c1, c2, q2; int main() { while (scanf("%d", &q1)) { if (q1 == 0) break; scanf("%d%d%d%d", &b, &c1, &c2, &q2); int jidori = b / c1; jidori = (jidori < q2 ? jidori : q2); b -= jidori * c1; int normal = b / c2; b -= normal * c2; while (jidori + normal < ...
#include <cstdio> int q1, b, c1, c2, q2; int main() { while (scanf("%d", &q1)) { if (q1 == 0) break; scanf("%d%d%d%d", &b, &c1, &c2, &q2); int jidori = b / c1; jidori = (jidori < q2 ? jidori : q2); b -= jidori * c1; int normal = b / c2; b -= normal * c2; while (jidori + normal < ...
insert
13
13
13
15
TLE
p00188
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack...
replace
60
61
60
61
TLE
p00188
C++
Time Limit Exceeded
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <ss...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <ss...
insert
54
54
54
56
TLE
p00188
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<long long int> data(n); int left = 0; int right = n - 1; for (int i = 0; i < n; i++) { cin >> data[i]; } int counter = 0; int tansa; c...
#include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<long long int> data(n); int left = 0; int right = n - 1; for (int i = 0; i < n; i++) { cin >> data[i]; } int counter = 0; int tansa; c...
insert
33
33
33
36
TLE
p00188
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int hi, lo, m, n, a, i, k, d[100]; while (cin >> n && n != 0) { for (i = 0; i < n; i++) cin >> d[i]; cin >> a; hi = n - 1; lo = k = 0; while (true) { k++; m = (hi + lo) / 2; if (d[m] < a) lo = m + 1; els...
#include <iostream> using namespace std; int main() { int hi, lo, m, n, a, i, k, d[100]; while (cin >> n && n != 0) { for (i = 0; i < n; i++) cin >> d[i]; cin >> a; hi = n - 1; lo = k = 0; while (hi >= lo) { k++; m = (hi + lo) / 2; if (d[m] < a) lo = m + 1; ...
replace
11
12
11
12
TLE
p00188
C++
Time Limit Exceeded
#include <iostream> #include <vector> std::vector<int> v; int main() { int n; while (std::cin >> n, n) { v.clear(); for (int i = 0; i != n; ++i) { int a; std::cin >> a; v.push_back(a); } int b; std::cin >> b; int ans = 0; int l = 0, r = v.size() - 1; while (l <...
#include <iostream> #include <vector> std::vector<int> v; int main() { int n; while (std::cin >> n, n) { v.clear(); for (int i = 0; i != n; ++i) { int a; std::cin >> a; v.push_back(a); } int b; std::cin >> b; int ans = 0; int l = 0, r = v.size() - 1; while (l <...
insert
33
33
33
35
TLE
p00188
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <sstream> #include <vector> using namespace std; int a[100000]; int lef; int rig; int ans; bool binary_search_2(int num) { if (lef == rig) { ans++; return false; } int middle = (lef + rig) / 2; ans+...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <sstream> #include <vector> using namespace std; int a[100000]; int lef; int rig; int ans; bool binary_search_2(int num) { if (lef > rig) { return false; } int middle = (lef + rig) / 2; ans++; if (a[m...
replace
17
19
17
18
TLE
p00188
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int a[100], k; for (int i = 0; i < n; i++) cin >> a[i]; cin >> k; int low = 0, up = n - 1, cnt = 0; while (1) { cnt++; if (up == low) break; int mid = (up + low) / 2; if (a[m...
#include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int a[100], k; for (int i = 0; i < n; i++) cin >> a[i]; cin >> k; int low = 0, up = n - 1, cnt = 0; while (1) { cnt++; if (up == low) break; int mid = (up + low) / 2; if (a[m...
insert
22
22
22
24
TLE
p00189
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <stdio.h> #include <string.h> #include <vector> #define N 1000015 #define P pair<int, int> #define ll long long #define mk(a, b) make_pair(a, b) #define mem(a, b) memset(a, b, sizeof(a)) using namespace std; bool vis[10]...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <stdio.h> #include <string.h> #include <vector> #define N 1000015 #define P pair<int, int> #define ll long long #define mk(a, b) make_pair(a, b) #define mem(a, b) memset(a, b, sizeof(a)) using namespace std; bool vis[10]...
replace
48
51
48
49
0
p00189
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define INF (1 << 20) typedef pair<int, int> P; vector<P> edge[10]; int dijkstre(int pos) { int min_cost[10]; fill_n(min_cost, 10, INF); priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, pos)); while (!que.empty()) { P p = que.top(); que.pop();...
#include <bits/stdc++.h> using namespace std; #define INF (1 << 20) typedef pair<int, int> P; vector<P> edge[10]; int dijkstre(int pos) { int min_cost[10]; fill_n(min_cost, 10, INF); priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, pos)); while (!que.empty()) { P p = que.top(); que.pop();...
replace
23
24
23
26
MLE
p00189
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using n...
#include <algorithm> #include <bitset> #include <cctype> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using n...
delete
68
70
68
68
0
70 70
p00189
C++
Runtime Error
#include <bits/stdc++.h> #define SIZE 100005 #define MAX_V 100001 #define INF (1e9 + 1) using namespace std; typedef long long ll; typedef pair<int, int> P; int g[10][10]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i, 10; i++) { for (int j = 0; j < 10; j++) { if (i == j) ...
#include <bits/stdc++.h> #define SIZE 100005 #define MAX_V 100001 #define INF (1e9 + 1) using namespace std; typedef long long ll; typedef pair<int, int> P; int g[10][10]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (i == j) ...
replace
12
13
12
13
-11
p00189
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #define SIZE 100 #define INF 10000000 typedef struct { int data; int pos; } DAT; using namespace std; int main() { DAT ans; int i, j, k; int a, b, c; int n; int time[SIZE][SIZE]; while (1) { int ...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #define SIZE 100 #define INF 10000000 typedef struct { int data; int pos; } DAT; using namespace std; int main() { DAT ans; int i, j, k; int a, b, c; int n; int time[SIZE][SIZE]; while (1) { int ...
insert
28
28
28
30
TLE
p00189
C++
Runtime Error
#include <algorithm> #include <deque> #include <iostream> #include <list> #include <map> #include <memory> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define ALL(g) (g).begin(), (g).end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #defi...
#include <algorithm> #include <deque> #include <iostream> #include <list> #include <map> #include <memory> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define ALL(g) (g).begin(), (g).end() #define REP(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #defi...
replace
39
40
39
40
0
p00189
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; #define MAXV 10 #define INF 100000000 int main() { int n; int v; int a, b, c; int d[MAXV][MAXV]; int sum, ans, ans_i; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++)...
#include <algorithm> #include <iostream> using namespace std; #define MAXV 10 #define INF 100000000 int main() { int n; int v; int a, b, c; int d[MAXV][MAXV]; int sum, ans, ans_i; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i < MAXV; i++) { for (int j = 0; j < MAXV...
replace
21
23
21
23
TLE
p00189
C++
Time Limit Exceeded
#include <iostream> using namespace std; const int INF = 1 << 29; const int N = 10; int main() { int n; while (true) { cin >> n; if (!N) break; int dp[N][N]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dp[i][j] = INF; int a, b, c; while (n--) { cin ...
#include <iostream> using namespace std; const int INF = 1 << 29; const int N = 10; int main() { int n; while (true) { cin >> n; if (!n) break; int dp[N][N]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dp[i][j] = INF; int a, b, c; while (n--) { cin ...
replace
11
12
11
12
TLE
p00190
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <queue> using namespace std; const int SIZE = 13; struct Puzzle { short c[SIZE]; void move(int d, int n) { if (d == 0) moveUp(n); if (d == 1) moveDown(n); if (d == 2) moveLeft(n); if (d == 3) moveRight(n); ...
#include <algorithm> #include <iostream> #include <map> #include <queue> using namespace std; const int SIZE = 13; struct Puzzle { short c[SIZE]; void move(int d, int n) { if (d == 0) moveUp(n); if (d == 1) moveDown(n); if (d == 2) moveLeft(n); if (d == 3) moveRight(n); ...
replace
105
106
105
106
TLE
p00190
C++
Time Limit Exceeded
#include <cstdlib> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int to[13][5] = {{2, -1}, {2, 5, -1}, {0, 1, 3, 6, -1}, {2, 7, -1}, {5, -1}, {1, 4, 6, 9, -1}, ...
#include <cstdlib> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int to[13][5] = {{2, -1}, {2, 5, -1}, {0, 1, 3, 6, -1}, {2, 7, -1}, {5, -1}, {1, 4, 6, 9, -1}, ...
replace
30
31
30
31
TLE
p00190
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define MAX_N 20 #define WIDTH 100 int OK[5][5] = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; int dx[4] = {1, 0, -1,...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define MAX_N 20 #define WIDTH 100 int OK[5][5] = {{0, 0, 1, 0, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}}; int dx[4] = {1, 0, -1,...
replace
82
85
82
85
0
p00191
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <vector> using namespace std; double g[100][100], dp[100][100]; int main() { int n, m; while (scanf("%d%d", &n, &m), n || m) { for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf("%lf", &g[i][j]); fill_n(dp[0], 100, 1.0); fill_n(dp...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; double g[100][100], dp[100][100]; int main() { int n, m; while (scanf("%d%d", &n, &m), n || m) { for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) scanf("%lf", &g[i][j]); fill_n(dp[0], 100, 1.0); fill_n(dp...
replace
9
10
9
10
TLE
p00191
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; double key[100][100]; double table[100][100]; void Init(int n, int m) { for (int i = 0; i < n; i+...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; double key[100][100]; double table[100][100]; void Init(int n, int m) { for (int i = 0; i < n; i+...
replace
26
38
26
29
TLE
p00191
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <vector> using namespace std; int main() { cout << setprecision(2); cout << setiosflags(ios::fixed); int n, m, i, j, k; long double M; while (cin >> n >> m, n | m) { vector<vector<long double>> manure(n, vector<long double>(n)), ...
#include <algorithm> #include <iomanip> #include <iostream> #include <vector> using namespace std; int main() { cout << setprecision(2); cout << setiosflags(ios::fixed); int n, m, i, j, k; long double M; while (cin >> n >> m, n | m) { vector<vector<long double>> manure(n, vector<long double>(n)), ...
replace
28
29
28
29
0
p00192
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int main() { while (true) { int m, n; cin >> m >> n; vector<int> C(n); // ŽÔ for (int i = 0; i < n; i++) cin >> C[i]; vector<int> U(m, -1); // ã vector<int> D(m, -1); // ‰º vector<int> S; // ‡”Ô‘Ò‚¿ vector<int> ...
#include <iostream> #include <vector> using namespace std; int main() { while (true) { int m, n; cin >> m >> n; if (m == 0 && n == 0) break; vector<int> C(n); // ŽÔ for (int i = 0; i < n; i++) cin >> C[i]; vector<int> U(m, -1); // ã vector<int> D(m, -1); // ‰º vector<int>...
insert
8
8
8
10
TLE
p00193
C++
Memory Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; struct st { int x, y, c; }; int d[100][100], b[100][100], x[11], y[11]; int dx[][6]{{ 0, -1, 0, 1, 1, 1, }, ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; struct st { int x, y, c; }; int d[100][100], b[100][100], x[11], y[11]; int dx[][6]{{ 0, -1, 0, 1, 1, 1, }, ...
replace
47
48
47
48
MLE
p00193
C++
Runtime Error
#include <iostream> #include <queue> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> grid; const int INF = 1e9; const int dx[6] = {0, 1, 1, 1, 0, -1}, dy[6] = {-1, -1, 0, 1, 1, 0}; int h, w; grid bfs(int y, int x) { grid res(h, vi(w, INF)); res[y][x] = 0; queue<int> q; q.push...
#include <iostream> #include <queue> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> grid; const int INF = 1e9; const int dx[6] = {0, 1, 1, 1, 0, -1}, dy[6] = {-1, -1, 0, 1, 1, 0}; int h, w; grid bfs(int y, int x) { grid res(h, vi(w, INF)); res[y][x] = 0; queue<int> q; q.push...
replace
38
39
38
39
0
p00194
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const int INF = 1 << 28; inline pair<int, int> inputPos() { string str; cin >> str; return pair<int, int>(str[0] - 'a', atoi(str.c_str() + 2) - 1); } int m, n; int D; int sign[20][20]; int cant[20][20][2...
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const int INF = 1 << 28; inline pair<int, int> inputPos() { string str; cin >> str; return pair<int, int>(str[0] - 'a', atoi(str.c_str() + 2) - 1); } int m, n; int D; int sign[20][20]; int cant[20][20][2...
insert
39
39
39
41
-11
p00195
C++
Time Limit Exceeded
#include <cstdio> #define buf 10000 using namespace std; int B[10]; void BubbleSort(void); int main(void) { int i, n, m, A[20001]; char str[buf]; for (;;) { for (i = 0; i < 5; i++) { fgets(str, sizeof(str), stdin); sscanf(str, "%d %d", &n, &m); if (n == 0 && m == 0) break; B[...
#include <cstdio> #define buf 10000 using namespace std; int B[10]; void BubbleSort(void); int main(void) { int i, n, m, A[20001]; char str[buf]; for (;;) { for (i = 0; i < 5; i++) { fgets(str, sizeof(str), stdin); sscanf(str, "%d %d", &n, &m); if (n == 0 && m == 0) return 0; ...
replace
15
16
15
16
TLE
p00197
C++
Runtime Error
#include <stdio.h> int main() { int a, b, n, step = 1; while (scanf("%d %d", &a, &b) != EOF) { if (a <= b) { n = a; a = b; b = n; } if (a % b == 0) n = b; while (a % b != 0) { step++; if (a % b == 0) { n = b; break; } a = a % b; ...
#include <stdio.h> int main() { int a, b, n, step = 1; while (scanf("%d %d", &a, &b) != 0) { if (a == 0 || b == 0) break; if (a <= b) { n = a; a = b; b = n; } if (a % b == 0) n = b; while (a % b != 0) { step++; if (a % b == 0) { n = b; b...
replace
4
5
4
7
-8
p00197
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> using namespace std; void change(int *, int *); int main(void) { int x, y; while (scanf("%d %d", &x, &y)) { int count = 0; if (x < y) change(&x, &y); while (y) { count++; x %= y; change(&x, &y); } cout << x << ' ' << count << endl...
#include <cstdio> #include <iostream> using namespace std; void change(int *, int *); int main(void) { int x, y; while (1) { scanf("%d %d", &x, &y); if (x == 0 && y == 0) break; int count = 0; if (x < y) change(&x, &y); while (y) { count++; x %= y; change(&x, &y...
replace
10
11
10
14
TLE
p00197
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { while (1) { long long x, y, cnt = 0; cin >> x >> y; if (x < y) swap(x, y); while (1) { cnt++; x %= y; swap(x, y); if (y == 0) break; } printf("%lld %lld\n", x, cnt...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { while (1) { long long x, y, cnt = 0; cin >> x >> y; if (x + y == 0) break; if (x < y) swap(x, y); while (1) { cnt++; x %= y; swap(x, y); if (y == 0) break; }...
insert
8
8
8
10
-8
p00200
C++
Runtime Error
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <stack> #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 pi acos(...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <stack> #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 pi acos(...
replace
44
46
44
46
0
p00200
C++
Time Limit Exceeded
#include <iostream> #include <queue> #include <vector> using namespace std; class S { public: S(int pos, int cost) { p = pos; c = cost; } int p, c; }; bool operator<(S a, S b) { return a.c > b.c; } int m; vector<S> edge[100][2]; void add_edge(int a, int b, int c, int t) { edge[a][0].push_back(S(b, c));...
#include <iostream> #include <queue> #include <vector> using namespace std; class S { public: S(int pos, int cost) { p = pos; c = cost; } int p, c; }; bool operator<(S a, S b) { return a.c > b.c; } int m; vector<S> edge[100][2]; void add_edge(int a, int b, int c, int t) { edge[a][0].push_back(S(b, c));...
insert
59
59
59
64
TLE
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct Edge { int to, cost, time; }; typedef pair<int, int> P; const int MAX_V = 110; const int INF = 1 << 30; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; while (cin >> n >>...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct Edge { int to, cost, time; }; typedef pair<int, int> P; const int MAX_V = 3010; const int INF = 1 << 30; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; while (cin >> n >...
replace
13
14
13
14
0
p00200
C++
Time Limit Exceeded
#include <functional> #include <iostream> #include <limits.h> #include <queue> #include <vector> using namespace std; struct Edge { int to, cost; Edge() {} Edge(int to, int cost) : to(to), cost(cost) {} }; int dijkstra(const vector<vector<Edge>> vve, int s, int t) { priority_queue<pair<int, int>, vector<pair...
#include <functional> #include <iostream> #include <limits.h> #include <queue> #include <vector> using namespace std; struct Edge { int to, cost; Edge() {} Edge(int to, int cost) : to(to), cost(cost) {} }; int dijkstra(const vector<vector<Edge>> vve, int s, int t) { priority_queue<pair<int, int>, vector<pair...
insert
31
31
31
34
TLE
p00200
C++
Runtime Error
// #include "bipartite-graph.hpp" // #include <vector> // using namespace std; // int main(){ // vector<vector<int> > G(4); // cout << bipartite_graph(G) << endl; // } // AOJ0200 #include <iostream> #include <vector> using namespace std; struct edge { edge() {} edge(int to, int from, int cost, int time) : t...
// #include "bipartite-graph.hpp" // #include <vector> // using namespace std; // int main(){ // vector<vector<int> > G(4); // cout << bipartite_graph(G) << endl; // } // AOJ0200 #include <iostream> #include <vector> using namespace std; struct edge { edge() {} edge(int to, int from, int cost, int time) : t...
replace
23
24
23
24
0
p00200
C++
Runtime Error
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) const int N = 211; int dpcost[N][N]; int dptime[...
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) const int N = 211; int dpcost[N][N]; int dptime[...
replace
41
42
41
42
0
p00200
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define reps(i, n) for (int i = 1; i <= int(n); i++) #define sint(i) scanf("%d", &i); #define sintt(i, j...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define reps(i, n) for (int i = 1; i <= int(n); i++) #define sint(i) scanf("%d", &i); #define sintt(i, j...
replace
44
47
44
47
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> const int INF = 1 << 20; const int N = 101; int cost[N][N]; int tim[N][N]; using namespace std; int main() { int n, m, a, b, co, ti, r; while (1) { cin >> n >> m; if (n == 0 && m == 0) return 0; for (int i = 0; i < m + 2; i++) { for (int i2 = 0; i2 < ...
#include <algorithm> #include <iostream> const int INF = 1 << 20; const int N = 101; int cost[N][N]; int tim[N][N]; using namespace std; int main() { int n, m, a, b, co, ti, r; while (1) { cin >> n >> m; if (n == 0 && m == 0) return 0; for (int i = 0; i < N; i++) { for (int i2 = 0; i2 < N; i...
replace
13
15
13
15
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int road1[111][111]; int road2[111][111]; int n, m; int a, b, cost, time; int p, q, r; int x; while (1) { for (int i = 0; i < 111; i++) { for (int j = 0; j < 111; j++) { road1[i][j] = road2[i][j] = 111111111; ...
#include <algorithm> #include <iostream> using namespace std; int main() { int road1[111][111]; int road2[111][111]; int n, m; int a, b, cost, time; int p, q, r; int x; while (1) { for (int i = 0; i < 111; i++) { for (int j = 0; j < 111; j++) { road1[i][j] = road2[i][j] = 111111111; ...
replace
25
28
25
28
0
p00200
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> #define _m_ 1 const int INF = 1e9; int cost[101][101]; int tim[101][101]; int d[101]; bool used[101]; int V; void dijkstra(int s, int o) { std::fill(d, d + V, INF); std::fill(used, used + V, false); d[s] = 0; while (_m_) { int v ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> #define _m_ 1 const int INF = 1e9; int cost[101][101]; int tim[101][101]; int d[101]; bool used[101]; int V; void dijkstra(int s, int o) { std::fill(d, d + V, INF); std::fill(used, used + V, false); d[s] = 0; while (_m_) { int v ...
replace
41
43
41
43
0
p00200
C++
Time Limit Exceeded
#include <iostream> using namespace std; int MAX = 100000; int main() { while (true) { int n, m; cin >> n >> m; int a, b, cost, timer; int costs[m][m]; int timers[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { costs[i][j] = MAX; timers[i][j] = MAX; ...
#include <iostream> using namespace std; int MAX = 100000; int main() { while (true) { int n, m; cin >> n >> m; if (!n && !m) break; int a, b, cost, timer; int costs[m][m]; int timers[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { costs[i][j] = MAX; ...
insert
7
7
7
9
TLE
p00200
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #define INF (1145141919) using namespace std; int n; int from[3000]; int to[3000]; int cost[3000][2]; int d[100]; int r; void Search(int s) { for (int i = 0; i < 100; i++) { d[i] = INF; } d[s] = 0; while (true) { bool update = false; for...
#include <algorithm> #include <cstdio> #include <cstring> #define INF (1145141919) using namespace std; int n; int from[6000]; int to[6000]; int cost[6000][2]; int d[100]; int r; void Search(int s) { for (int i = 0; i < 100; i++) { d[i] = INF; } d[s] = 0; while (true) { bool update = false; for...
replace
8
11
8
11
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; #define MAX 256 #define INF 1000000 struct edge { int money; int time; }; int main() { int n, m; int count; edge G[120][120]; while (cin >> n >> m, n || m) { for (int i = 0; i < 120; i++) { for (int j = 0; j < 120; j++) { G[...
#include <algorithm> #include <iostream> using namespace std; #define MAX 256 #define INF 1000000 struct edge { int money; int time; }; int main() { int n, m; int count; edge G[120][120]; while (cin >> n >> m, n || m) { for (int i = 0; i < 120; i++) { for (int j = 0; j < 120; j++) { G[...
replace
39
42
39
42
0
p00200
C++
Runtime Error
#include <algorithm> #include <array> #include <iostream> #include <iterator> #include <vector> using namespace std; struct AboutTo; class Node { public: int aa; int Lowest; bool IsSelected; vector<AboutTo> ToCollection; Node() { Lowest = 2147483647; IsSelected = false; } void Reset() { Lowe...
#include <algorithm> #include <array> #include <iostream> #include <iterator> #include <vector> using namespace std; struct AboutTo; class Node { public: int aa; int Lowest; bool IsSelected; vector<AboutTo> ToCollection; Node() { Lowest = 2147483647; IsSelected = false; } void Reset() { Lowe...
replace
68
69
68
69
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { const int MAX = 1e5; for (int n, m; cin >> n >> m, n;) { int cost[m][m]; int time[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cost[i][j] = MAX; time[i][j] = MAX; } } int ...
#include <algorithm> #include <iostream> using namespace std; int main() { const int MAX = 1e5; for (int n, m; cin >> n >> m, n;) { int cost[m][m]; int time[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cost[i][j] = MAX; time[i][j] = MAX; } } int ...
replace
21
22
21
22
0
p00200
C++
Runtime Error
#include <iostream> using namespace std; int main() { const int MAX = 1e5; for (int n, m; cin >> n >> m, n;) { int cost[m][m]; int time[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cost[i][j] = MAX; time[i][j] = MAX; } } int a, b, c, t; for (...
#include <iostream> using namespace std; int main() { const int MAX = 1e5; for (int n, m; cin >> n >> m, n;) { int cost[m][m]; int time[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cost[i][j] = MAX; time[i][j] = MAX; } } int a, b, c, t; for (...
replace
22
24
22
24
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> #include <queue> #include <vector> constexpr int INF = 1000000000; using Pair = std::pair<int, int>; int n, m; std::vector<Pair> cost[101]; std::vector<Pair> time_[101]; int d[101]; int dijkstra(int st, int gl, std::vector<Pair> *elm) { std::fill(d, d + 101, INF); d[st]...
#include <algorithm> #include <iostream> #include <queue> #include <vector> constexpr int INF = 1000000000; using Pair = std::pair<int, int>; int n, m; std::vector<Pair> cost[101]; std::vector<Pair> time_[101]; int d[101]; int dijkstra(int st, int gl, std::vector<Pair> *elm) { std::fill(d, d + 101, INF); d[st]...
replace
51
52
51
52
0
p00200
C++
Runtime Error
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> using namespace std; int n, m; long long gc[110][110]; long long gt[110][110]; void warshallfloyd() { for (int k = 0; k < m; k++) { for (int i = 0; i < m; i++...
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> using namespace std; int n, m; long long gc[110][110]; long long gt[110][110]; void warshallfloyd() { for (int k = 0; k < m; k++) { for (int i = 0; i < m; i++...
replace
30
32
30
32
0
p00200
C++
Runtime Error
#include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int INF = 9999999; int solve(int from, int to, int cost[101][101], int n) { int dist[101]; int history[101]; for (int i = 0; i < 101; i++) { dist[i] = INF; history[i] = 0; } dist...
#include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; const int INF = 9999999; int solve(int from, int to, int cost[101][101], int n) { int dist[101]; int history[101]; for (int i = 0; i < 101; i++) { dist[i] = INF; history[i] = 0; } dist...
replace
79
80
79
80
0
p00200
C++
Runtime Error
// 青春の片道切符::ワーシャルフロイド法 /*for(int k=0;k<N;k++){//経由箇所(N<200) for(int i=0;i<N;i++){//スタート(N<200) for(int j=0;j<N;j++){//目的(N<200) d[i][j]=min(d[i][j],d[i][k]+d[k][j]); } } }*/ #include <algorithm> #include <cctype> #include <iostream> #include <que...
// 青春の片道切符::ワーシャルフロイド法 /*for(int k=0;k<N;k++){//経由箇所(N<200) for(int i=0;i<N;i++){//スタート(N<200) for(int j=0;j<N;j++){//目的(N<200) d[i][j]=min(d[i][j],d[i][k]+d[k][j]); } } }*/ #include <algorithm> #include <cctype> #include <iostream> #include <que...
replace
25
26
25
26
0
p00200
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #includ...
replace
41
42
41
42
0
toString(ds) = 0 268435456 268435456 268435456 268435456 268435456 268435456 0 10 25 15 35 268435456 10 0 35 10 30 268435456 25 35 0 40 20 268435456 15 10 40 0 20 268435456 35 30 20 20 0 toString(cs) = 0 268435456 268435456 268435456 268435456 268435456 268435456 0 200 250 300 450 268435456 200 0 450 100 250 268435456 ...
p00201
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
insert
57
57
57
59
TLE
p00201
C++
Runtime Error
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <vector> #define F first #define S second #define MAX 10000000 using namespace std; typedef pair<int, bool> P; map<string, P> material; vector<string> vec[110]; map<string, P> index; int rec(string target) { int value = MAX; map<s...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <vector> #define F first #define S second #define MAX 10000000 using namespace std; typedef pair<int, bool> P; map<string, P> material; vector<string> vec[110]; map<string, P> index; int rec(string target) { int value = MAX; map<s...
replace
36
37
36
37
0
p00201
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int n, m; map<string, int> t; int c[111]; vector<int> v[111]; int solve(int k) { int sum = 0; if (v[k].empty()) return c[k]; for (int i = 0; i < (int)v[k].size(); i++) { sum ...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int n, m; map<string, int> t; int c[111]; vector<int> v[111]; int solve(int k) { int sum = 0; if (v[k].empty()) return c[k]; for (int i = 0; i < (int)v[k].size(); i++) { sum ...
replace
31
33
31
33
-11
p00201
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; map<string, vector<string>> recipe; map<string, int> cost; int search(string item) { if (recipe[item].size() == 0) return cost[item]; else { int sum = 0; for (int i = 0; i < recipe[item].size(); i++) { ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; map<string, vector<string>> recipe; map<string, int> cost; int search(string item) { if (recipe[item].size() == 0) return cost[item]; else { int sum = 0; for (int i = 0; i < recipe[item].size(); i++) { ...
insert
25
25
25
27
TLE
p00201
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
58
59
58
59
-11
p00201
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> #include <map> #include <string> #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; map<string, int> name_id; vector<int> recipe[100]; int price[100]; int solve(int x) { int len = recipe[x].size(); if (...
#include <cstdio> #include <iostream> #include <map> #include <string> #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; map<string, int> name_id; vector<int> recipe[100]; int price[100]; int solve(int x) { int len = recipe[x].size(); if (...
insert
32
32
32
34
TLE
p00201
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; map<string, int> normal; map<string, vector<string>> rec; int f(string x) { int ans = normal[x], sum = 0; if (rec[x].size() == 0) return ans; for (int i = 0; i < rec[x].size(); i++) { sum += f(rec[x][i]); } ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; map<string, int> normal; map<string, vector<string>> rec; int f(string x) { int ans = normal[x], sum = 0; if (rec[x].size() == 0) return ans; for (int i = 0; i < rec[x].size(); i++) { sum += f(rec[x][i]); } ...
insert
22
22
22
24
TLE