buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> int gcd(int a, int b) { if (!b) { return (a); } return (gcd(b, a % b)); } int main(void) { int a1, a2, a3; int m1, m2, m3; int x, y, z; int x_time, y_time, z_time; int lcm, lcm_2; while (1) { scanf("%d%d%d%d%d%d", &a1, &m1, &a2, &m2, &a3, &m3); if (a1 + m1 + a2 + m2 +...
#include <stdio.h> int gcd(int a, int b) { if (!b) { return (a); } return (gcd(b, a % b)); } int main(void) { int a1, a2, a3; int m1, m2, m3; int x, y, z; long long x_time, y_time, z_time; long long lcm, lcm_2; while (1) { scanf("%d%d%d%d%d%d", &a1, &m1, &a2, &m2, &a3, &m3); if (a1 + m1...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
310
8
int G(x, y) { return y ? G(y, x % y) : x; } #define L(x, y) ((long long)x / G(x, y) * y) n[3], a[3], m[3]; main(i, x) { for (; scanf("%d%d%d%d%d%d", a, m, a + 1, m + 1, a + 2, m + 2), *m; n[0] *= n[1] / G(n[0], n[1]), printf("%d\n", n[2] / G(n[0], n[2]) * n[0])) for (i = 3; i--;) for (x = n[i]...
int G(x, y) { return y ? G(y, x % y) : x; } #define L(x, y) ((long long)x / G(x, y) * y) n[3], a[3], m[3]; main(i, x) { for (; scanf("%d%d%d%d%d%d", a, m, a + 1, m + 1, a + 2, m + 2), *m; n[0] *= n[1] / G(n[0], n[1]), printf("%lld\n", (long long)n[2] / G(n[0], n[2]) * n[0])) for (i = 3; i--;) ...
[["-", 26, 34, 12, 2, 3, 4, 0, 5, 0, 6], ["+", 26, 34, 12, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 16, 31, 16, 31, 74, 0, 24], ["+", 31, 16, 31, 74, 39, 77, 39, 86, 0, 96], ["+", 3, 4, 0, 16, 31, 16, 31, 74, 0, 25]]
0
188
14
#include <stdio.h> #include <stdlib.h> #include <string.h> int a1, a2, a3, m1, m2, m3; int count, x, y, z, sx, sy, sz; int lcm(int a, int b) { int xx, yy, zz; if (a > b) { xx = a; yy = b; } else { xx = b; yy = a; } while (yy > 0) { zz = xx % yy; xx = yy; yy = zz; } return xx ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int a1, a2, a3, m1, m2, m3; int count, x, y, z, sx, sy, sz; long long int lcm(int a, int b) { long long int xx, yy, zz; if (a > b) { xx = a; yy = b; } else { xx = b; yy = a; } while (yy > 0) { zz = xx % yy; xx = yy; yy = ...
[["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
293
6
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> //#include <tuple> #include <functional> #include <set> #include <string.h> #define...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> //#include <tuple> #include <functional> #include <set> #include <string.h> #define...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
446
12
#include <algorithm> #include <cstdio> #include <cstring> #include <ctype.h> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using...
#include <algorithm> #include <cstdio> #include <cstring> #include <ctype.h> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <sstream> #include <stack> #include <stdio.h> #include <string> #include <utility> #include <vector> using...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]]
1
316
8
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { r...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { r...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
205
2
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 #define eps 1e-9 int a1, b1, a2, b2, a3, b3; int main() { while (cin >> a1 >> b1 >> a2 >> b...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 #define eps 1e-9 ll a1, b1, a2, b2, a3, b3; int main() { while (cin >> a1 >> b1 >> a2 >> b2...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]]
1
230
8
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; long long int LCM(long long int a, long long int b) { long long int dummy1, dummy2, dummy; dummy1 = max(a, b); dummy2 = min(a, b); while (true) { dummy = dummy1 % dummy2; dummy1 = dummy2; dummy2 = dummy; if (dummy ...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; long long int LCM(long long int a, long long int b) { long long int dummy1, dummy2, dummy; dummy1 = max(a, b); dummy2 = min(a, b); while (true) { dummy = dummy1 % dummy2; dummy1 = dummy2; dummy2 = dummy; if (dummy ...
[["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]]
1
315
2
#include "bits/stdc++.h" using namespace std; long long int gcd(long long int l, long long int r) { assert(l > 0 && r > 0); if (l > r) return gcd(r, l); else { const long long int num = r % l; if (num) { return gcd(l, num); } else { return l; } } } long long int lca(long long int...
#include "bits/stdc++.h" using namespace std; long long int gcd(long long int l, long long int r) { assert(l > 0 && r > 0); if (l > r) return gcd(r, l); else { const long long int num = r % l; if (num) { return gcd(l, num); } else { return l; } } } long long int lca(long long int...
[["+", 75, 76, 0, 9, 0, 43, 39, 86, 0, 96]]
1
414
2
#include <algorithm> #include <cctype> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; long long int cnt(int kk, int a, int m) { ...
#include <algorithm> #include <cctype> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; long long int cnt(int kk, int a, int m) { ...
[["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 48], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 22]]
1
292
4
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } ll lcm_n(vector<ll> &num) { int l = num[0]; for (int i = 0; i < num.size(); i++) ...
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } ll lcm_n(vector<ll> num) { ll l = num[0]; for (int i = 0; i < num.size(); i++) l ...
[["-", 8, 9, 0, 37, 0, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 37, 0, 16, 31, 23, 0, 25], ["-", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
311
5
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; #define gcd(a, b) __gcd(a, b) #define lcm(a, b) a *b / gcd(a, b) int main() { int a1, m1, a2, m2, a3, m3; while (true) { cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3; if (a1 + m1 + a2 + m2 + a3 + m3 == 0) break; int ...
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; #define gcd(a, b) __gcd(a, b) #define lcm(a, b) a *b / gcd(a, b) int main() { int a1, m1, a2, m2, a3, m3; while (true) { cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3; if (a1 + m1 + a2 + m2 + a3 + m3 == 0) break; ll x...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]]
1
206
2
#include <iostream> using namespace std; typedef long long ll; ll GCD(int a, int b) { if (a > b) { a ^= b; b = a xor b; a = a xor b; } return (a == 0) ? b : GCD(b % a, a); } ll LCM(int a, int b) { return a * b / GCD(a, b); } int main() { int a[3], m[3]; while (1) { cin >> a[0] >> m[0] >> a[1] ...
#include <iostream> using namespace std; typedef long long ll; ll GCD(ll a, ll b) { if (a > b) { a ^= b; b = a xor b; a = a xor 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...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
291
8
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 29) using namespace std; void warshallFloyd(int alt[100][100], int n) { range(k, 1, n + 1) { ran...
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) range(i, 0, b) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; #define INF (1 << 29) using namespace std; void warshallFloyd(int alt[100][100], int n) { range(k, 0, n + 1) { ran...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12...
1
285
10
#include <stdio.h> #define MG 210000000 main() { int n, m; int i, j; int a[40], b[40], c[40], d[40]; int e, f, g = MG, h, l; int k[21][21], flg[21], dk[21], dkn; int flg2[21], dk2[21]; scanf("%d", &n); scanf("%d", &m); for (i = 1; i <= n; i++) { dk[i] = MG; flg[i] = 0; dk2[i] = MG; ...
#include <stdio.h> #define MG 210000000 main() { int n, m; int i, j; int a[40], b[40], c[40], d[40]; int e, f, g = MG, h, l; int k[21][21], flg[21], dk[21], dkn; int flg2[21], dk2[21]; scanf("%d", &n); scanf("%d", &m); for (i = 0; i <= n; i++) { dk[i] = MG; flg[i] = 0; dk2[i] = MG; ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
587
2
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <iostream> #include <stdio.h> #define INF 50000000 using namespace std; int graf[20][20]; int kyo[20]; bool use[20]; void dijk(int ve, int st) { fill(kyo, kyo + ve, INF); fill(use, use + ve, false); kyo[st - 1] = 0; while (1) { int v = -1; ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <iostream> #include <stdio.h> #define INF 50000000 using namespace std; int graf[20][20]; int kyo[20]; bool use[20]; void dijk(int ve, int st) { fill(kyo, kyo + ve, INF); fill(use, use + ve, false); kyo[st] = 0; while (1) { int v = -1; for...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
403
2
#include <iostream> using namespace std; const int INF = 10000000; int map[21][21]; int main(void) { int a, b, c; int d[4]; int ans; int n, m; for (a = 0; a <= 20; a++) { for (b = 0; b <= 20; b++) { map[b][a] = INF; if (b == a) map[b][a] = 0; } } cin >> n; cin >> m; for ...
#include <iostream> using namespace std; const int INF = 10000000; int map[21][21]; int main(void) { int a, b, c; int d[4]; int ans; int n, m; for (a = 0; a <= 20; a++) { for (b = 0; b <= 20; b++) { map[b][a] = INF; if (b == a) map[b][a] = 0; } } cin >> n; cin >> m; for ...
[["-", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 3, 4, 0, 16, 31, 69, 341, 342, 0, 2...
1
357
10
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, m; int D[20][20]; int V; const int INF = 1 << 20; void solve() { for (int k = 0; k < V; k++) { for (int i = 0; i < V; i++) { for (int j = 0; j < V; j++) { D[i][j] = min(D[i][j], D[i][k] + D[k][j]); } ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int n, m; int D[20][20]; int V; const int INF = 1 << 20; void solve() { for (int k = 0; k < V; k++) { for (int i = 0; i < V; i++) { for (int j = 0; j < V; j++) { D[i][j] = min(D[i][j], D[i][k] + D[k][j]); } ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
285
10
def get_path(current, goal, edges, path) next_edges = edges.select{ |e| e[0,2].include?(current) } next_nodes = next_edges.map{ |e| e[0,2].select{|x| x!=current}.first } next_nodes.map do |n| if n == goal path + [n] elsif path.include?(n) nil else get_path(n, goal, edges, path + [n...
def get_path(current, goal, edges, path) next_edges = edges.select{ |e| e[0,2].include?(current) } next_nodes = next_edges.map{ |e| e[0,2].select{|x| x!=current}.first } next_nodes.map do |n| if n == goal path + [n] elsif path.include?(n) nil else get_path(n, goal, edges, path + [n...
[["-", 8, 736, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 8, 736, 0, 662, 12, 652, 486, 652, 735, 22]]
4
401
2
#include <algorithm> #include <array> #include <bitset> #include <cctype> #include <cmath> #include <cstddef> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stri...
#include <algorithm> #include <array> #include <bitset> #include <cctype> #include <cmath> #include <cstddef> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stri...
[["-", 0, 43, 49, 50, 51, 83, 0, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 83, 0, 2, 63, 22]]
1
1,881
2
#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...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
306
4
#include <iostream> #include <string> using namespace std; int expression(); int term(); int factor(); string exp; int p; int expression() { int value = term(); if (exp[p] == '+' || exp[p] == '-') { if (exp[p] == '+') { p++; value += term(); } else { p++; value -= term(); } ...
#include <iostream> #include <string> using namespace std; int expression(); int term(); int factor(); string exp; int p; int expression() { int value = term(); while (exp[p] == '+' || exp[p] == '-') { if (exp[p] == '+') { p++; value += term(); } else { p++; value -= term(); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89]]
1
291
4
#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...
[["-", 15, 339, 51, 16, 31, 16, 31, 103, 0, 125], ["+", 15, 339, 51, 16, 31, 16, 31, 103, 0, 125]]
1
744
2
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
510
2
#include <cctype> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int expression(State &begin); int number(State &begin) { int ret = 0; for (; isdigit(*begin); begin++) { ret = ret * 10 + *begin - '0'; } return ret; } int factor(State &begin) { if (*b...
#include <cctype> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int expression(State &begin); int number(State &begin) { int ret = 0; for (; isdigit(*begin); begin++) { ret = ret * 10 + *begin - '0'; } return ret; } int factor(State &begin) { if (*b...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
328
2
#include <cctype> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int number(State &begin); int term(State &begin); int expression(State &begin); int factor(State &begin); int number(State &begin) { int ret = 0; while (isdigit(*begin)) { ret *= 10; ret += ...
#include <cctype> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int number(State &begin); int term(State &begin); int expression(State &begin); int factor(State &begin); int number(State &begin) { int ret = 0; while (isdigit(*begin)) { ret *= 10; ret += ...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
356
2
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int expr(State &begin); int term(State &begin); int number(State &begin); int factor(State &begin); int number(State &begin) { int ret = 0; while (isdigit(*be...
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <string> using namespace std; typedef string::const_iterator State; int expr(State &begin); int term(State &begin); int number(State &begin); int factor(State &begin); int number(State &begin) { int ret = 0; while (isdigit(*be...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
362
2
# coding: utf-8 # Convert String to List def String2List(s): L = []; tmp = "" for i in s: if i.isdigit(): tmp += i else: if tmp != "": L.append(tmp) tmp = "" L.append(i) if tmp != "": L.append(tmp) return L # ...
# coding: utf-8 # Convert String to List def String2List(s): L = []; tmp = "" for i in s: if i.isdigit(): tmp += i else: if tmp != "": L.append(tmp) tmp = "" L.append(i) if tmp != "": L.append(tmp) return L # ...
[["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["+", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["+", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73]]
5
438
5
R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0} for _ in[0]*int(input()): L=[];t='' for e in input()[:-1]: if e.isdigit():t+=e else: if t:L+=[t];t='' L+=e if t:L+=[t] P,S=[],[] for i in L: if"("==i:S+=i elif")"==i: while"("!=S[-1]:P+=S.pop() S.pop() elif i in R: while S and R[S[-1]]>=R[i]:P+=S.pop...
R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0} for _ in[0]*int(input()): L=[];t='' for e in input()[:-1]: if e.isdigit():t+=e else: if t:L+=[t];t='' L+=e if t:L+=[t] P,S=[],[] for i in L: if"("==i:S+=i elif")"==i: while"("!=S[-1]:P+=S.pop() S.pop() elif i in R: while S and R[S[-1]]>=R[i]:P+=S.pop...
[["+", 0, 41, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
256
5
# -*- coding: utf-8 -*- # 写経した import re class Num: def __str__(self): return str(self.x) def __init__(self, value): self.x = value def __add__(self, value): return o(self.x + value.x) def __sub__(self, value): return o(self.x - value.x) def __mul__(self, value): ...
# -*- coding: utf-8 -*- # 写経した import re class Num: def __str__(self): return str(self.x) def __init__(self, value): self.x = value def __add__(self, value): return Num(self.x + value.x) def __sub__(self, value): return Num(self.x - value.x) def __mul__(self, value): ...
[["-", 0, 14, 8, 196, 0, 37, 0, 652, 63, 22], ["+", 0, 14, 8, 196, 0, 37, 0, 652, 63, 22]]
5
161
8
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] l = "11010: :11011:.:11100:,:11101:-:11110:':11111:?:00000:A:00001:B:00010:C:00011:D:00100:E:00101:F:00110:G:00111:H:01000:I:01001:J:01010:K:01011:L:01100:M:01101:N:011...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] l = "11010: :11011:.:11100:,:11101:-:11110:':11111:?:00000:A:00001:B:00010:C:00011:D:00100:E:00101:F:00110:G:00111:H:01000:I:01001:J:01010:K:01011:L:01100:M:01101:N:011...
[["-", 0, 503, 49, 200, 51, 492, 500, 5, 0, 491], ["+", 0, 503, 49, 200, 51, 492, 500, 5, 0, 491]]
3
386
2
import java.util.*; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String p[] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", ...
import java.util.*; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String p[] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", ...
[["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 19]]
3
517
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class Main { static HashMap<String, String> map = new HashMap<String, String>(); static HashMap<String, String> key = new HashMap<String, String>(); static String[] keys = { "101",...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class Main { static HashMap<String, String> map = new HashMap<String, String>(); static HashMap<String, String> key = new HashMap<String, String>(); static String[] keys = { "101",...
[["+", 0, 124, 49, 200, 51, 518, 0, 5, 0, 491], ["+", 0, 124, 49, 200, 51, 518, 0, 5, 0, 62], ["+", 8, 498, 0, 124, 49, 200, 51, 518, 0, 21], ["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
1,279
8
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String[] c000 = new String[] {"'", "?", "W", ","}; String[] c10010 = new String[] {"Z", "-", "X", "Y"}; String[] c10011 = new String[] {"J", "M", "B...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String[] c000 = new String[] {"'", "?", "W", ","}; String[] c10010 = new String[] {"Z", "-", "X", "Y"}; String[] c10011 = new String[] {"J", "M", "B...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
1,098
2
#include <stdio.h> #include <string.h> char S[6000000], T[60000000], *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?", q[10]; char *t[35] = {"000001", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011...
#include <stdio.h> #include <string.h> char S[6000000], T[60000000], *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?", q[10]; char *t[35] = {"100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
0
398
6
#include <stdio.h> #include <string.h> int main(void) { char map_1[32][2][6] = { {"A", "00000"}, {"B", "00001"}, {"C", "00010"}, {"D", "00011"}, {"E", "00100"}, {"F", "00101"}, {"G", "00110"}, {"H", "00111"}, {"I", "01000"}, {"J", "01001"}, {"K", "01010"}, {"L", "01011"}, {"M", "01100"}, {"N"...
#include <stdio.h> #include <string.h> int main(void) { char map_1[32][2][6] = { {"A", "00000"}, {"B", "00001"}, {"C", "00010"}, {"D", "00011"}, {"E", "00100"}, {"F", "00101"}, {"G", "00110"}, {"H", "00111"}, {"I", "01000"}, {"J", "01001"}, {"K", "01010"}, {"L", "01011"}, {"M", "01100"}, {"N"...
[["-", 49, 50, 51, 83, 0, 83, 0, 5, 0, 6], ["+", 49, 50, 51, 83, 0, 83, 0, 5, 0, 6]]
0
1,031
2
#include <bits/stdc++.h> using namespace std; string a[32] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "1...
#include <bits/stdc++.h> using namespace std; string a[32] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "1...
[["-", 3, 4, 0, 74, 51, 23, 0, 16, 17, 33], ["-", 3, 4, 0, 74, 51, 23, 0, 16, 12, 13]]
1
513
2
#include <bits/stdc++.h> using namespace std; int main() { map<string, char> t2; map<char, string> t1; t1['A'] = "00000"; t1['R'] = "10001"; t1['B'] = "00001"; t1['S'] = "10010"; t1['C'] = "00010"; t1['T'] = "10011"; t1['D'] = "00011"; t1['U'] = "10100"; t1['E'] = "00100"; t1['V'] = "10101"; t...
#include <bits/stdc++.h> using namespace std; int main() { map<string, char> t2; map<char, string> t1; t1['A'] = "00000"; t1['R'] = "10001"; t1['B'] = "00001"; t1['S'] = "10010"; t1['C'] = "00010"; t1['T'] = "10011"; t1['D'] = "00011"; t1['U'] = "10100"; t1['E'] = "00100"; t1['V'] = "10101"; t...
[["-", 0, 11, 31, 69, 341, 342, 0, 5, 0, 6], ["+", 0, 11, 31, 69, 341, 342, 0, 5, 0, 6]]
1
836
4
#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'] ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
914
2
#include <iostream> #include <map> #include <string> using namespace std; int main() { map<char, string> en; en['A'] = "00000"; en['B'] = "00001"; en['C'] = "00010"; en['D'] = "00011"; en['E'] = "00100"; en['F'] = "00101"; en['G'] = "00110"; en['H'] = "00111"; en['I'] = "01000"; en['J'] = "01001...
#include <iostream> #include <map> #include <string> using namespace std; int main() { map<char, string> en; en['A'] = "00000"; en['B'] = "00001"; en['C'] = "00010"; en['D'] = "00011"; en['E'] = "00100"; en['F'] = "00101"; en['G'] = "00110"; en['H'] = "00111"; en['I'] = "01000"; en['J'] = "01001...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
884
2
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
1,102
5
#define _USE_MATH_DEFINES #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory...
#define _USE_MATH_DEFINES #include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
550
2
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> using namespace std; typedef pair<string, string> P; int main() { map<char, string> tr1; tr1['A'] = "00000"; tr1['B'] = "00001"; tr1['C'] = "00010"; tr1['D'] = "00011"; tr1['E'] = "00100"; tr1['F'] = "00101"; ...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> using namespace std; typedef pair<string, string> P; int main() { map<char, string> tr1; tr1['A'] = "00000"; tr1['B'] = "00001"; tr1['C'] = "00010"; tr1['D'] = "00011"; tr1['E'] = "00100"; tr1['F'] = "00101"; ...
[["-", 8, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 11, 12, 5, 0, 6]]
1
999
2
#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++)...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
1,020
2
#include <cstring> #include <iostream> #include <map> using namespace std; #define mk make_pair int main() { map<char, string> former; former['A'] = "00000"; former['B'] = "00001"; former['C'] = "00010"; former['D'] = "00011"; former['E'] = "00100"; former['F'] = "00101"; former['G'] = "00110"; forme...
#include <cstring> #include <iostream> #include <map> using namespace std; #define mk make_pair int main() { map<char, string> former; former['A'] = "00000"; former['B'] = "00001"; former['C'] = "00010"; former['D'] = "00011"; former['E'] = "00100"; former['F'] = "00101"; former['G'] = "00110"; forme...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
894
2
# Aizu Problem 0111: Doctor's Memorable Code # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def bin5(k): b = bin(k)[2:] while len(b) < 5: b = '0' + b return b CODE1 = {' ': '101', "'": '000000', ",": '000011'...
# Aizu Problem 0111: Doctor's Memorable Code # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def bin5(k): b = bin(k)[2:] while len(b) < 5: b = '0' + b return b CODE1 = {' ': '101', "'": '000000', ",": '000011'...
[["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 22]]
5
622
2
#include <cmath> #include <iostream> using namespace std; static const double EPS = 1e-6; int main(void) { double vec[3][4]; double a[3]; double v[3]; cin >> a[0] >> a[1] >> a[2]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { cin >> vec[j][3 - i]; vec[j][3 - i] -= a[j]; }...
#include <cmath> #include <iostream> using namespace std; static const double EPS = 1e-6; int main(void) { double vec[3][4]; double a[3]; double v[3]; cin >> a[0] >> a[1] >> a[2]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { cin >> vec[j][3 - i]; vec[j][3 - i] -= a[j]; }...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
510
2
import java.awt.geom.Point2D; import java.io.*; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.List; im...
import java.awt.geom.Point2D; import java.io.*; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.List; im...
[["-", 8, 196, 0, 7, 8, 196, 0, 97, 0, 22], ["-", 8, 196, 0, 7, 8, 196, 0, 97, 0, 102], ["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 102]]
3
1,135
4
import java.io.*; import java.util.*; public class Main { public void solve() throws IOException { int h, w; while ((h = nextInt()) != 0 | (w = nextInt()) != 0) { char[][] rect = new char[h][w]; for (int i = 0; i < h; i++) { rect[i] = nextToken().toCharArray(); } int[][] data...
import java.io.*; import java.util.*; public class Main { public void solve() throws IOException { int h, w; while ((h = nextInt()) != 0 | (w = nextInt()) != 0) { char[][] rect = new char[h][w]; for (int i = 0; i < h; i++) { rect[i] = nextToken().toCharArray(); } int[][] data...
[["-", 0, 57, 64, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 75, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 75, 196, 0, 7, 15, 16, 12, 22]]
3
573
4
#include <stdio.h> #include <strings.h> int main(void) { int i, j, k, h, w; int m[500][500]; int area, hmin; char str[501]; while (scanf("%d %d", &h, &w), h + w) { area = 0; for (i = 0; i < h; i++) { scanf("%s", str); for (j = 0; j < w; j++) { int c; if (str[j] == '*') ...
#include <stdio.h> #include <strings.h> int main(void) { int i, j, k, h, w; int m[500][500]; int area, hmin; char str[501]; while (scanf("%d %d", &h, &w), h + w) { area = 0; for (i = 0; i < h; i++) { scanf("%s", str); for (j = 0; j < w; j++) { int c; if (str[j] == '*') ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 106], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 98]]
0
282
2
#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>> data(3...
#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>> data(3...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
978
4
#include <cstdio> int main(void) { int n = 0, s[21] = {0}; bool r[501][501]; int h, w, i, j, k, l; char c[501][501]; do { scanf("%d%d", &h, &w); for (i = 0; i < h; i++) { scanf("%s", c[i]); for (j = 0; j < w; j++) { if (c[i][j] == '*') { r[i][j] = false; } els...
#include <cstdio> int main(void) { int n = 0, s[21] = {0}; bool r[501][501]; int h, w, i, j, k, l; char c[501][501]; do { scanf("%d%d", &h, &w); for (i = 0; i < h; i++) { scanf("%s", c[i]); for (j = 0; j < w; j++) { if (c[i][j] == '*') { r[i][j] = false; } els...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
447
4
#include <algorithm> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; int m[501][501]; int main() { int h, w; while (cin >> h >> w, h) { memset(m, 0, sizeof(m)); int x, y; string s; for (y = 1; y <= h; y++) { cin >> s; for (x = 1; x <= w; x+...
#include <algorithm> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; int m[501][501]; int main() { int h, w; while (cin >> h >> w, h) { memset(m, 0, sizeof(m)); int x, y; string s; for (y = 1; y <= h; y++) { cin >> s; for (x = 1; x <= w; x+...
[["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46]]
1
257
2
#include <algorithm> #include <cstdio> #include <iostream> #include <stack> #include <vector> using namespace std; const int MAX_N = 505; const int BLOCK = 1; struct Rect { int h, pos; Rect(int h_, int pos_) { h = h_; pos = pos_; } Rect() {} }; int getLargestRectangle(vector<int> buffer) { int size ...
#include <algorithm> #include <cstdio> #include <iostream> #include <stack> #include <vector> using namespace std; const int MAX_N = 500; const int BLOCK = 1; struct Rect { int h, pos; Rect(int h_, int pos_) { h = h_; pos = pos_; } Rect() {} }; int getLargestRectangle(vector<int> buffer) { int size ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
620
6
// from PKU1125 main() { int i, n, k, a, b, A, B, dist[101][101]; scanf("%d%d", &n, &k); /*initialize*/ memset(dist, 99, sizeof(dist)); for (i = 1; i <= n; i++) dist[i][i] = 0; for (; k; k--) { scanf("%d,%d,%d,%d", &a, &b, &A, &B); dist[a][b] = A, dist[b][a] = B; } { /*warshall-floyd*/ ...
// from PKU1125 main() { int i, n, k, a, b, A, B, dist[101][101]; scanf("%d%d", &n, &k); /*initialize*/ memset(dist, 11, sizeof(dist)); for (i = 1; i <= n; i++) dist[i][i] = 0; for (; k; k--) { scanf("%d,%d,%d,%d", &a, &b, &A, &B); dist[a][b] = A, dist[b][a] = B; } { /*warshall-floyd*/ ...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
0
281
2
#include <math.h> #include <stdio.h> #include <stdlib.h> int i, j, k, n, m, l, x, y, route[2][21][21]; int main() { scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (i != j) route[0][i][j] = 999999999; } } scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d...
#include <math.h> #include <stdio.h> #include <stdlib.h> int i, j, k, n, m, l, x, y, route[2][21][21]; int main() { scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (i != j) route[0][i][j] = 999999999; } } scanf("%d", &m); for (i = 0; i < m; i++) { scanf("%d...
[["+", 15, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 15, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
0
446
2
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <string> #define INF 10000000 int n, m, st, gl, money, pole; int roads[21][21]; int in[4]; std::string input; int check(int start, int goal) { int cost[21]; int used = 0; std::fill(cost...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <string> #define INF 10000000 int n, m, st, gl, money, pole; int roads[21][21]; int in[4]; std::string input; int check(int start, int goal) { int cost[21]; int used = 0; std::fill(cost...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
1
422
4
#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...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22]]
1
322
2
#include <algorithm> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <vector> using namespace std; int dx[12] = {2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1}; int dy[12] = {1, 0, -1, -2, -2, -2, -1, 0, 1, 2, 2, 2}; class State { public: int x; int y; int time; }; int main(void) {...
#include <algorithm> #include <cstdio> #include <cstring> #include <deque> #include <iostream> #include <vector> using namespace std; int dx[12] = {2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1}; int dy[12] = {1, 0, -1, -2, -2, -2, -1, 0, 1, 2, 2, 2}; class State { public: int x; int y; int time; }; int main(void) {...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
509
4
#include <cstring> #include <iostream> #include <queue> using namespace std; typedef pair<int, int> P; typedef pair<P, int> PP; int spx[10], spy[10]; const int jux[12] = {-2, -2, -2, 2, 2, 2, -1, 0, 1, -1, 0, 1}; const int juy[12] = {-1, 0, 1, -1, 0, 1, -2, -2, -2, 2, 2, 2}; int x, y, n; bool pyon() { queue<PP> M;...
#include <cstring> #include <iostream> #include <queue> using namespace std; typedef pair<int, int> P; typedef pair<P, int> PP; int spx[11], spy[11]; const int jux[12] = {-2, -2, -2, 2, 2, 2, -1, 0, 1, -1, 0, 1}; const int juy[12] = {-1, 0, 1, -1, 0, 1, -2, -2, -2, 2, 2, 2}; int x, y, n; bool pyon() { queue<PP> M;...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
443
4
#include <algorithm> #include <iostream> using namespace std; const int MAXN = 11; const int di[12] = {-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2}; const int dj[12] = {2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1}; const int H = 10; const int W = 10; int si, sj; int n; int ti[MAXN], tj[MAXN]; bool dfs(int step, int pi, int ...
#include <algorithm> #include <iostream> using namespace std; const int MAXN = 11; const int di[12] = {-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2}; const int dj[12] = {2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1}; const int H = 10; const int W = 10; int si, sj; int n; int ti[MAXN], tj[MAXN]; bool dfs(int step, int pi, int ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
331
2
#include <iostream> using namespace std; int dx[12] = {-2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2}; int dy[12] = {1, 0, -1, -2, 2, -2, 2, -2, 2, 1, 0, -1}; int fy[9] = {1, 0, -1, 1, 0, -1, 1, 0, -1}; int fx[9] = {1, 1, 1, 0, 0, 0, -1, -1, -1}; int n, x, y, flg; int sx, sy; int t[10][10][10]; void init(); void dfs(int, i...
#include <iostream> using namespace std; int dx[12] = {-2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2}; int dy[12] = {1, 0, -1, -2, 2, -2, 2, -2, 2, 1, 0, -1}; int fy[9] = {1, 0, -1, 1, 0, -1, 1, 0, -1}; int fx[9] = {1, 1, 1, 0, 0, 0, -1, -1, -1}; int n, x, y, flg; int sx, sy; int t[10][10][10]; void init(); void dfs(int, i...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
510
6
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { static String classify(double a, double b) { if (a < 35.5 && b < 71) { return "AAA"; } else if (a < 37.5 && b < 77) { return "AA"; } else if (a < 40 && b < 83) { return "A"; } e...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { static String classify(double a, double b) { if (a < 35.5 && b < 71) { return "AAA"; } else if (a < 37.5 && b < 77) { return "AA"; } else if (a < 40 && b < 83) { return "A"; } e...
[["-", 75, 57, 15, 15, 0, 16, 31, 16, 12, 515], ["+", 75, 57, 15, 15, 0, 16, 31, 16, 12, 499]]
3
272
2
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double n = sc.nextDouble(), m = sc.nextDouble(); if (n < 35.50 && m < 71.00) { System.out.println("AAA"); } else if (n < 37.50 && m < 77.00) { ...
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double n = sc.nextDouble(), m = sc.nextDouble(); if (n < 35.50 && m < 71.00) { System.out.println("AAA"); } else if (n < 37.50 && m < 77.00) { ...
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
242
2
import java.util.Scanner; public class Main { final static double[] LV500 = {35.5, 37.5, 40, 43, 50, 55, 70}; final static double[] LV1000 = {71, 77, 83, 89, 105, 116, 148}; final static String[] lv = {"AAA", "AA", "A", "B", "C", "D", "E"}; public static void main(String[] arg) { Scanner in = new Scanner(...
import java.util.Scanner; public class Main { final static double[] LV500 = {35.5, 37.5, 40, 43, 50, 55, 70}; final static double[] LV1000 = {71, 77, 83, 89, 105, 116, 148}; final static String[] lv = {"AAA", "AA", "A", "B", "C", "D", "E"}; public static void main(String[] arg) { Scanner in = new Scanner(...
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 12, 499]]
3
205
2
#include <stdio.h> int main(void) { float t1, t2; while (scanf("%f %f", &t1, &t2) != EOF) { if (t1 <= 35.50 && t2 < 71.00) printf("AAA\n"); else if (t1 < 37.50 && t2 < 77.00) printf("AA\n"); else if (t1 < 40.00 && t2 < 83.00) printf("A\n"); else if (t1 < 43.00 && t2 < 89.00) ...
#include <stdio.h> int main(void) { float t1, t2; while (scanf("%f %f", &t1, &t2) != EOF) { if (t1 < 35.50 && t2 < 71.00) printf("AAA\n"); else if (t1 < 37.50 && t2 < 77.00) printf("AA\n"); else if (t1 < 40.00 && t2 < 83.00) printf("A\n"); else if (t1 < 43.00 && t2 < 89.00) ...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
177
6
#include <stdio.h> double map[7][2] = {{35.5, 71.0}, {37.5, 77.0}, {40.0, 83.0}, {43.0, 89.0}, {50.0, 105.0}, {55.0, 116.0}, {70.0, 148.0}}; char map1[7][4] = {"AAA", "AA", "A", "B", "C", "D", "E"}; int main(void) { int i; double t1, t2; for (; ~scanf("%lf %lf", &t1, &t2);) { for (i = 0;...
#include <stdio.h> double map[7][2] = {{35.5, 71.0}, {37.5, 77.0}, {40.0, 83.0}, {43.0, 89.0}, {50.0, 105.0}, {55.0, 116.0}, {70.0, 148.0}}; char map1[7][4] = {"AAA", "AA", "A", "B", "C", "D", "E"}; int main(void) { int i; double t1, t2; for (; ~scanf("%lf %lf", &t1, &t2);) { for (i = 0;...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
189
1
#include <stdio.h> int main(void) { double t1, t2; while (scanf("%lf %lf", &t1, &t2) != EOF) { if (t1 < 35.5 && t2 < 71) printf("AAA\n"); else if (t1 < 37.5 && t2 < 77) printf("AA\n"); else if (t1 < 40 && t2 < 83) printf("A\n"); else if (t1 < 43 && t2 < 89) printf("B\n"); ...
#include <stdio.h> int main(void) { double t1, t2; while (scanf("%lf %lf", &t1, &t2) != EOF) { if (t1 < 35.5 && t2 < 71) printf("AAA\n"); else if (t1 < 37.5 && t2 < 77) printf("AA\n"); else if (t1 < 40 && t2 < 83) printf("A\n"); else if (t1 < 43 && t2 < 89) printf("B\n"); ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
176
1
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { double a, b; while (scanf("%lf%lf", &a, &b) == 2) { if (a < 35.5 && b < 71.0) puts("AAA"); else if (a < 37.5 && b < 77.0) puts("AA"); else if (a < 40.0 && b < 83.0) puts("A"); else if (a < ...
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { double a, b; while (scanf("%lf%lf", &a, &b) == 2) { if (a < 35.5 && b < 71.0) puts("AAA"); else if (a < 37.5 && b < 77.0) puts("AA"); else if (a < 40.0 && b < 83.0) puts("A"); else if (a < ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
179
2
#include <stdio.h> int main(void) { float a, b; while (scanf("%f %f", &a, &b) != EOF) { if (a < 35.5 && b < 71.0) { printf("AAA\n"); } else if (a < 37.5 && b < 77.0) { printf("AA\n"); } else if (a < 40.0 && b < 83.0) { printf("A\n"); } else if (a < 43.0 && b < 89.0) { printf(...
#include <stdio.h> int main(void) { float a, b; while (scanf("%f %f", &a, &b) != EOF) { if (a < 35.5 && b < 71.0) { printf("AAA\n"); } else if (a < 37.5 && b < 77.0) { printf("AA\n"); } else if (a < 40.0 && b < 83.0) { printf("A\n"); } else if (a < 43.0 && b < 89.0) { printf(...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
193
2
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #in...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #in...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
777
6
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { string G[8] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA", }; double a, b; while (cin >> a >> b) { int p = (int)(a * 1000), q = (int)(b * 1000); int gp, gq; if (p < 35...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; int main() { string G[8] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA", }; double a, b; while (cin >> a >> b) { int p = (int)(a * 1000), q = (int)(b * 1000); int gp, gq; if (p < 35...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
283
2
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { double t5, t10; string ans; while (cin) { cin >> t5 >> t10; if (t5 < 35.50 && t10 < 71.00) { ans = "AAA"; } else if (t5 < 37.50 && t10 < 77.00) { ...
#include <algorithm> #include <iostream> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { double t5, t10; string ans; while (cin >> t5 >> t10) { if (t5 < 35.50 && t10 < 71.00) { ans = "AAA"; } else if (t5 < 37.50 && t10 < 77.00) { ans ...
[["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]]
1
192
6
#include <stdio.h> int main() { float n500, n1000; while (scanf("%f %f", &n500, &n1000) != EOF) { if (n500 < 35.5 && n1000 < 71) printf("AAA\n"); else if (n500 < 37.5 && n1000 < 77) printf("AA\n"); else if (n500 < 40 && n1000 < 83) printf("A\n"); else if (n500 < 43 && n1000 < 89) ...
#include <stdio.h> int main() { float n500, n1000; while (scanf("%f %f", &n500, &n1000) != EOF) { if (n500 < 35.5 && n1000 < 71) printf("AAA\n"); else if (n500 < 37.5 && n1000 < 77) printf("AA\n"); else if (n500 < 40 && n1000 < 83) printf("A\n"); else if (n500 < 43 && n1000 < 89) ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
172
3
#include <stdio.h> int main(void) { float a, b; while (scanf("%f %f", &a, &b) != EOF) { if (a < 35.5 && b < 71) { printf("AAA\n"); } else if (a <= 7.5 && b < 77) { printf("AA\n"); } else if (a < 40 && b < 83) { printf("A\n"); } else if (a < 43 && b < 89) { printf("B\n"); ...
#include <stdio.h> int main(void) { float a, b; while (scanf("%f %f", &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"); ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16,...
1
194
10
#include <iostream> using namespace std; int main() { double t, ti; cin >> t >> ti; if (t < 35.50 && ti < 71.00) { cout << "AAA" << endl; } else if (t < 37.50 && ti < 77.00) { cout << "AA" << endl; } else if (t < 40.00 && ti < 83.00) { cout << "A" << endl; } else if (t < 43.00 && ti < 89.00)...
#include <iostream> using namespace std; int main() { double t, ti; while (cin >> t >> ti) { if (t < 35.50 && ti < 71.00) { cout << "AAA" << endl; } else if (t < 37.50 && ti < 77.00) { cout << "AA" << endl; } else if (t < 40.00 && ti < 83.00) { cout << "A" << endl; } else if (t...
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
181
6
#include <bits/stdc++.h> using namespace std; int main() { double a, b; while (cin >> a >> b) { if (a < 35.50 && b < 71.00) cout << "AAA" << endl; else if (a < 37.50 && b < 77.00) cout << "AA" << endl; else if (a < 40.00 && b < 83.00) cout << "A" << endl; else if (a < 43.00 && b <...
#include <bits/stdc++.h> using namespace std; int main() { double a, b; while (cin >> a >> b) { if (a < 35.50 && b < 71.00) cout << "AAA" << endl; else if (a < 37.50 && b < 77.00) cout << "AA" << endl; else if (a < 40.00 && b < 83.00) cout << "A" << endl; else if (a < 43.00 && b <...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
171
2
#include <iostream> using namespace std; int main() { double a, b; cin >> a >> b; if (a < 35.50 && b < 71.00) cout << "AAA\n"; else if (a < 37.50 && b < 77.00) cout << "AA\n"; else if (a < 40.00 && b < 83.00) cout << "A\n"; else if (a < 43.00 && b < 89.00) cout << "B\n"; else if (a...
#include <iostream> using namespace std; int main() { double a, b; while (cin >> a >> b) { if (a < 35.50 && b < 71.00) cout << "AAA\n"; else if (a < 37.50 && b < 77.00) cout << "AA\n"; else if (a < 40.00 && b < 83.00) cout << "A\n"; else if (a < 43.00 && b < 89.00) cou...
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
159
6
#include <stdio.h> int bfs(int h, int w, char farm[][102], int vector[][2]); int main(void) { int i, j, k; int H, W; char farm[102][102]; int vector[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; int ans = 0; while (scanf("%d %d\n", &H, &W) != EOF) { if (H == 0 && W == 0) { break; } for (i ...
#include <stdio.h> int bfs(int h, int w, char farm[][102], int vector[][2]); int main(void) { int i, j, k; int H, W; char farm[102][102]; int vector[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; int ans = 0; while (scanf("%d %d\n", &H, &W) != EOF) { if (H == 0 && W == 0) { break; } for (i ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
445
2
#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...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
921
4
#include <cstring> #include <iostream> #include <queue> using namespace std; #define MAX_N 2000 int x[MAX_N][MAX_N]; int col[MAX_N][MAX_N], cnt; int h, w; queue<int> Q; void bfs(int c) { while (!Q.empty()) { int a = Q.front() / 10000; int b = Q.front() % 10000; Q.pop(); if (x[a][b] == x[a - 1][b] ...
#include <cstring> #include <iostream> #include <queue> using namespace std; #define MAX_N 2000 int x[MAX_N][MAX_N]; int col[MAX_N][MAX_N], cnt; int h, w; queue<int> Q; void bfs(int c) { while (!Q.empty()) { int a = Q.front() / 10000; int b = Q.front() % 10000; Q.pop(); if (x[a][b] == x[a - 1][b] ...
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
581
2
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using nam...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using nam...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 79]]
1
585
6
#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) struct UnionFind { vector<int> par; vector<int> rank; UnionFind(int n) { init(n); } void init(int n) { par.resize(n); REP(i, n) par[i] = i; rank.resize(n, 0); } ...
#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) struct UnionFind { vector<int> par; vector<int> rank; UnionFind() {} UnionFind(int n) { init(n); } void init(int n) { par.resize(n); REP(i, n) par[i] = i; rank.res...
[["+", 8, 123, 0, 14, 49, 53, 54, 55, 0, 25], ["+", 0, 122, 8, 123, 0, 14, 8, 9, 0, 45], ["+", 0, 122, 8, 123, 0, 14, 8, 9, 0, 46], ["+", 0, 122, 8, 123, 0, 14, 49, 53, 49, 22], ["+", 8, 123, 0, 14, 49, 53, 54, 55, 0, 24], ["+", 8, 9, 0, 57, 75, 76, 0, 37, 0, 38]]
1
428
6
#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 ...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]]
1
306
2
#include <iostream> using namespace std; char map[101][101]; int vis[101][101]; int ans; int H, W; void dfs(int x, int y, char c) { if (c != map[x][y]) return; if (vis[x][y]) return; vis[x][y] = 1; if (x > 0) dfs(x - 1, y, map[x][y]); if (x < H - 1) dfs(x + 1, y, map[x][y]); if (y > 0) d...
#include <iostream> using namespace std; char map[101][101]; int vis[101][101]; int ans; int H, W; void dfs(int x, int y, char c) { if (c != map[x][y]) return; if (vis[x][y]) return; vis[x][y] = 1; if (x > 0) dfs(x - 1, y, map[x][y]); if (x < H - 1) dfs(x + 1, y, map[x][y]); if (y > 0) d...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
320
6
#include <cstdio> #include <iostream> using namespace std; const int MAX_N = 100; char yard[MAX_N][MAX_N]; int h, w; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; void dfs(int, int, char); int main() { while ((scanf("%d%d", &h, &w)) && h != 0 && w != 0) { for (int i = 0; i < h; i++) { for (int j = 0;...
#include <cstdio> #include <iostream> using namespace std; const int MAX_N = 100; char yard[MAX_N][MAX_N]; int h, w; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; void dfs(int, int, char); int main() { while ((scanf("%d%d", &h, &w)) && h != 0 && w != 0) { for (int i = 0; i < h; i++) { for (int j = 0;...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
327
2
#include <iostream> using namespace std; char f[102][102]; char cnt_c[1]; void DFS(int y, int x) { if (f[y][x] == '.' || f[y][x] == 0 || f[y][x] != cnt_c[0]) return; if (f[y][x] == cnt_c[0]) { f[y][x] = '.'; } DFS(y + 1, x); DFS(y - 1, x); DFS(y, x + 1); DFS(y, x - 1); } int main() { int H, W...
#include <iostream> using namespace std; char f[102][102]; char cnt_c[1]; void DFS(int y, int x) { if (f[y][x] == '.' || f[y][x] == 0 || f[y][x] != cnt_c[0]) return; if (f[y][x] == cnt_c[0]) { f[y][x] = '.'; } DFS(y + 1, x); DFS(y - 1, x); DFS(y, x + 1); DFS(y, x - 1); } int main() { int H, W...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
316
2
#include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; void destroy(vector<string> &field, int i, int j, int symbol) { if (field[i][j] == symbol) { int symbol = field[i][j]; field[i][j] = '-'; destroy(field, i - 1, j, symbol); destroy(field, i + 1, j, symbol)...
#include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; void destroy(vector<string> &field, int i, int j, int symbol) { if (field[i][j] == symbol) { int symbol = field[i][j]; field[i][j] = '-'; destroy(field, i - 1, j, symbol); destroy(field, i + 1, j, symbol)...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]]
1
463
6
#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...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
334
4
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**6) def search(values,hp,vp,item): if not (0<=hp<len(values)): return if not (0<=vp<len(values[hp])): return if item!=values[hp][vp]: return values[hp][vp]=True for dh,dv in list([0,1],[0,-1],[1,0],[-1,0]): search(values,hp+dh,vp+dv,item) # search(val...
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**6) def search(values,hp,vp,item): if not (0<=hp<len(values)): return if not (0<=vp<len(values[hp])): return if item!=values[hp][vp]: return values[hp][vp]=True for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]: search(values,hp+dh,vp+dv,item) # search(values,...
[["-", 0, 14, 8, 196, 0, 7, 12, 652, 63, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 7, 12, 634, 0, 634, 0, 70], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 0, 14, 8, 196, 0, 7, 12, 634, 0, 73]]
5
307
5
def setLine(tempH, line): for i in range(0, len(line)): geo[tempH][i] = line[i:i+1] def solve(): person = 0 for i in range(0,H): for j in range(0,W): if geo[i][j] is not "_": search(i,j) person += 1 print(person) def search(i,j): temp = g...
import sys def setLine(tempH, line): for i in range(0, len(line)): geo[tempH][i] = line[i:i+1] def solve(): person = 0 for i in range(0,H): for j in range(0,W): if geo[i][j] is not "_": search(i,j) person += 1 print(person) def search(i,j): ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22]]
5
416
6
#define N 12 double M[N][1 << N], r, t; D[N], n; double dfs(p, f) { if (M[p][f] < 0) { int i = 0; M[p][f] = 0; for (; i < n; i++) { if (f & 1 << i) continue; if (t = dfs(i, f | 1 << i) + D[p] + D[i] - 2 * sqrt(D[p] * D[i] * 1.0), M[p][f] < t) M[p][f] = t; } } ...
#define N 12 double M[N][1 << N], r, t; D[N], n; double dfs(p, f) { if (M[p][f] < 0) { int i = 0; M[p][f] = 0; for (; i < n; i++) { if (f & 1 << i) continue; if (t = dfs(i, f | 1 << i) + D[p] + D[i] - 2 * sqrt(D[p] * D[i] * 1.0), M[p][f] < t) M[p][f] = t; } } ...
[["+", 8, 9, 0, 1, 0, 11, 12, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 17, 32]]
0
323
2
#include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; string str; const int INF = 1 << 30; double min(double a, double b) { return a > b ? b : a; } void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } double dist(int a, int...
#include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; string str; const int INF = 1 << 30; double min(double a, double b) { return a > b ? b : a; } void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } double dist(int a, int...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
446
4
#include <bits/stdc++.h> using namespace std; #define INF 10000000 int main() { string str; while (getline(cin, str)) { vector<double> vec; stringstream ss(str); int wid, n = 0; ss >> wid; while (!ss.eof()) { double s; ss >> s; vec.push_back(s); n++; } double dp[...
#include <bits/stdc++.h> using namespace std; #define INF 10000000 int main() { string str; while (getline(cin, str)) { vector<double> vec; stringstream ss(str); int wid, n = 0; ss >> wid; while (!ss.eof()) { double s; ss >> s; vec.push_back(s); n++; } double dp[...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
359
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> using namespace std; const int LOOP = 10000; //??????????????° const double EPS = 1e-6; //??????????????¨(?°??????????????????????) int L; int N; //???????????±???????????° //???????????±?????????????????...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> using namespace std; const int LOOP = 10000; //??????????????° const double EPS = 1e-6; //??????????????¨(?°??????????????????????) int L; int N; //???????????±???????????° //???????????±?????????????????...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
401
6
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool f; double w; vector<double> v; int n; double calc(int i, int j) { return sqrt((v[i] + v[j]) * (v[i] + v[j]) - (v[i] - v[j]) * (v[i] - v[j])); } double memo[1 << 12][12]; void dfs(double l, int b, int p) { if (~p) { if (memo[b][p] <= l) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool f; double w; vector<double> v; int n; double calc(int i, int j) { return sqrt((v[i] + v[j]) * (v[i] + v[j]) - (v[i] - v[j]) * (v[i] - v[j])); } double memo[1 << 12][12]; void dfs(double l, int b, int p) { if (~p) { if (memo[b][p] <= l) ...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
394
2
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; while (getline(cin, s)) { double w; vector<double> v; stringstream ss(s); ss >> w; double t; while (ss >> t) v.push_back(t); int n = v.size(); double dp[1 << n][n], inf = 1 << 25; for...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; while (getline(cin, s)) { double w; vector<double> v; stringstream ss(s); ss >> w; double t; while (ss >> t) v.push_back(t); int n = v.size(); double dp[1 << n][n], inf = 1 << 25; for...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
391
2
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.00000001 using namespace std; struct Info { double r; }; double ***dp; void func(char buf[300]) ...
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.00000001 using namespace std; struct Info { double r; }; double ***dp; void func(char buf[300]) ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
976
2
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
[["-", 0, 1, 0, 34, 12, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 34, 12, 11, 12, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 34, 12, 11, 12, 13], ["+", 0, 9, 0, 1, 0, 34, 12, 11, 12, 13]]
1
780
4
#include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; double dp[1 << 12][12]; int n; int c[12]; double d(int back, int next) { return sqrt(pow(c[back] + c[next], 2) - pow(c[back] - c[next], 2)); } double solve(int sta...
#include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; double dp[1 << 12][12]; int n; int c[12]; double d(int back, int next) { return sqrt(pow(c[back] + c[next], 2) - pow(c[back] - c[next], 2)); } double solve(int sta...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
371
2