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
p00103
C++
Time Limit Exceeded
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int N, m = 0, rn = 0, pn = 0; string str; cin >> N; for (int i = 0; i < N; i++) { while (1) { cin >> str; if (str == "OUT") { m++; if (m == 3) break; } if (str == "HI...
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int N, m = 0, rn = 0, pn = 0; string str; cin >> N; for (int i = 0; i < N; i++) { while (1) { cin >> str; if (str == "OUT") { m++; if (m == 3) break; } if (str == "HI...
insert
32
32
32
33
TLE
p00104
C++
Time Limit Exceeded
#include <iostream> #include <string.h> using namespace std; struct zahyou { int x; int y; }; int main() { int tx, ty, count; char map[100][100]; bool flag; struct zahyou now; while (cin >> tx >> ty, tx && ty) { flag = false; now.x = 0; now.y = 0; memset(map, '\0', sizeof(map)); ...
#include <iostream> #include <string.h> using namespace std; struct zahyou { int x; int y; }; int main() { int tx, ty, count; char map[100][100]; bool flag; struct zahyou now; while (cin >> tx >> ty, tx && ty) { flag = false; now.x = 0; now.y = 0; memset(map, '\0', sizeof(map)); ...
replace
23
25
23
25
TLE
p00104
C++
Time Limit Exceeded
#include <cstring> #include <iostream> using namespace std; char a[8000][8000]; int h, w, loop, cx, cy; int main() { while (true) { cin >> h >> w; if (!h) { break; } memset(a, ' ', sizeof(a)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } ...
#include <cstring> #include <iostream> using namespace std; char a[8000][8000]; int h, w, loop, cx, cy; int main() { while (true) { cin >> h >> w; if (!h) { break; } memset(a, ' ', sizeof(a)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } ...
replace
21
22
21
22
TLE
p00104
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int w, h; while (cin >> h >> w, w + h) { char room[10][10]; int t = 0; int now_x = 0, now_y = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> room[i][j]; } } while (1) { if (room[no...
#include <bits/stdc++.h> using namespace std; int main() { int w, h; while (cin >> h >> w, w + h) { char room[101][101]; int t = 0; int now_x = 0, now_y = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> room[i][j]; } } while (1) { if (room[...
replace
7
8
7
8
TLE
p00104
C++
Runtime Error
#include <iostream> using namespace std; int main() { int H, W, x, y; while (cin >> H >> W) { if (H == 0 && W == 0) break; char space[H][W], c; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> space[j][i]; } } x = y = 0; while (1) { c = space...
#include <iostream> using namespace std; int main() { int H, W, x, y; while (cin >> H >> W) { if (H == 0 && W == 0) break; char space[W][H], c; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> space[j][i]; } } x = y = 0; while (1) { c = space...
replace
7
8
7
8
0
p00104
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back string fie[30] = {}; int main() { int h, w; while (cin >> h >> w) { if (w == ...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back string fie[200] = {}; int main() { int h, w; while (cin >> h >> w) { if (w ==...
replace
12
13
12
13
0
p00104
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
insert
55
55
55
57
0
p00104
C++
Runtime Error
#include <iostream> using namespace std; #define MAX 10 int main(void) { int H, W; char tile[MAX][MAX]; while (1) { int x = 0, y = 0; for (int i = 0; i < MAX; i++) { for (int j = 0; j < MAX; j++) { tile[i][j] = '.'; } } cin >> H >> W; if (H == 0 && W == 0) break...
#include <iostream> using namespace std; #define MAX 100 int main(void) { int H, W; char tile[MAX][MAX]; while (1) { int x = 0, y = 0; for (int i = 0; i < MAX; i++) { for (int j = 0; j < MAX; j++) { tile[i][j] = '.'; } } cin >> H >> W; if (H == 0 && W == 0) brea...
replace
3
4
3
4
TLE
p00104
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
28
29
28
29
TLE
p00104
C++
Time Limit Exceeded
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { while (1) { int w, h; cin >> w >> h; if (w == 0 && h == 0) break; vector<string> data; for (int i = 0; i < h; i++) { string line; cin >> line; data.push_back(line); } boo...
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { while (1) { int w, h; cin >> h >> w; if (w == 0 && h == 0) break; vector<string> data; for (int i = 0; i < h; i++) { string line; cin >> line; data.push_back(line); } boo...
replace
7
8
7
8
TLE
p00105
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; pair<string, int> a[1]; int main() { int t = 0, g, i; while (cin >> a[t].first >> a[t].second) t++; sort(a, a + t); string f, b = a[0].first; cout << b << endl << a[0].second; for (i = 1; i < t; i++) { bool n = 0; f = a[i].first, g = a[i].second; ...
#include <bits/stdc++.h> using namespace std; pair<string, int> a[100]; int main() { int t = 0, g, i; while (cin >> a[t].first >> a[t].second) t++; sort(a, a + t); string f, b = a[0].first; cout << b << endl << a[0].second; for (i = 1; i < t; i++) { bool n = 0; f = a[i].first, g = a[i].second; ...
replace
2
3
2
3
-11
p00105
C++
Runtime Error
#define scanf_s scanf // #define sscanf_s sscanf // #define gets_s gets #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; #define MAX 1001 #define _MAX 100 #define HO 6 int main(void) { char str[MAX]; string word[_MAX]; int pa[_MAX], rank[_MAX], cou, a; for (cou = 0...
#define scanf_s scanf // #define sscanf_s sscanf // #define gets_s gets #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; #define MAX 1001 #define _MAX 100 #define HO 6 int main(void) { char str[MAX]; string word[_MAX]; int pa[_MAX], rank[_MAX], cou, a; for (cou = 0...
replace
15
16
15
16
-11
p00105
C++
Memory Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <vector> int main() { std::string s; int p; std::map<std::string, std::vector<int>> m; while (std::cin >> s >> p, p != 0) { m[s].push_back(p); } std::map<std::string, std::vector<int>>::iterator m_it = m.begin(); while (m_it != m.end())...
#include <algorithm> #include <iostream> #include <map> #include <vector> int main() { std::string s; int p; std::map<std::string, std::vector<int>> m; while (std::cin >> s >> p, !std::cin.eof()) { m[s].push_back(p); } std::map<std::string, std::vector<int>>::iterator m_it = m.begin(); while (m_it !=...
replace
9
10
9
10
MLE
p00105
C++
Memory Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <vector> int main() { std::string s; int p; std::map<std::string, std::vector<int>> m; while (std::cin >> s >> p, p != 0) { m[s].push_back(p); } std::map<std::string, std::vector<int>>::iterator m_it = m.begin(); while (m_it != m.end())...
#include <algorithm> #include <iostream> #include <map> #include <vector> int main() { std::string s; int p; std::map<std::string, std::vector<int>> m; while (std::cin >> s >> p, !std::cin.eof()) { m[s].push_back(p); } std::map<std::string, std::vector<int>>::iterator m_it = m.begin(); while (m_it !=...
replace
9
10
9
10
MLE
p00106
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define iota(i, n, b, s) \ for (int i = int(b); i != int((b) + (s) * (n)); i += (s)) #define range(i, n, m) \ iota(i, (((n) > (m)) ? ((n) - (m) + 1) : ((m) - (...
#include <bits/stdc++.h> using namespace std; #define iota(i, n, b, s) \ for (int i = int(b); i != int((b) + (s) * (n)); i += (s)) #define range(i, n, m) \ iota(i, (((n) > (m)) ? ((n) - (m) + 1) : ((m) - (...
delete
63
64
63
63
0
>>> c = 5 >>> c = 22
p00107
C++
Time Limit Exceeded
#include <math.h> #include <stdio.h> int main() { while (1) { int d, w, h; scanf("%d %d %d", &d, &w, &h); if (d == 0 && w == 0 && h == 0) break; int n; scanf("%d", &n); int max = (int)fmax((double)d, fmax((double)w, (double)h)); double a = sqrt(d * d + w * w + h * h - max * max) / ...
#include <math.h> #include <stdio.h> int main() { while (1) { int d, w, h; scanf("%d %d %d", &d, &w, &h); if (d == 0 && w == 0 && h == 0) break; int n; scanf("%d", &n); int max = (int)fmax((double)d, fmax((double)w, (double)h)); double a = sqrt(d * d + w * w + h * h - max * max) / ...
replace
16
17
16
17
TLE
p00108
C++
Runtime Error
#include <iostream> #include <map> using namespace std; int ans[100][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin ...
#include <iostream> #include <map> using namespace std; int ans[1000][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin...
replace
4
5
4
5
0
p00108
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int main() { int n; while (1) { cin >> n; if (n == 0) break; vector<int> s; int b; for (int i = 0; i < n; i++) { cin >> b; s.push_back(b); } int c = 0; while (1) { vector<int> freq(13, 0); for (...
#include <iostream> #include <vector> using namespace std; int main() { int n; while (1) { cin >> n; if (n == 0) break; vector<int> s; int b; for (int i = 0; i < n; i++) { cin >> b; s.push_back(b); } int c = 0; while (1) { vector<int> freq(1000, 0); for...
replace
18
19
18
19
0
p00108
C++
Memory Limit Exceeded
#include <cstring> #include <iostream> using namespace std; int x[100000][500], n; int main() { while (true) { memset(x, 0, sizeof(x)); cin >> n; if (!n) { break; } for (int i = 0; i < n; i++) { cin >> x[0][i]; } for (int i = 1; i < 30000; i++) { for (int j = 0; j < n; j+...
#include <cstring> #include <iostream> using namespace std; int x[32000][500], n; int main() { while (true) { memset(x, 0, sizeof(x)); cin >> n; if (!n) { break; } for (int i = 0; i < n; i++) { cin >> x[0][i]; } for (int i = 1; i < 30000; i++) { for (int j = 0; j < n; j++...
replace
3
4
3
4
MLE
p00108
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <iterator> #include <vector> using namespace std; int main() { int n; vector<int> vi, vi2; while (cin >> n) { if (n == 0) break; for (int i = 0; i < n; i++) { int j; cin >> j; vi.push_back(j); } int counter = -1; do { ...
#include <algorithm> #include <iostream> #include <iterator> #include <vector> using namespace std; int main() { int n; vector<int> vi, vi2; while (cin >> n) { vi.clear(); vi2.clear(); if (n == 0) break; for (int i = 0; i < n; i++) { int j; cin >> j; vi.push_back(j); }...
insert
10
10
10
12
TLE
p00108
C++
Runtime Error
#include <iostream> #include <map> using namespace std; int ans[113][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin ...
#include <iostream> #include <map> using namespace std; int ans[114][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin ...
replace
4
5
4
5
0
p00108
C++
Runtime Error
#include <iostream> #include <map> using namespace std; int ans[110][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin ...
#include <iostream> #include <map> using namespace std; int ans[120][2] [12]; // 二つ目の次元の0の0に数列の長さ、0の1に操作回数、1に答えの数列 int counter = 0, flag = 0; void solve() { int n; cin >> n; if (n == 0) { flag = 1; return; } ans[counter][0][0] = n; int S[12]; // 数列 for (int i = 0; i < n; i++) { cin ...
replace
4
5
4
5
0
p00108
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int main() { while (1) { int n, count = 0; long before[13], after[13], c[13]; scanf(" %d", &n); if (n == 0) break; for (int i = 0; i < n; ++i) scanf(" %ld", &before[i]); // loop while (1) { for (int i = 0; i <...
#include <cstdio> #include <iostream> using namespace std; int main() { while (1) { int n, count = 0; long before[13], after[13], c[13]; scanf(" %d", &n); if (n == 0) break; for (int i = 0; i < n; ++i) scanf(" %ld", &before[i]); // loop while (1) { for (int i = 0; i <...
replace
18
19
18
19
-6
*** stack smashing detected ***: terminated
p00108
C++
Runtime Error
#include <iostream> #include <map> using namespace std; int main() { int n, c, i; int pre[12], now[12], cnt[12]; while (cin >> n, n) { map<int, int> m; for (i = 0; i < n; i++) { cin >> pre[i]; m[pre[i]] = i; } for (i = 0; i < n; i++) now[i] = m[pre[i]]; for (c = 0;; c++) { ...
#include <iostream> #include <map> using namespace std; int main() { int n, c, i; int pre[12], now[12], cnt[12]; while (cin >> n, n) { map<int, int> m; for (i = 0; i < n; i++) { cin >> pre[i]; m[pre[i]] = i + 1; } for (i = 0; i < n; i++) now[i] = m[pre[i]]; for (c = 0;; c++...
replace
11
12
11
12
0
p00109
C++
Runtime Error
#include <cstdlib> #include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; string its(int n) { stringstream s; s << n; return s.str(); } stack<string> mep(stack<string> me, string s) { int a, b; b = atoi(me.top().c_str()); me.pop(); a = atoi(me.top().c_str()); me.p...
#include <cstdlib> #include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; string its(int n) { stringstream s; s << n; return s.str(); } stack<string> mep(stack<string> me, string s) { int a, b; b = atoi(me.top().c_str()); me.pop(); a = atoi(me.top().c_str()); me.p...
replace
37
38
37
38
0
p00109
C++
Time Limit Exceeded
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <t...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <t...
replace
466
468
466
468
TLE
p00109
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define pb(n) push_back(n) #define mp(n, m) make_pair(n, m) #def...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define pb(n) push_back(n) #define mp(n, m) make_pair(n, m) #def...
replace
49
50
49
50
0
p00109
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int calc(char *s, char *end) { /*for (char *p = s; p != end; p++) printf("%c", *p); puts("");*/ bool f = false; vector<int> st; vector<char> op; char *p = s; while (p != end) { if (!f) if (*p == '(') { char *e; for (e = p + 1; *e ...
#include <bits/stdc++.h> using namespace std; int calc(char *s, char *end) { /*for (char *p = s; p != end; p++) printf("%c", *p); puts("");*/ bool f = false; vector<int> st; vector<char> op; char *p = s; while (p != end) { if (!f) if (*p == '(') { char *e = p + 1; int cnt = 1...
replace
16
19
16
27
0
p00109
C++
Runtime Error
#include <iostream> #include <string> using namespace std; string S; size_t cur; int digit() { return S[cur++] - '0'; } int number() { int n = digit(); while (cur < S.size() && isdigit(S[cur])) { n = n * 10 + digit(); } return n; } int expression(); int factor() { if (isdigit(S[cur])) return num...
#include <iostream> #include <string> using namespace std; string S; size_t cur; int digit() { return S[cur++] - '0'; } int number() { int n = digit(); while (cur < S.size() && isdigit(S[cur])) { n = n * 10 + digit(); } return n; } int expression(); int factor() { if (isdigit(S[cur])) return num...
insert
55
55
55
56
0
p00110
C++
Runtime Error
#include <algorithm> #include <cstring> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; using vi = vector<int>; string str; string stra; int id = 0; void pt(vector<int> v) { for (int r = 0; r < v.size(); r++) { cout << v[r];...
#include <algorithm> #include <cstring> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; using vi = vector<int>; string str; string stra; int id = 0; void pt(vector<int> v) { for (int r = 0; r < v.size(); r++) { cout << v[r];...
replace
86
87
86
87
0
p00111
C++
Runtime Error
#include <iostream> #include <map> #include <string> using namespace std; map<char, string> encode_table; map<string, char> decode_table; char decode(string s) { // cout << s << endl; return decode_table[s]; } string encode(string s) { string tmp; for (string::iterator si = s.begin(); si != s.end(); si++)...
#include <iostream> #include <map> #include <string> using namespace std; map<char, string> encode_table; map<string, char> decode_table; char decode(string s) { // cout << s << endl; return decode_table[s]; } string encode(string s) { string tmp; for (string::iterator si = s.begin(); si != s.end(); si++)...
insert
28
28
28
29
0
p00111
C++
Runtime Error
#include <iostream> #include <map> #include <string> using namespace std; // •ÏŠ·ƒe[ƒuƒ‹ map<char, string> M; map<string, char> D; int main(void) { M['A'] = "00000"; M['B'] = "00001"; M['C'] = "00010"; M['D'] = "00011"; M['E'] = "00100"; M['F'] = "00101"; M['G'] = "00110"; M['H'] = "00111"; M['I'] ...
#include <iostream> #include <map> #include <string> using namespace std; // •ÏŠ·ƒe[ƒuƒ‹ map<char, string> M; map<string, char> D; int main(void) { M['A'] = "00000"; M['B'] = "00001"; M['C'] = "00010"; M['D'] = "00011"; M['E'] = "00100"; M['F'] = "00101"; M['G'] = "00110"; M['H'] = "00111"; M['I'] ...
insert
93
93
93
95
0
p00112
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main(void) { while (1) { int n, t[100], w; w = 0; cin >> n; if (n == 0) { break; } for (int i = 0; i < n; i++) { cin >> t[i]; } sort(t, t + n); for (int i = 0; i < n; i++) { w += t[i] * (n - 1 - i);...
#include <algorithm> #include <iostream> using namespace std; int main(void) { while (1) { int n, t[10005]; long long int w; w = 0; cin >> n; if (n == 0) { break; } for (int i = 0; i < n; i++) { cin >> t[i]; } sort(t, t + n); for (int i = 0; i < n; i++) { w +=...
replace
5
6
5
7
0
p00112
C++
Runtime Error
#include <iostream> using namespace std; int n, m, temp; int t[100]; int sum; int main() { while (1) { cin >> n; if (n == 0) break; m = n; while (m--) { cin >> t[m]; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - 1 - i; j++) { if (t[j] > t[j + 1]) { ...
#include <iostream> using namespace std; int n, m, temp; int t[10005]; long long int sum; int main() { while (1) { cin >> n; if (n == 0) break; m = n; while (m--) { cin >> t[m]; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - 1 - i; j++) { if (t[j] > t[j ...
replace
4
6
4
6
0
p00112
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n, n) { vector<int> ts; for (int i = 0; i < n; i++) { cin >> ts[i]; } sort(ts.begin(), ts.end()); long long sum = 0, ans = 0; for (int i = 0; i < n; i++) { ans += sum...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n, n) { vector<int> ts(n); for (int i = 0; i < n; i++) { cin >> ts[i]; } sort(ts.begin(), ts.end()); long long sum = 0, ans = 0; for (int i = 0; i < n; i++) { ans += ...
replace
7
8
7
8
-11
p00112
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n, n) { int need_time[500] = {0}, total_time[500] = {0}, total = 0; for (int i = 0; i < n; i++) { cin >> need_time[i]; } sort(need_time, need_time + n); for (...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n, n) { long long need_time[10100] = {0}, total_time[10100] = {0}, total = 0; for (int i = 0; i < n; i++) { cin >> need_time[i]; } sort(need_time, need_time + n);...
replace
8
9
8
9
0
p00112
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, time[1000]; long long ans = 0; while (cin >> n) { if (n == 0) break; int wait = 0; for (int i = 0; i < n; i++) cin >> time[i]; sort(time, time + n); for (int i = 0; i < n; i++) { ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, time[10000]; long long ans = 0; while (cin >> n) { if (n == 0) break; int wait = 0; for (int i = 0; i < n; i++) cin >> time[i]; sort(time, time + n); for (int i = 0; i < n; i++) { ...
replace
6
7
6
7
0
p00114
C++
Time Limit Exceeded
#include <iostream> using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return (a == 0) ? b : GCD(b % a, a); } ll LCM(ll a, ll b) { return a * b / GCD(a, b); } int main() { int a[3], m[3]; while (1) { cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2]; if (!a[0]) { break; } int va...
#include <iostream> using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return (a == 0) ? b : GCD(b % a, a); } ll LCM(ll a, ll b) { return a * b / GCD(a, b); } int main() { int a[3], m[3]; while (1) { cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2]; if (!a[0]) { break; } int va...
replace
12
13
12
13
TLE
p00114
C++
Runtime Error
// x^t = 1 mod m のとき、 // x^(kt) = 1 mod m. #include <iostream> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll a1, m1, a2, m2, a3, m3; while (1) { cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3; ...
// x^t = 1 mod m のとき、 // x^(kt) = 1 mod m. #include <iostream> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll a1, m1, a2, m2, a3, m3; while (1) { cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3; ...
insert
16
16
16
19
-8
p00114
C++
Time Limit Exceeded
#include <iostream> #define int long long using namespace std; int cou(int a, int m); int ggd(int number1, int number2); int lcm(int number1, int number2); signed main() { int a1, a2, a3, m1, m2, m3; int x, y, z; int count; int countx, county, countz; while (cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3, ...
#include <iostream> #define int long long using namespace std; int cou(int a, int m); int ggd(int number1, int number2); int lcm(int number1, int number2); signed main() { int a1, a2, a3, m1, m2, m3; int x, y, z; int count; int countx, county, countz; while (cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3, ...
replace
49
53
49
53
TLE
p00114
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) namespace std { template <typename T> T lcm(T a, T b) { return a / __gcd(a, b) * b; } } // namespace std int main() { long long cyc[3], a[3], m[3]; #define in(i) , &a[i], &m[i] #defi...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) namespace std { template <typename T> T lcm(T a, T b) { return a / __gcd(a, b) * b; } } // namespace std int main() { long long cyc[3], a[3], m[3]; #define in(i) , &a[i], &m[i] #defi...
replace
18
19
18
19
-8
p00114
C++
Runtime Error
#include <iostream> using namespace std; long long a[3], m[3], k[3]; long long gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } int main() { while (cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2]) { for (int i = 0; i < 3; i++) { long long cnt = 0, x = 1; while (true)...
#include <iostream> using namespace std; long long a[3], m[3], k[3]; long long gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } int main() { while (true) { cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2]; if (a[0] == 0 && m[0] == 0 && a[1] == 0 && m[1] == 0 && a[2] == 0 && ...
replace
10
11
10
16
-8
p00116
C++
Time Limit Exceeded
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
replace
42
47
42
70
TLE
p00116
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int getS(vector<int> &H) { int N = H.size(); vector<int> L(N), R(N); stack<int> S; for (int i = 0; i < N; i++) { while (!S.empty() && H[i] <= H[S.top()]) S.pop(); L[i] = S.empty() ? 0 : (S.top() + 1); S.push(i); } S = sta...
#include <bits/stdc++.h> using namespace std; #define int long long int getS(vector<int> &H) { int N = H.size(); vector<int> L(N), R(N); stack<int> S; for (int i = 0; i < N; i++) { while (!S.empty() && H[i] <= H[S.top()]) S.pop(); L[i] = S.empty() ? 0 : (S.top() + 1); S.push(i); } S = sta...
replace
28
29
28
29
0
p00116
C++
Memory Limit Exceeded
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define YNUM(X) (X < 0 ? X + 3 : X) typedef std::pair<int, int> WH; // typedef std::vector<WH> whvec; int h, w; bool map[502][502]; std::string in; // std::vector<std::vector<whvec> >...
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define YNUM(X) (X < 0 ? X + 3 : X) typedef std::pair<int, int> WH; // typedef std::vector<WH> whvec; int h, w; bool map[502][502]; std::string in; // std::vector<std::vector<whvec> >...
replace
17
18
17
18
MLE
p00116
C++
Time Limit Exceeded
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define YNUM(X) (X < 0 ? X + 3 : X) typedef std::pair<int, int> WH; typedef std::vector<WH> whvec; int main() { int h, w; while (std::cin >> h >> w, w + h != 0) { bool map[50...
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define YNUM(X) (X < 0 ? X + 3 : X) typedef std::pair<int, int> WH; typedef std::vector<WH> whvec; int main() { int h, w; while (std::cin >> h >> w, w + h != 0) { bool map[50...
insert
32
32
32
41
TLE
p00116
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int h, w; while (1) { cin >> h >> w; if (!h && !w) break; vector<string> grid; for (int i = 0; i < h; i++) { string tmp; cin >> tmp; grid.push_back(tmp); } int ans = 0; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int h, w; while (1) { cin >> h >> w; if (!h && !w) break; vector<string> grid; for (int i = 0; i < h; i++) { string tmp; cin >> tmp; grid.push_back(tmp); } int ans = 0; ...
replace
30
31
30
31
TLE
p00117
C++
Runtime Error
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) \ for (__typeof...
replace
71
72
71
72
0
p00117
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; int N, M, A, B, C, D, x1, x2, y1, y2; int K[32][32]; const int inf = 1001001001; int main() { for (int i = 0; i < 32; ++i) { for (int j = 0; j < 32; ++j) { K[i][j] = inf; } } scanf("%d%d", &N, &M); for (int i = 0; i < M; ++i) { scanf...
#include <cstdio> #include <iostream> using namespace std; int N, M, A, B, C, D, x1, x2, y1, y2; int K[32][32]; const int inf = 1001001001; int main() { for (int i = 0; i < 32; ++i) { for (int j = 0; j < 32; ++j) { K[i][j] = inf; } } scanf("%d%d", &N, &M); for (int i = 0; i < M; ++i) { scanf...
replace
33
34
33
34
0
11.0
p00118
C++
Runtime Error
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define INF 1000000000 #define MOD 1000000000 + 7 using namespace std; int H, W; char fruit[15][15]; int dx[4] = {1, 0...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <tuple> #include <utility> #include <vector> #define INF 1000000000 #define MOD 1000000000 + 7 using namespace std; int H, W; char fruit[200][200]; int dx[4] = {1,...
replace
16
17
16
17
0
p00118
C++
Runtime Error
// // Created by yijiezhu on 12/20/16. // #include <cstring> #include <iostream> using namespace std; const int MAX_N = 21; int m, n; char matrix[MAX_N][MAX_N]; bool visited[MAX_N][MAX_N]; int cnt; void dfs(int i, int j, char ch) { visited[i][j] = true; matrix[i][j] = (char)('a' + cnt - 1); int delta[] = {0, ...
// // Created by yijiezhu on 12/20/16. // #include <cstring> #include <iostream> using namespace std; #define MAX_N 101 int m, n; char matrix[MAX_N][MAX_N]; bool visited[MAX_N][MAX_N]; int cnt; void dfs(int i, int j, char ch) { visited[i][j] = true; matrix[i][j] = (char)('a' + cnt - 1); int delta[] = {0, 1, 0...
replace
8
9
8
9
0
p00118
C++
Runtime Error
#include <cstdio> #include <queue> using namespace std; int main() { const int dx[] = {0, -1, 1, 0}, dy[] = {-1, 0, 0, 1}; while (true) { int h, w; char fld[32][32]; scanf("%d%d", &h, &w); if (h == 0) break; for (int i = 0; i < h; ++i) scanf("%s", fld[i]); int ans = 0; for (...
#include <cstdio> #include <queue> using namespace std; int main() { const int dx[] = {0, -1, 1, 0}, dy[] = {-1, 0, 0, 1}; while (true) { int h, w; char fld[128][128]; scanf("%d%d", &h, &w); if (h == 0) break; for (int i = 0; i < h; ++i) scanf("%s", fld[i]); int ans = 0; for...
replace
8
9
8
9
0
p00118
C++
Runtime Error
#include <iostream> #include <string> using namespace std; #define MAX_N 100 void makemap(int h); void seach(); void setblank(int x, int y, char c); int h, w, ans; string str[MAX_N]; int main() { while (cin >> h >> w) { if (h == 0 && w == 0) break; ans = 0; makemap(h); seach(); cout << ans ...
#include <iostream> #include <string> using namespace std; #define MAX_N 100 void makemap(int h); void seach(); void setblank(int x, int y, char c); int h, w, ans; string str[MAX_N]; int main() { while (cin >> h >> w) { if (h == 0 && w == 0) break; ans = 0; makemap(h); seach(); cout << ans ...
replace
43
44
43
44
0
p00118
C++
Time Limit Exceeded
#include <iostream> const int MAX_H = 100, MAX_W = 100, v[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}}; std::string map[MAX_H]; int W, H; // x,y Œ»Ý‚̈ʒu c Á‚·•¶Žš void dfs(int x, int y, char c) { map[y][x] = ' '; for (int i = 0; i < 4; i++) { int nx = x + v[i][0], ny = y + v[i][1]; if (nx >= ...
#include <iostream> const int MAX_H = 100, MAX_W = 100, v[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}}; std::string map[MAX_H]; int W, H; // x,y Œ»Ý‚̈ʒu c Á‚·•¶Žš void dfs(int x, int y, char c) { map[y][x] = ' '; for (int i = 0; i < 4; i++) { int nx = x + v[i][0], ny = y + v[i][1]; if (nx >= ...
replace
21
22
21
22
TLE
p00118
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sst...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sst...
replace
28
29
28
29
0
p00118
C++
Runtime Error
#include <iostream> using namespace std; const int N = 22; int w, h, ans; char ch, maze[N][N]; const int cx[] = {1, -1, 0, 0}, cy[] = {0, 0, 1, -1}; void dfs(int x, int y) { maze[x][y] = '-'; for (int i = 0; i < 4; ++i) { int nx = x + cx[i], ny = y + cy[i]; if (0 <= nx && nx < h && 0 <= ny && ny < w && maze...
#include <iostream> using namespace std; const int N = 111; int w, h, ans; char ch, maze[N][N]; const int cx[] = {1, -1, 0, 0}, cy[] = {0, 0, 1, -1}; void dfs(int x, int y) { maze[x][y] = '-'; for (int i = 0; i < 4; ++i) { int nx = x + cx[i], ny = y + cy[i]; if (0 <= nx && nx < h && 0 <= ny && ny < w && maz...
replace
2
3
2
3
0
p00118
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
145
146
145
146
0
p00118
C++
Runtime Error
#include <iostream> using namespace std; typedef long long ll; #define INF 2147483647 int w, h; char a[22][22]; int dir[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1}; int ans = 0; void dfs(int x, int y, char s) { if (x < 0 || x >= h || y < 0 || y >= w || a[x][y] != s) return; char t = a[x][y]; a[x][y] = 'o'; for (in...
#include <iostream> using namespace std; typedef long long ll; #define INF 2147483647 int w, h; char a[102][102]; int dir[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1}; int ans = 0; void dfs(int x, int y, char s) { if (x < 0 || x >= h || y < 0 || y >= w || a[x][y] != s) return; char t = a[x][y]; a[x][y] = 'o'; for (...
replace
6
7
6
7
0
p00118
C++
Runtime Error
#include <cstdio> using namespace std; void func(int, int); int h, w; char za[10][10]; int cnt; int flg, flg1, flg2; int main(void) { int i, j; scanf("%d %d", &h, &w); while (!(h == 0 && w == 0)) { for (i = 0; i < h; i++) { scanf("%s", za[i]); } cnt = 0; for (i = 0; i < h; i++) { for ...
#include <cstdio> using namespace std; void func(int, int); int h, w; char za[101][101]; int cnt; int flg, flg1, flg2; int main(void) { int i, j; scanf("%d %d", &h, &w); while (!(h == 0 && w == 0)) { for (i = 0; i < h; i++) { scanf("%s", za[i]); } cnt = 0; for (i = 0; i < h; i++) { fo...
replace
4
5
4
5
0
p00118
C++
Runtime Error
#include <cstdio> using namespace std; const int MAX_H = 101; const int MAX_W = 101; int H, W; char blocks[MAX_H][MAX_W]; int init() { scanf("%d%d", &H, &W); if (H == 0 && W == 0) return -1; for (int i = 0; i < H; i++) { scanf("%s", blocks[i]); } return 0; } void fill(int row, int col) { char...
#include <cstdio> using namespace std; const int MAX_H = 101; const int MAX_W = 101; int H, W; char blocks[MAX_H][MAX_W]; int init() { scanf("%d%d", &H, &W); if (H == 0 && W == 0) return -1; for (int i = 0; i < H; i++) { scanf("%s", blocks[i]); } return 0; } void fill(int row, int col) { char...
replace
35
36
35
36
-11
p00118
C++
Time Limit Exceeded
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int W, H; string field[100]; bool visit[100][100]; void dfs(int y, int x) { visit[y][x] = true; static int dy[4] = {0, 1, 0, -1}; static int dx[4] = {1, 0, -1, 0}; char c = field[y][x]; for (int i = 0; i < ...
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int W, H; string field[100]; bool visit[100][100]; void dfs(int y, int x) { visit[y][x] = true; static int dy[4] = {0, 1, 0, -1}; static int dx[4] = {1, 0, -1, 0}; char c = field[y][x]; for (int i = 0; i < ...
replace
42
43
42
43
TLE
p00118
C++
Runtime Error
/* * Filename: aoj0118.cpp * Desciption: DFS * Created: 2016-03-02 * Author: JIngwei Xu [mail:xu_jingwei@outlook.com] * */ #include <algorithm> #include <cstring> #include <iostream> #include <stdio.h> #define INT_MAX 2 << 30 using namespace std; // typedef long long ll; int n, m, ans; int dx[4] = {1...
/* * Filename: aoj0118.cpp * Desciption: DFS * Created: 2016-03-02 * Author: JIngwei Xu [mail:xu_jingwei@outlook.com] * */ #include <algorithm> #include <cstring> #include <iostream> #include <stdio.h> #define INT_MAX 2 << 30 using namespace std; // typedef long long ll; int n, m, ans; int dx[4] = {1...
replace
16
17
16
17
0
p00118
C++
Time Limit Exceeded
#include <iostream> #include <string> #include <vector> using namespace std; int H, W; vector<string> map; const vector<int> dx = {0, 1, 0, -1}; const vector<int> dy = {1, 0, -1, 0}; void rec(int x, int y, char c) { map[y][x] = '.'; for (int i = 0; i < 4; i++) { if (0 <= x + dx[i] && x + dx[i] < W && 0 <=...
#include <iostream> #include <string> #include <vector> using namespace std; int H, W; vector<string> map; const vector<int> dx = {0, 1, 0, -1}; const vector<int> dy = {1, 0, -1, 0}; void rec(int x, int y, char c) { map[y][x] = '.'; for (int i = 0; i < 4; i++) { if (0 <= x + dx[i] && x + dx[i] < W && 0 <=...
insert
44
44
44
48
TLE
p00118
C++
Runtime Error
#include <iostream> using namespace std; char table[100][100]; int w, h; const int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; void Dfs(int x, int y, char cur) { table[x][y] = 'X'; for (int i = 0; i < 4; ++i) { int next_x = x + dir[i][0]; int next_y = y + dir[i][1]; if (next_x >= 0 && next_x < w ...
#include <iostream> using namespace std; char table[100][100]; int w, h; const int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; void Dfs(int x, int y, char cur) { table[x][y] = 'X'; for (int i = 0; i < 4; ++i) { int next_x = x + dir[i][0]; int next_y = y + dir[i][1]; if (next_x >= 0 && next_x < w ...
replace
33
34
33
34
-11
p00118
C++
Runtime Error
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <utility> #include <vector> using namespace std; char map[30][30]; pair<int, int> s; int w, h; int cnt; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; class Node { public: int x, y; Node(int _x, int _y) : x(...
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <utility> #include <vector> using namespace std; char map[101][101]; pair<int, int> s; int w, h; int cnt; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; class Node { public: int x, y; Node(int _x, int _y) : ...
replace
10
11
10
11
0
p00118
C++
Memory Limit Exceeded
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; int H, W, dx[] = {1, 0, -1, 0}, dy[] =...
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; int H, W, dx[] = {1, 0, -1, 0}, dy[] =...
insert
46
46
46
47
MLE
p00118
C++
Runtime Error
#include <cmath> #include <cstring> #include <iostream> using namespace std; const int MAX = 20; int N, M; char garden[MAX][MAX + 1]; int num; void dfs(int x, int y, char ch) { garden[x][y] = '.'; for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (abs(dx) + abs(dy) > 1) co...
#include <cmath> #include <cstring> #include <iostream> using namespace std; const int MAX = 100; int N, M; char garden[MAX][MAX + 1]; int num; void dfs(int x, int y, char ch) { garden[x][y] = '.'; for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (abs(dx) + abs(dy) > 1) c...
replace
5
6
5
6
0
p00118
C++
Runtime Error
#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(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; ty...
#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(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; ty...
replace
64
67
64
66
0
p00118
C++
Time Limit Exceeded
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) {} bool unionS...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) {} bool unionS...
insert
31
31
31
33
TLE
p00118
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <stack> #include <string> #include <vector> #define INF 100000000 #define _INF -100000000 #define Loop(i, n) ...
#include <algorithm> #include <cmath> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <stack> #include <string> #include <vector> #define INF 100000000 #define _INF -100000000 #define Loop(i, n) ...
replace
44
45
44
46
0
p00119
C++
Runtime Error
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
replace
76
77
76
77
-11
p00119
C++
Runtime Error
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
replace
86
87
86
87
0
p00119
C++
Runtime Error
#include <algorithm> #include <functional> #include <iostream> #include <vector> #define mp(x, y) make_pair(x, y) #define X first #define Y second using namespace std; typedef pair<int, int> pii; int main(void) { int m; while (cin >> m) { vector<pii> v(m); for (int i = 0; i < m; ++i) { v[i].X = ...
#include <algorithm> #include <functional> #include <iostream> #include <vector> #define mp(x, y) make_pair(x, y) #define X first #define Y second using namespace std; typedef pair<int, int> pii; int main(void) { int m; while (cin >> m) { vector<pii> v(m); for (int i = 0; i < m; ++i) { v[i].X = ...
replace
41
42
41
42
0
p00120
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; int main(void) { int N; string s; while (getline(cin, s)) { long lo...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; int main(void) { int N; string s; while (getline(cin, s)) { long lo...
replace
19
20
19
20
TLE
p00120
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 <iterator> #include <list> #include <m...
#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 <iterator> #include <list> #include <m...
insert
50
50
50
52
TLE
p00120
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define SUPrl 13 #define UNDEFCHAN 1145 int rl; int rs[SUPrl]; int L;...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define SUPrl 13 #define UNDEFCHAN 1145 int rl; int rs[SUPrl]; int L;...
replace
63
65
63
64
TLE
p00121
C++
Time Limit Exceeded
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #inc...
#define _USE_MATH_DEFINES #include <algorithm> #include <cctype> #include <cfloat> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #inc...
replace
53
60
53
56
TLE
p00121
C++
Memory Limit Exceeded
#include <cstdio> #include <queue> #include <vector> using namespace std; int ans[1 << 24]; int adj[] = {-6, -1, 1, 6}; int pos[] = {7, 8, 9, 10, 13, 14, 15, 16}; int encode(const vector<int> &v) { int r = 0; for (int i = 0; i < 8; ++i) { r |= v[pos[i]] << (3 * i); } return r; } void decode(int r, vecto...
#include <cstdio> #include <queue> #include <vector> using namespace std; short ans[1 << 24]; int adj[] = {-6, -1, 1, 6}; int pos[] = {7, 8, 9, 10, 13, 14, 15, 16}; int encode(const vector<int> &v) { int r = 0; for (int i = 0; i < 8; ++i) { r |= v[pos[i]] << (3 * i); } return r; } void decode(int r, vec...
replace
5
6
5
6
MLE
p00121
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) #define reps(i, a, b) for (int i = (a); i < (b); i++) #define INF 1e9 typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int, int> pii; int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; int memo[16434825]; class Data {...
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) #define reps(i, a, b) for (int i = (a); i < (b); i++) #define INF 1e9 typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int, int> pii; int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; char memo[16434825]; class Data ...
replace
9
10
9
10
MLE
p00121
C++
Memory Limit Exceeded
#include <algorithm> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define INF 100000000 typedef long long int ...
#include <algorithm> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define INF 100000000 typedef long long int ...
replace
22
23
22
23
MLE
p00121
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef vector<int> V; typedef queue<V> Q; typedef map<V, int> M; class Solver { private: M min_count; public: Solver() { V p0(8); Q q; int zi; for (int i = 0; i < 8; ++i) { p0[i...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef vector<int> V; typedef queue<V> Q; typedef map<V, int> M; class Solver { private: M min_count; public: Solver() { V p0(8); Q q; int zi; for (int i = 0; i < 8; ++i) { p0[i...
insert
83
83
83
86
TLE
p00121
C++
Memory Limit Exceeded
#include <algorithm> #include <cstring> #include <fstream> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int visited[0xffffff]; inline int is_visited(unsigned s) { if (visited[s & 0xffffff] == -1) return 0; else return 1; } inline void set_visited(unsigne...
#include <algorithm> #include <cstring> #include <fstream> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; short visited[0xffffff]; inline int is_visited(unsigned s) { if (visited[s & 0xffffff] == -1) return 0; else return 1; } inline void set_visited(unsig...
replace
10
11
10
11
MLE
p00121
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int nx; int cnt = 0; int px[4] = {1, -1, 4, -4}; string str = " "; map<string, int> m; queue<int> q; queue<string> sq; q.push(0); sq.push("01234567"); while (!q.empty()) { int siz = q.size(); for (int nsiz = 0; nsiz < siz;...
#include <bits/stdc++.h> using namespace std; int main() { int nx; int cnt = 0; int px[4] = {1, -1, 4, -4}; string str = " "; map<string, int> m; queue<int> q; queue<string> sq; q.push(0); sq.push("01234567"); while (!q.empty()) { int siz = q.size(); for (int nsiz = 0; nsiz < siz;...
replace
48
51
48
50
TLE
p00121
C++
Time Limit Exceeded
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <ostream> #include <queue> #include <stack> #include <string> #include <vector> #define INF 1000000000 #define rep(i, a, b) for (int i = (a);...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <ostream> #include <queue> #include <stack> #include <string> #include <vector> #define INF 1000000000 #define rep(i, a, b) for (int i = (a);...
replace
75
76
75
76
TLE
p00122
C++
Memory Limit Exceeded
#include <iostream> #include <queue> #include <utility> #define P pair<int, int> using namespace std; int main(void) { std::ios_base::sync_with_stdio(); P st; int dx[] = {2, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -2}; int dy[] = {0, 1, -1, 2, -2, 2, -2, 2, -2, 0, 1, -1}; int kx[] = {1, 1, 1, 0, 0, 0, -1, -1, -...
#include <iostream> #include <queue> #include <utility> #define P pair<int, int> using namespace std; int main(void) { std::ios_base::sync_with_stdio(); P st; int dx[] = {2, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -2}; int dy[] = {0, 1, -1, 2, -2, 2, -2, 2, -2, 0, 1, -1}; int kx[] = {1, 1, 1, 0, 0, 0, -1, -1, -...
insert
60
60
60
61
MLE
p00123
C++
Runtime Error
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { double t1, t2; while (scanf("%lf %lf\n", &t1, &t2) != EOF) { printf("%lf %lf\n", t1, t2); const double bound_1[7] = {35.5, 37.5, 40, 43, 50, 55, 70}; const double bound_2[7] = {71, 77, 83, 89, 105, 116, 148}; ...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { double t1, t2; while (scanf("%lf %lf\n", &t1, &t2) != EOF) { const double bound_1[100] = {35.5, 37.5, 40, 43, 50, 55, 70}; const double bound_2[100] = {71, 77, 83, 89, 105, 116, 148}; const string c[100] = {"AAA"...
replace
9
13
9
12
0
p00123
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { double a, b; while (scanf("%lf%lf", &a, &b)) { if (a < 35.5 && b < 71) printf("AAA\n"); else if (a < 37.5 && b < 77) printf("AA\n"); else if (a < 40 && b < 83) printf("A\n"); else if (a < 43 && b < 89) printf("B\n"); else if (a < 50 &&...
#include <stdio.h> int main(void) { double a, b; while (scanf("%lf%lf", &a, &b) != EOF) { if (a < 35.5 && b < 71) printf("AAA\n"); else if (a < 37.5 && b < 77) printf("AA\n"); else if (a < 40 && b < 83) printf("A\n"); else if (a < 43 && b < 89) printf("B\n"); else if (a ...
replace
4
5
4
5
TLE
p00123
C++
Time Limit Exceeded
#include <stdio.h> int main() { float hideo, ruio; while (scanf("%f %f", &hideo, &ruio)) { if (hideo < 35.50 && ruio < 71.00) { printf("AAA\n"); } else if (hideo < 37.50 && ruio < 77.00) { printf("AA\n"); } else if (hideo < 40.00 && ruio < 83.00) { printf("A\n"); } else if (hideo <...
#include <stdio.h> int main() { float hideo, ruio; while (scanf("%f %f", &hideo, &ruio) != EOF) { if (hideo < 35.50 && ruio < 71.00) { printf("AAA\n"); } else if (hideo < 37.50 && ruio < 77.00) { printf("AA\n"); } else if (hideo < 40.00 && ruio < 83.00) { printf("A\n"); } else if (...
replace
3
4
3
4
TLE
p00123
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define l...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define l...
replace
22
23
22
23
TLE
p00123
C++
Time Limit Exceeded
#include <iostream> using namespace std; int result500 = 0, result1000 = 0; void time500m(double time) { if (time < 35.50) { result500 = 0; } else if (time >= 35.50 && time < 37.50) { result500 = 1; } else if (time >= 37.50 && time < 40) { result500 = 2; } else if (time >= 40 && time < 43) { ...
#include <iostream> using namespace std; int result500 = 0, result1000 = 0; void time500m(double time) { if (time < 35.50) { result500 = 0; } else if (time >= 35.50 && time < 37.50) { result500 = 1; } else if (time >= 37.50 && time < 40) { result500 = 2; } else if (time >= 40 && time < 43) { ...
replace
51
53
51
52
TLE
p00124
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; string a[10]; int p[10]; int main() { int n, b, z, c; bool first = true; while (true) { cin >> n; if (!first) cout << endl; first = false; for (int i = 0; i < n; i++) { cin >> a[i] >> b >> z >> c; p[i] = b * 3 + c * 1; ...
#include <iostream> #include <string> using namespace std; string a[10]; int p[10]; int main() { int n, b, z, c; bool first = true; while (true) { cin >> n; if (n == 0) break; if (!first) cout << endl; first = false; for (int i = 0; i < n; i++) { cin >> a[i] >> b >> z >> c; ...
insert
10
10
10
12
TLE
p00127
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string s, r; int i; const char *a[7] = { "afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty ", }; while (cin >> s) { r = ""; for (i = 0; i + 1 < s.size(); i += 2) { if (s[i] > '6' || s[i + 1] > '5') break; r ...
#include <iostream> #include <string> using namespace std; int main() { string s, r; int i; const char *a[7] = { "afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty ", }; while (cin >> s) { r = ""; for (i = 0; i + 1 < s.size(); i += 2) { if (s[i] > '6' || s[i + 1] > '5' || s[i] < '1' || s[i + 1...
replace
12
13
12
13
0
p00127
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include...
replace
64
65
64
65
0
p00127
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string str; string hyo[] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "}; while (cin >> str) { if (str.size() % 2) { cout << "NA" << endl; continue; } string out = ""; for (i...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string str; string hyo[] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "}; while (cin >> str) { if (str.size() % 2) { cout << "NA" << endl; continue; } string out = ""; for (i...
insert
25
25
25
30
0
p00127
C++
Runtime Error
#include <cstdio> #include <iostream> using namespace std; const string hyou[] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "}; int main() { string in; while (cin >> in) { cin.ignore(); if (in.size() % 2 == 1) { cout << "NA" << endl; continue; } bool flag = true; string ans = "...
#include <cstdio> #include <iostream> using namespace std; const string hyou[] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "}; int main() { string in; while (cin >> in) { cin.ignore(); if (in.size() % 2 == 1) { cout << "NA" << endl; continue; } bool flag = true; string ans = "...
replace
16
18
16
18
0
p00127
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string str; vector<string> vs = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "}; while (cin >> str) { if (str.size() % 2) { cout << "NA" << endl; continue; } string ans; for (int i = 0; i < str.size(); i += 2) { i...
#include <bits/stdc++.h> using namespace std; int main() { string str; vector<string> vs = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "}; while (cin >> str) { if (str.size() % 2) { cout << "NA" << endl; continue; } string ans; for (int i = 0; i < str.size(); i += 2) { i...
replace
16
17
16
17
0
p00127
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <ctype.h> #include <exception> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #i...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <ctype.h> #include <exception> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #i...
replace
35
36
35
37
TLE
p00127
C++
Runtime Error
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { string map[6]; map[0] = "abcde"; map[1] = "fghij"; map[2] = "klmno"; map[3] = "pqrst"; map[4] = "uvwxy"; map[5] = "z.?! "; string str; while (cin >> str) { int num[1000] = {0}; int len = str.size(); ...
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { string map[6]; map[0] = "abcde"; map[1] = "fghij"; map[2] = "klmno"; map[3] = "pqrst"; map[4] = "uvwxy"; map[5] = "z.?! "; string str; while (cin >> str) { int num[1000] = {0}; int len = str.size(); ...
replace
17
18
17
28
0
p00128
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { string s; string soro[10] = {"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ", " *= ****", " *=* ***", " *=** **", "...
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { string s; string soro[10] = {"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ", " *= ****", " *=* ***", " *=** **", "...
replace
16
17
16
17
0
p00128
C++
Runtime Error
#include <bits/stdc++.h> #define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v) #define rep(v, n) reps(v, 0, n) #define lep(v, n) reps(v, 1, n + 1) #define rreps(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v) #define rrep(v, n) rreps(v, 0, n - 1) #define rlep(v, n) rreps(v, 1, n) #define show_a(a, ...
#include <bits/stdc++.h> #define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v) #define rep(v, n) reps(v, 0, n) #define lep(v, n) reps(v, 1, n + 1) #define rreps(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v) #define rrep(v, n) rreps(v, 0, n - 1) #define rlep(v, n) rreps(v, 1, n) #define show_a(a, ...
delete
38
39
38
38
0
snum = 02006 snum = 01111