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
p01137
C++
Time Limit Exceeded
#include <iostream> #include <math.h> using namespace std; int main() { int e; while (cin >> e && e > 0) { int min; min = 1000000; for (int y = 0; y <= sqrt(e); y++) { for (int z = 0; z <= pow(e, 1.0 / 3.0); z++) { int m, x; m = e - y * y + y - z * z * z + z; x = e - y * ...
#include <iostream> #include <math.h> using namespace std; int main() { int e; while (cin >> e && e > 0) { int min; min = 1000000; for (int y = 0; y <= 1000; y++) { for (int z = 0; z <= 100; z++) { int m, x; m = e - y * y + y - z * z * z + z; x = e - y * y - z * z * z; ...
replace
10
12
10
12
TLE
p01137
C++
Time Limit Exceeded
// b #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #inc...
// b #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #inc...
replace
49
51
49
51
TLE
p01137
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int ans = 1000000; for (int i = 0; i < 1000; i++) { if (n < pow(i, 2)) break; for (int j = 0; j < 100; j++) { if (n - pow(i, 2) - pow(j, 3) < 0) continue; ans = ...
#include <cmath> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int ans = 1 << 30; for (int i = 0; i * i * i <= n; i++) { int j = sqrt(n - i * i * i); if (n < i * i * i + j * j) continue; ans = min(ans, i + j + (n - i * i * i - j * j)); } ...
replace
7
16
7
13
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
replace
63
66
63
64
TLE
p01137
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using LL = long long; using P = pair<int, int>; using Tapris = tuple<int, int, int>; #define REP(i, n) for (LL i = 0; i < n; ++i) #define FOR(i, a, n) for (LL i = a; i < n; ++i) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; co...
#include <bits/stdc++.h> using namespace std; using LL = long long; using P = pair<int, int>; using Tapris = tuple<int, int, int>; #define REP(i, n) for (LL i = 0; i < n; ++i) #define FOR(i, a, n) for (LL i = a; i < n; ++i) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; co...
replace
32
41
32
38
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <ut...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <ut...
replace
55
62
55
61
TLE
p01137
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int e; while (cin >> e, e) { bool f = 1; for (int N = 1; f; N++) for (int x = 0; f && x <= N; x++) for (int y = 0; f && y <= N - x; y++) { int z = N - x - y; if (z * z * z + y * y + x == e) { cout << N << en...
#include <iostream> using namespace std; int main() { int e; while (cin >> e, e) { int ans = 1000000; for (int z = 0; z * z * z <= e; z++) for (int y = 0; y * y <= e - z * z * z; y++) { int x = e - y * y - z * z * z; ans = min(ans, x + y + z); } cout << ans << endl; } }
replace
6
17
6
14
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int e; while (cin >> e && e > 0) { int min_sum = 100000; for (int i = 0; i <= e; i++) { int j = sqrt(e - i * i * i); int k = e - i * i * i - j * j; int temp = i + j + k; min_sum = min(temp, m...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int e; while (cin >> e && e > 0) { int min_sum = 100000; for (int i = 0; i * i * i <= e; i++) { int j = sqrt(e - i * i * i); int k = e - i * i * i - j * j; int temp = i + j + k; min_sum = min...
replace
9
10
9
10
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
replace
41
60
41
46
TLE
p01137
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int e, ans; while (1) { cin >> e; if (!e) break; ans = (1e9); for (int z = 0; z * z * z <= e; z++) { int Z = z * z * z; for (int y = 0; y * y <= e - Z; y++) { int Y = y * y; for (int x = 0; x <= e - Y - Z; ...
#include <bits/stdc++.h> using namespace std; int main() { int e, ans; while (1) { cin >> e; if (!e) break; ans = (1e9); for (int z = 0; z * z * z <= e; z++) { int Z = z * z * z; for (int y = 0; y * y <= e - Z; y++) { int Y = y * y; int X = e - Y - Z; if (X...
replace
14
20
14
18
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define PB push_back #define in scanf #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define PB push_back #define in scanf #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int...
replace
20
25
20
24
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int e; while (cin >> e, e) { int ans = 1000000; for (int z = 0; z <= e; ++z) { for (int y = 0; y * y + z * z * z <= e; ++y) { int x = e - y * y - z * z * z; ans = min(ans, x + y + z); } } cout << a...
#include <algorithm> #include <iostream> using namespace std; int main() { int e; while (cin >> e, e) { int ans = 1000000; for (int z = 0; z * z * z <= e; ++z) { for (int y = 0; y * y + z * z * z <= e; ++y) { int x = e - y * y - z * z * z; ans = min(ans, x + y + z); } } c...
replace
7
8
7
8
TLE
p01137
C++
Time Limit Exceeded
#include <iostream> using namespace std; int solve(int E) { int ans = 1000000; for (int y = 0; y <= E; ++y) { for (int z = 0; z <= E; ++z) { int x = E - y * y - z * z; ans = min(ans, x + y + z); } } return ans; } int main() { int E; while (cin >> E && E > 0) { cout << solve(E) << e...
#include <iostream> using namespace std; int solve(int E) { int ans = 1000000; int x; for (int y = 0; y * y <= E; ++y) { for (int z = 0; z * z * z <= E; ++z) { x = E - y * y - z * z * z; if (x >= 0) ans = min(ans, x + y + z); } } return ans; } int main() { int E; while (cin >...
replace
5
9
5
11
TLE
p01137
C++
Time Limit Exceeded
#include <iostream> using namespace std; int E; int main() { while (cin >> E && E > 0) { int min = 1000001; for (int z = 0; z < E; ++z) { for (int y = 0; y * y < E - z * z * z; ++y) { int x = E - z * z * z - y * y; if (x + y + z < min) min = x + y + z; } } cout ...
#include <iostream> using namespace std; int E; int main() { while (cin >> E) { if (E == 0) break; int min = 100000001; for (int z = 0; z * z * z < E + 1; ++z) { for (int y = 0; y * y < E - z * z * z + 1; ++y) { int x = E - z * z * z - y * y; if (x + y + z < min) mi...
replace
6
10
6
12
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int e; int main() { vector<int> ans; while (cin >> e, e) { int m = 1000000; for (int i = 0; i <= e; ++i) { if (i * i * i > e) break; for (int j = 0; j <= e; ++j) { if (i * i * i + j...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int e; int main() { vector<int> ans; while (cin >> e, e) { int m = 1000000; for (int i = 0; i <= e; ++i) { if (i * i * i > e) break; for (int j = 0; j <= e; ++j) { if (i * i * i + j...
replace
17
21
17
19
TLE
p01137
C++
Time Limit Exceeded
#include <iostream> #include <math.h> using namespace std; int main() { int ene; while (cin >> ene && ene > 0) { int min = 1000000; for (int z = 0; z <= 100; z++) { int xy = ene - z * z * z; if (xy >= 0) for (int y = 0; y <= xy; y++) { int x = xy - y * y; if (x >= 0) ...
#include <iostream> #include <math.h> using namespace std; int main() { int ene; while (cin >> ene && ene > 0) { int min = 1000000; for (int z = 0; z <= 100; z++) { int xy = ene - z * z * z; if (xy >= 0) for (int y = 0; y <= 10000; y++) { int x = xy - y * y; if (x >= ...
replace
10
11
10
11
TLE
p01137
C++
Time Limit Exceeded
#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
65
71
65
75
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, s, e) for (int i = (s); i < (e); i++) #define REPI(...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, s, e) for (int i = (s); i < (e); i++) #define REPI(...
replace
51
64
51
56
TLE
p01137
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n != 0) { int a; a = 1e9; for (int i = 0; i < pow(n, 0.34); i++) { for (int j = 0; j <= pow(n, 0.5); j++) { int t = (n - i * i * i - j * j); if (t >= 0) a = min(i + j + t, a); } ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n != 0) { int a; a = 1e9; for (int i = 0; i * i * i <= n; i++) { for (int j = 0; j * j + i * i * i <= n; j++) { int t = (n - i * i * i - j * j); if (t >= 0) a = min(i + j + t, a); ...
replace
9
11
9
11
TLE
p01137
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(x) for (auto it = (x).begin(); it != (x).end(); it++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define INF (int)1e9 #defin...
#include <bits/stdc++.h> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(x) for (auto it = (x).begin(); it != (x).end(); it++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define INF (int)1e9 #defin...
replace
28
34
28
34
TLE
p01137
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1000000000; int main(void) { int e; while (cin >>...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1000000000; int main(void) { int e; while (cin >>...
replace
24
25
24
25
TLE
p01137
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define FOR(i, a, b) for (int i = int(a); i < int(b); i++) #define REP(i, b) FOR(i, 0, b) int read() { int i; scanf("%lld", &i); return i; } signed main() { while (true) { int e = read(); int ans = 100000; int m; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define FOR(i, a, b) for (int i = int(a); i < int(b); i++) #define REP(i, b) FOR(i, 0, b) int read() { int i; scanf("%lld", &i); return i; } signed main() { while (true) { int e = read(); int ans = 100000; int m; ...
replace
29
32
29
32
TLE
p01137
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int main() { int e, m; while (cin >> e && e > 0) { m = e; for (int z = 0; pow(z, 3) <= e; z++) { for (int y = 0; pow(z, 3) + pow(y, 2) <= e; y++) { // int z=e-x-pow(y,2); int x = e - (pow(z, 3) + pow(y, 2)); if (x + y +...
#include <cmath> #include <iostream> using namespace std; int main() { int e, m; while (cin >> e && e > 0) { m = e; for (int z = 0; pow(z, 3) <= e; z++) { int pz = pow(z, 3); for (int y = 0; pz + pow(y, 2) <= e; y++) { int x = e - (pz + pow(y, 2)); if (x + y + z < m) m...
replace
9
12
9
12
TLE
p01138
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int imos[86410] = {}; for (int i = 0; i < n; i++) { int a, b, c, d, e, f; scanf("%d:%d:%d", a, b, c); scanf("%d:%d:%d", d, e, f); imos[a * 3600 + b * 60 + c]++; imos[d * 3600...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int imos[86410] = {}; for (int i = 0; i < n; i++) { int a, b, c, d, e, f; char ch; cin >> a >> ch >> b >> ch >> c; cin >> d >> ch >> e >> ch >> f; imos[a * 3600 + b * 60 + c]...
replace
9
11
9
12
-11
p01138
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> using namespace std; typedef pair<int, int> P; int N; P G[10000]; int solve() { int res = 0; int c = 0; for (int i = 0; i < 2 * N; i++) { if (G[i].second) { c++; res = max(c, res); } else { c--; } } return res; } int main()...
#include <algorithm> #include <iostream> #include <map> using namespace std; typedef pair<int, int> P; int N; P G[20000]; int solve() { int res = 0; int c = 0; for (int i = 0; i < 2 * N; i++) { if (G[i].second) { c++; res = max(c, res); } else { c--; } } return res; } int main()...
replace
7
8
7
8
0
p01138
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n; int imos[86400]; void solve() { rep(i, n) { int s[3]; int t[3]; scanf("%d:%d:%d", &s[0], &s[1], &s[2]); scanf("%d:%d:%d", &t[0], &t[1], &t[2]); // hh:mm:ss を 秒に変換 int S = s[2] + 60 * (s[1]...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n; int imos[86400]; void solve() { rep(i, n) { int s[3]; int t[3]; scanf("%d:%d:%d", &s[0], &s[1], &s[2]); scanf("%d:%d:%d", &t[0], &t[1], &t[2]); // hh:mm:ss を 秒に変換 int S = s[2] + 60 * (s[1]...
replace
23
25
23
25
0
p01138
C++
Runtime Error
#include <bits/stdc++.h> #define _ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const int MAX_N = 1000; pair<int, int> p[M...
#include <bits/stdc++.h> #define _ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const int MAX_N = 10000; pair<int, int> p[...
replace
8
9
8
9
0
p01138
C++
Time Limit Exceeded
#include <iostream> #define secondMAX (23 * 60 * 59 + 60 * 60 + 59) using namespace std; int main() { int n; int h, m, s; char gav; int table[secondMAX + 1]; int max; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i <= secondMAX; i++) table[i] = 0; for (int i = 0; i...
#include <iostream> #define secondMAX (23 * 60 * 60 + 59 * 60 + 59) using namespace std; int main() { int n; int h, m, s; char gav; int table[secondMAX + 1]; int max; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i <= secondMAX; i++) table[i] = 0; for (int i = 0; i...
replace
2
3
2
3
TLE
p01138
C++
Time Limit Exceeded
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < n; ++i) #define RREP(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < n; ++i) #define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i) #define ALL(v) (v).begin(), (v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(uniqu...
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < n; ++i) #define RREP(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < n; ++i) #define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i) #define ALL(v) (v).begin(), (v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(uniqu...
replace
54
55
54
56
TLE
p01139
C++
Runtime Error
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2014 #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n)...
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2014 #include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <numeric> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i = p; i < (int)(n)...
replace
26
27
26
27
0
p01139
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int w, h; vector<string> ss; bool is_white[103][103]; bool is_black[103][103]; void dfs(int x_, int y_, bool (*f_)[103], bool f2) { // cout<<x_<<","<<y_<<endl; if (f_[...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; int w, h; vector<string> ss; bool is_white[103][103]; bool is_black[103][103]; void dfs(int x_, int y_, bool (*f_)[103], bool f2) { // cout<<x_<<","<<y_<<endl; if (f_[...
replace
28
29
28
29
0
p01139
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define INF 999999999 vector<string> a(52); queue<pair<int, int>> q[2]; bool c[2][52][52]; int f[2]; void search(int x, int y, int z) { pair<int, int> r; if (a[x...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define INF 999999999 vector<string> a(52); queue<pair<int, int>> q[2]; bool c[2][52][52]; int f[2]; void search(int x, int y, int z) { pair<int, int> r; if (a[x...
replace
63
64
63
64
0
p01139
C++
Memory Limit Exceeded
#define DEBUG_ON #define CONDITION true using namespace std; /*{{{*/ #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include...
#define DEBUG_ON #define CONDITION true using namespace std; /*{{{*/ #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include...
insert
242
242
242
244
MLE
p01139
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) int A[60][60]; int B[60][60]; int x, y; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int dfs(int x, int y) { A[x][y] = 3; int ans = 0; REP(i, 4) { int xx = dx[i] + x; int yy = dy[i] + y; if...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) int A[60][60]; int B[60][60]; int x, y; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int dfs(int x, int y) { A[x][y] = 3; int ans = 0; REP(i, 4) { int xx = dx[i] + x; int yy = dy[i] + y; if...
replace
37
39
37
39
0
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int w[1500], h[1500]; cin >> n >> m; for (int i = 0; i < n; i++) scanf("%d", &w[i]); for (int i = 0; i < m; i++) scanf("%d", &h[i]); while (n) { vector<int> x; vector<int> y; for (int i = 0; i < n; i++) { int a =...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int w[1500], h[1500]; cin >> n >> m; for (int i = 0; i < n; i++) scanf("%d", &w[i]); for (int i = 0; i < m; i++) scanf("%d", &h[i]); while (n) { vector<int> x(1501 * 1001); vector<int> y(1501 * 1001); for (int i = 0; i...
replace
12
14
12
14
-11
p01140
C++
Runtime Error
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9 + 7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int main() { int n, m; while (cin >> n >> m, n) { int num[2500100] = {}; int takasa[1600] = {}; short num2...
#include <bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9 + 7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int main() { int n, m; while (cin >> n >> m, n) { int num[2500100] = {}; int takasa[10600] = {}; int num2[...
replace
15
17
15
17
-11
p01140
C++
Runtime Error
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <stack> #include <string> #include <vector> #define rep(i, x) for (int i = 0; i < x; i++) #define rrep(i, x) for (int i = x - 1; i >= 0; i--) #define rep_to(a, i, x) for (int i = a; i < x; i++) using...
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <stack> #include <string> #include <vector> #define rep(i, x) for (int i = 0; i < x; i++) #define rrep(i, x) for (int i = x - 1; i >= 0; i--) #define rep_to(a, i, x) for (int i = a; i < x; i++) using...
replace
24
26
24
26
0
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int MAX = 100000; int main() { for (int n, m; cin >> n >> m, n && m;) { int h[1500], w[1500], a0[MAX + 10] = {}, a1[MAX + 10] = {}; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) cin >> w[i]; for (int i = 1; i <= n;...
#include <bits/stdc++.h> using namespace std; const int MAX = 1500000; int main() { for (int n, m; cin >> n >> m, n && m;) { int h[1500], w[1500], a0[MAX + 10] = {}, a1[MAX + 10] = {}; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) cin >> w[i]; for (int i = 1; i <= n...
replace
2
3
2
3
0
p01140
Python
Time Limit Exceeded
from collections import Counter while True: N, M = map(int, input().split()) if N == 0 and M == 0: break H = [int(input()) for _ in range(N)] W = [int(input()) for _ in range(M)] all_H = Counter( sorted([sum(H[i:j]) for i in range(N) for j in range(i + 1, N + 1)]) ) all_W = ...
from collections import Counter while True: N, M = map(int, input().split()) if N == 0 and M == 0: break H = [int(input()) for _ in range(N)] W = [int(input()) for _ in range(M)] all_H = [] for i in range(N): s = 0 for j in range(i, N): s += H[j] ...
replace
8
14
8
25
TLE
p01140
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int w, h; cin >> w >> h; int wl[1501] = {}, hl[1501] = {}; int wb, hb; int i, j, k; while (w != 0) { for (i = 0; i < w; i++) { cin >> wb; wl[i + 1] = wl[i] + wb; } for (i = 0; i < h; i++) { ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int w, h; cin >> w >> h; int wl[1501] = {}, hl[1501] = {}; int wb, hb; int i, j, k; while (w != 0) { for (i = 0; i < w; i++) { cin >> wb; wl[i + 1] = wl[i] + wb; } for (i = 0; i < h; i++) { ...
replace
44
45
44
45
TLE
p01140
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int w[1501] = {0}, h[1501] = {0}; int W[2250000] = {0}, H[2250000] = {0}; int sum(int *a, int i, int n, int size) { int s = 0; for (int j = n; j--;) { if (i >= size) { return 0; } s += a[i++]; } return s; } int ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int w[1501] = {0}, h[1501] = {0}; int W[2250000] = {0}, H[2250000] = {0}; int sum(int *a, int i, int n, int size) { int s = 0; for (int j = n; j--;) { if (i >= size) { return 0; } s += a[i++]; } return s; } int ...
replace
23
24
23
24
0
p01140
C++
Time Limit Exceeded
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
replace
75
109
75
86
TLE
p01140
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int H, W; while (cin >> H >> W, H + W) { int h[1001] = {}; int w[1001] = {}; map<int, int> setH; map<int, int> setW; for (int i = 1; i <= H; i++) cin >> h[i]; for (int i = 1; i <= W; i++) ...
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int H, W; while (cin >> H >> W, H + W) { int h[1501] = {}; int w[1501] = {}; map<int, int> setH; map<int, int> setW; for (int i = 1; i <= H; i++) cin >> h[i]; for (int i = 1; i <= W; i++) ...
replace
9
11
9
11
0
p01140
C++
Runtime Error
#include <stdio.h> #include <string.h> int main(void) { int sw[150001], sum, n, m, i, j, k, count, w[1500], h[1500]; while (1) { scanf("%d%d", &n, &m); if (n == 0 && m == 0) break; for (i = 0; i < n; i++) scanf("%d", &h[i]); for (i = 0; i < m; i++) scanf("%d", &w[i]); memset(s...
#include <stdio.h> #include <string.h> int main(void) { int sw[1500001], sum, n, m, i, j, k, count, w[1500], h[1500]; while (1) { scanf("%d%d", &n, &m); if (n == 0 && m == 0) break; for (i = 0; i < n; i++) scanf("%d", &h[i]); for (i = 0; i < m; i++) scanf("%d", &w[i]); memset(...
replace
4
5
4
5
0
p01140
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int h[1024 * 1500]; int w[1024 * 1500]; int getInt() { int c = getchar(); int ret = 0; while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret += c - '0'; c = getchar(); } return ret; } int...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int h[1024 * 1500]; int w[1024 * 1500]; int getInt() { int c = getchar(); int ret = 0; while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret *= 10; ret += c - '0'; c = getchar(); } ret...
insert
16
16
16
17
TLE
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; bool solve() { int n, m; cin >> n >> m; if (n == 0 && m == 0) return false; vector<int> h(n + 1), w(m + 1); for (int i = 1; i <= n; i++) { cin >> h[i]; h[i] += h[i - 1]; } for (int i = 1; i <= m; i++...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; bool solve() { int n, m; cin >> n >> m; if (n == 0 && m == 0) return false; vector<int> h(n + 1), w(m + 1); for (int i = 1; i <= n; i++) { cin >> h[i]; h[i] += h[i - 1]; } for (int i = 1; i <= m; i++...
replace
20
21
20
21
0
p01140
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define inf 1e9 #define ll long long #define ull unsigned long long #define M 1000000007 #define P pair<int, int> #define PLL pair<ll, ll> #define FOR(i, m, n) for (int i = m; i < n; i++) #define RFOR(i, m, n) for (int i = m; i >= n; i--) #define rep(i, n) FOR(i, 0, n) #def...
#include <bits/stdc++.h> using namespace std; #define inf 1e9 #define ll long long #define ull unsigned long long #define M 1000000007 #define P pair<int, int> #define PLL pair<ll, ll> #define FOR(i, m, n) for (int i = m; i < n; i++) #define RFOR(i, m, n) for (int i = m; i >= n; i--) #define rep(i, n) FOR(i, 0, n) #def...
replace
41
42
41
44
TLE
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; int main() { int n, m; while (cin >> n >> m and (n or m)) { int h[1001], w[1001]; vector<int> hh(1500001, 0), ww(1500001, 0); rep(i, n) cin >> h[i]; rep(i, m) cin >> w[...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; int main() { int n, m; while (cin >> n >> m and (n or m)) { int h[1501], w[1501]; vector<int> hh(1500001, 0), ww(1500001, 0); rep(i, n) cin >> h[i]; rep(i, m) cin >> w[...
replace
10
11
10
11
0
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; while (cin >> N >> M && N) { vector<int> h(N + 1),...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; while (cin >> N >> M && N) { vector<int> h(N + 1),...
replace
21
22
21
22
0
p01140
C++
Memory Limit Exceeded
#include <iostream> #include <map> #include <vector> using namespace std; int combi(int n) { return n * (n - 1) / 2; } int main() { int n, m; while (cin >> n >> m, n || m) { vector<int> x, y; x.push_back(0); y.push_back(0); for (int i = 0; i < n; i++) { int h; cin >> h; h += y[...
#include <iostream> #include <map> #include <vector> using namespace std; int combi(int n) { return n * (n - 1) / 2; } int main() { int n, m; while (cin >> n >> m, n || m) { vector<int> x, y; x.push_back(0); y.push_back(0); for (int i = 0; i < n; i++) { int h; cin >> h; h += y[...
replace
26
27
26
27
MLE
p01140
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fi first #define se second #define fcout(n) cout << fixed << setprecision((n...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define fi first #define se second #define fcout(n) cout << fixed << setprecision((n...
replace
75
76
75
76
0
p01140
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int s1[2000], s2[2000]; int main() { int n, m; while (scanf("%d%d", &n, &m), n) { rep(i, n) scanf("%d", &s1[i + 1]); rep(i, m) scanf("%d", &s2[i + 1]); for (int i = 1; i <= n; i++) s1[i] += s1[i - 1]; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int s1[2000], s2[2000]; int main() { int n, m; while (scanf("%d%d", &n, &m), n) { rep(i, n) scanf("%d", &s1[i + 1]); rep(i, m) scanf("%d", &s2[i + 1]); for (int i = 1; i <= n; i++) s1[i] += s1[i - 1]; ...
replace
15
18
15
20
TLE
p01140
C++
Memory Limit Exceeded
#include <map> #include <stdio.h> #include <vector> auto solve(int N, int M) -> int { using namespace std; vector<int> h(N); vector<int> w(M); for (int i = 0; i < N; i++) { int x; scanf("%d", &x); h[i] = x; } for (int i = 0; i < M; i++) { int x; scanf("%d", &x); w[i] = x; } ma...
#include <map> #include <stdio.h> #include <vector> auto solve(int N, int M) -> int { using namespace std; vector<int> h(N); vector<int> w(M); for (int i = 0; i < N; i++) { int x; scanf("%d", &x); h[i] = x; } for (int i = 0; i < M; i++) { int x; scanf("%d", &x); w[i] = x; } ma...
replace
20
22
20
22
MLE
p01140
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long i64; typedef long double ld; typedef pair<i64, i64> P; #define rep(i, s, e) for (int i = (s); i <= (e); i++) int n; int m; int hmp[1500 * ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long i64; typedef long double ld; typedef pair<i64, i64> P; #define rep(i, s, e) for (int i = (s); i <= (e); i++) int n; int m; int hmp[1500 * ...
replace
25
26
25
26
0
p01140
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define out(S) cout << (S) << endl; #define ShowAll(collection) \ for (auto i : collection) { \ out(i); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define out(S) cout << (S) << endl; #define ShowAll(collection) \ for (auto i : collection) { \ out(i); ...
replace
36
46
36
37
TLE
p01140
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) const int N = 100; int h, w; int A[N]; int B[N]; void init() {} bool input() { cin >> h >> w; if (h == 0) return 0; rep(i, h) cin >> A[i]; rep(i, w) cin >> B[i]; retur...
#include <bits/stdc++.h> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) const int N = 1600; int h, w; int A[N]; int B[N]; void init() {} bool input() { cin >> h >> w; if (h == 0) return 0; rep(i, h) cin >> A[i]; rep(i, w) cin >> B[i]; retu...
replace
7
8
7
8
0
p01140
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef tuple<int, int> duo; const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int Mod = 1000000000 + 0; //{{{ templates #define TT_ template <typename T> inline #define TTF_ tem...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef tuple<int, int> duo; const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int Mod = 1000000000 + 0; //{{{ templates #define TT_ template <typename T> inline #define TTF_ tem...
replace
80
87
80
87
TLE
p01140
C++
Time Limit Exceeded
#include <iostream> #include <map> #include <set> using namespace std; int main() { while (1) { int N, M; cin >> N >> M; if (N == 0 && M == 0) break; int H[N], W[M]; for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < M; i++) { cin >> W[i]; } set<i...
#include <iostream> #include <map> #include <set> using namespace std; int main() { while (1) { int N, M; cin >> N >> M; if (N == 0 && M == 0) break; int H[N], W[M]; for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < M; i++) { cin >> W[i]; } set<i...
replace
46
52
46
50
TLE
p01142
C++
Memory Limit Exceeded
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <tuple> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPS(i, n) for (int i = 1; i <= (int)n; i++) typedef vector<int> vi; typedef pair<int, int> pii; int d[10] = {0, -1, 0, 1, 0...
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <tuple> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define REPS(i, n) for (int i = 1; i <= (int)n; i++) typedef vector<int> vi; typedef pair<int, int> pii; int d[10] = {0, -1, 0, 1, 0...
replace
21
23
21
23
MLE
p01143
C++
Runtime Error
#include <bits/stdc++.h> typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define DECIM8 fixed << setprecision(8) #define SZ(a) int((a).size()) #define SORT(c) s...
#include <bits/stdc++.h> typedef long long LL; // container util //------------------------------------------ #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define DECIM8 fixed << setprecision(8) #define SZ(a) int((a).size()) #define SORT(c) s...
replace
41
42
41
46
-8
p01143
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n, m, p; cin >> n >> m >> p; if (n == 0 && m == 0 && p == 0) break; int count = 0, ans, a; lp(i, n) { cin >> a; count += a; if (i == m - 1) ans =...
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n, m, p; cin >> n >> m >> p; if (n == 0 && m == 0 && p == 0) break; int count = 0, ans, a; lp(i, n) { cin >> a; count += a; if (i == m - 1) ans =...
replace
19
20
19
23
-8
p01143
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <utility> #include <vector> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i, n) for (i...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <utility> #include <vector> #define ll long long int #define ld long double #define INF 1000000000 #define EPS 0.0000000001 #define rep(i, n) for (i...
replace
31
32
31
32
0
p01143
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, m, p; int num[101]; while (cin >> n >> m >> p, n | m | p) { int total = 0; for (int i = 1; i <= n; i++) { cin >> num[i]; total += num[i] * (100 - p); } if (!num[n]) { cout << 0 << endl; continue; } cout ...
#include <iostream> using namespace std; int main() { int n, m, p; int num[101]; while (cin >> n >> m >> p, n | m | p) { int total = 0; for (int i = 1; i <= n; i++) { cin >> num[i]; total += num[i] * (100 - p); } if (!num[m]) { cout << 0 << endl; continue; } cout ...
replace
13
14
13
14
0
p01143
C++
Runtime Error
#include <iostream> using namespace std; int main() { int n, m, p, x[1000]; while (1) { cin >> n >> m >> p; int sum = 0; if (n == 0 && m == 0 && p == 0) break; p = 100 - p; for (int i = 0; i < n; i++) { cin >> x[i]; sum += x[i]; } p *= sum; p = p / x[m - 1]; ...
#include <iostream> using namespace std; int main() { int n, m, p, x[1000]; while (1) { cin >> n >> m >> p; int sum = 0; if (n == 0 && m == 0 && p == 0) break; p = 100 - p; for (int i = 0; i < n; i++) { cin >> x[i]; sum += x[i]; } p *= sum; if (x[m - 1] == 0) ...
replace
20
21
20
25
-8
p01143
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int N, M, P; while (1) { cin >> N >> M >> P; double A[N]; double sum = 0; double num = 0; double money; for (int i = 1; i <= N; i++) { cin >> A[i]; sum += A[i] * 100; if (i == M) { num = A[i]; } } ...
#include <iostream> using namespace std; int main() { int N, M, P; while (1) { cin >> N >> M >> P; if ((N == 0) && (M == 0) && (P == 0)) { break; } double A[N]; double sum = 0; double num = 0; double money; for (int i = 1; i <= N; i++) { cin >> A[i]; sum += A[i] ...
insert
8
8
8
11
TLE
p01144
C++
Runtime Error
#include <algorithm> #include <iostream> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; bool cmp(pair<int, int> &x, pair<int, int> &y) { return x.second > y.second; } int main(void) { int n, m; while (cin >> n >> m, n > 0) { int j = 0, ans = 0;...
#include <algorithm> #include <iostream> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; bool cmp(pair<int, int> &x, pair<int, int> &y) { return x.second > y.second; } int main(void) { int n, m; while (cin >> n >> m, n > 0) { int j = 0, ans = 0;...
insert
27
27
27
29
0
p01144
C++
Runtime Error
/* Princess's Marriage http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2019&lang=jp 20:10 */ #include <algorithm> #include <iostream> #include <vector> using std::cin; using std::cout; using std::min; using std::pair; using std::sort; using std::vector; #define INF 999999999; long long int N, M; vector<pai...
/* Princess's Marriage http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2019&lang=jp 20:10 */ #include <algorithm> #include <iostream> #include <vector> using std::cin; using std::cout; using std::min; using std::pair; using std::sort; using std::vector; #define INF 999999999; long long int N, M; vector<pai...
insert
45
45
45
47
0
p01144
C++
Runtime Error
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define INF 2147483647 #define llINF 9223372036854775807 #define pb push_back #define mp make_pair #...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define INF 2147483647 #define llINF 9223372036854775807 #define pb push_back #define mp make_pair #...
replace
32
33
32
33
0
p01144
C++
Time Limit Exceeded
#include <iostream> #include <set> using namespace std; int main() { while (true) { int n, m; int d, p; multiset<pair<int, int>, greater<pair<int, int>>> s; multiset<pair<int, int>, greater<pair<int, int>>>::iterator it; int e = 0; cin >> n >> m; if (!(n || m)) break; for (int i...
#include <iostream> #include <set> using namespace std; int main() { while (true) { int n, m; int d, p; multiset<pair<int, int>, greater<pair<int, int>>> s; multiset<pair<int, int>, greater<pair<int, int>>>::iterator it; int e = 0; cin >> n >> m; if (!(n || m)) break; for (int i...
replace
19
20
19
20
TLE
p01144
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; class Road { public: int d, p; Road() {} Road(int d = 0, int p = 0) : d(d), p(p) {} bool operator<(const Road r) const { return p < r.p; } }; int main() { int n, m; while (1) { cin >> n >> m; if (n == 0 && m == 0) ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; class Road { public: int d, p; Road() {} Road(int d = 0, int p = 0) : d(d), p(p) {} bool operator<(const Road r) const { return p < r.p; } }; int main() { int n, m; while (1) { cin >> n >> m; if (n == 0 && m == 0) ...
replace
31
33
31
37
0
p01144
C++
Time Limit Exceeded
#include <iostream> using namespace std; int ways[11]; int main() { loop: int n, m; for (int i = 0; i < 11; i++) ways[i] = 0; cin >> n >> m; if (!n) return 0; for (int i = 0; i < n; i++) { int d, p; cin >> d >> p; ways[p] += d; } while (m > 0) { for (int i = 10; i > 0; i--) { ...
#include <iostream> using namespace std; int ways[11]; int main() { loop: int n, m; for (int i = 0; i < 11; i++) ways[i] = 0; cin >> n >> m; if (!n) return 0; for (int i = 0; i < n; i++) { int d, p; cin >> d >> p; ways[p] += d; } for (int i = 10; i > 0; i--) { if (ways[i] < m) {...
replace
19
28
19
26
TLE
p01144
C++
Runtime Error
// C #include <algorithm> #include <functional> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n, m; while (true) { cin >> n >> m; if (n == 0 && m == 0) break; vector<pair<int, int>> t(0); // 危険度、距離 t.resize(11001); for (int i = 0; i < n; i++) { ...
// C #include <algorithm> #include <functional> #include <iostream> #include <map> #include <vector> using namespace std; int main() { int n, m; while (true) { cin >> n >> m; if (n == 0 && m == 0) break; vector<pair<int, int>> t(0); // 危険度、距離 t.resize(11001); for (int i = 0; i < n; i++) { ...
insert
23
23
23
30
0
p01144
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; while (cin >> n >> m) { if (n == 0 && m == 0) break; int d[n], p[n]; for (int i = 0; i < n; i++) { cin >> d[i] >> p[i]; } int pm = 0, nowp; while (m > 0) { for (int i = 0; i < n; i++) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; while (cin >> n >> m) { if (n == 0 && m == 0) break; int d[n], p[n]; for (int i = 0; i < n; i++) { cin >> d[i] >> p[i]; } int pm = 0, nowp; while (m > 0) { for (int i = 0; i < n; i++) { ...
insert
19
19
19
21
TLE
p01144
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; int main() { for (int tci = 0;; tci++) { int N, M; scanf("%d%d", &N, &M); if (!N) break; pair<int, int> *pd = new pair<int, int>[N]; int ept = 0; for (int i = 0; i < N; i++) { scanf("%d%d", &pd[i].second, &pd[i].first); ...
#include <algorithm> #include <cstdio> using namespace std; int main() { for (int tci = 0;; tci++) { int N, M; scanf("%d%d", &N, &M); if (!N) break; pair<int, int> *pd = new pair<int, int>[N]; int ept = 0; for (int i = 0; i < N; i++) { scanf("%d%d", &pd[i].second, &pd[i].first); ...
replace
19
20
19
20
0
p01144
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> using namespace std; typedef pair<int, int> P; int main() { int n; long long m; while (cin >> n >> m && (n || m)) { priority_queue<P> que; int d, p; for (int i = 0; i < n; ++i) { cin >> ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> using namespace std; typedef pair<int, int> P; int main() { int n; long long m; while (cin >> n >> m && (n || m)) { priority_queue<P> que; int d, p; for (int i = 0; i < n; ++i) { cin >> ...
replace
21
22
21
22
0
p01144
C++
Time Limit Exceeded
#include "bits/stdc++.h" #define REP(i, n) for (int i = 0; i < n; ++i) #define RREP(i, n) for (int i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define RFOR(i, m, n) for (int i = n - 1; i >= m; --i) #define ALL(v) v.begin(), v.end() #define PB(a) push_back(a) #define INF 1000000001 #define ...
#include "bits/stdc++.h" #define REP(i, n) for (int i = 0; i < n; ++i) #define RREP(i, n) for (int i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define RFOR(i, m, n) for (int i = n - 1; i >= m; --i) #define ALL(v) v.begin(), v.end() #define PB(a) push_back(a) #define INF 1000000001 #define ...
replace
25
26
25
27
TLE
p01144
C++
Time Limit Exceeded
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int d[11], n, m, i, a, b, sum, e; int main() { while (true) { memset(d, 0, sizeof(d)); sum = 0; cin >> n >> m; for (i = 0; i < n; i++) { cin >> a >> b; d[b] += a; } for (i = 10; i >= 0; i--) { e ...
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int d[11], n, m, i, a, b, sum, e; int main() { while (true) { memset(d, 0, sizeof(d)); sum = 0; cin >> n >> m; if (!n) { break; } for (i = 0; i < n; i++) { cin >> a >> b; d[b] += a; } for...
insert
10
10
10
13
TLE
p01144
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, m; while (cin >> n >> m, n) { vector<pair<int, int>> v; int ans = 0; for (int i = 0; i < n; i++) { int d, p; cin >> d >> p; ans += d * p; v.push_back(make_pair(p, d)); } so...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, m; while (cin >> n >> m, n) { vector<pair<int, int>> v; int ans = 0; for (int i = 0; i < n; i++) { int d, p; cin >> d >> p; ans += d * p; v.push_back(make_pair(p, d)); } so...
insert
21
21
21
23
0
p01144
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; vector<pii> ans; int main() { while (1) { int N, M; cin >> N >> M; if (!N) break; ans.clear(); for (int i = 0; i < N; i++) { int d, p; cin >> d >> p; ans.push_back(pii(p, d)); } sort(ans.be...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; vector<pii> ans; int main() { while (1) { int N, M; cin >> N >> M; if (!N) break; ans.clear(); for (int i = 0; i < N; i++) { int d, p; cin >> d >> p; ans.push_back(pii(p, d)); } sort(ans.be...
replace
21
22
21
22
0
p01145
C++
Time Limit Exceeded
//////////////////////////////////////// /// tu3 pro-con template /// //////////////////////////////////////// #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include...
//////////////////////////////////////// /// tu3 pro-con template /// //////////////////////////////////////// #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include...
delete
133
135
133
133
TLE
p01146
C++
Runtime Error
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define loop(i, a, b) for (int i = (a); i < int(b); i++) #define rep(i, b) loop(i, 0, b) #define all(c) (c).begin(), (c).end() int const inf = 1 << 29; struct Edge { Edge(int dst, int weight) : dst(d...
#include <algorithm> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; #define loop(i, a, b) for (int i = (a); i < int(b); i++) #define rep(i, b) loop(i, 0, b) #define all(c) (c).begin(), (c).end() int const inf = 1 << 29; struct Edge { Edge(int dst, int weight) : dst(d...
replace
34
35
34
35
0
p01146
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) typedef int Weight; typedef pair<Weight, int> Data; // enable reduce struct Heap { shared_ptr<Heap> l, r, p; Data val; Heap(Data v) : val(v) {} Data top() { return val; } }; int cnt1, cnt2; shared_ptr<Heap> meld...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); ++i) typedef int Weight; typedef pair<Weight, int> Data; // enable reduce struct Heap { shared_ptr<Heap> l, r, p; Data val; Heap(Data v) : val(v) {} Data top() { return val; } }; int cnt1, cnt2; shared_ptr<Heap> meld...
delete
158
159
158
158
0
2 2 11 10 21 16 37 26 70 34 62 36
p01146
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const int INF = 1001001001; struct Edge { int to, cost; Edge() {} Edge(int to, int cost) : to(to), cost(cost) {} }; struct State { Edge e; int ltime; State(Edge e, int ltime) : e(e), ltime(ltime) {} bool operator>(const State &rhs) const { return (e.cost >...
#include <bits/stdc++.h> using namespace std; const int INF = 1001001001; struct Edge { int to, cost; Edge() {} Edge(int to, int cost) : to(to), cost(cost) {} }; struct State { Edge e; int ltime; State(Edge e, int ltime) : e(e), ltime(ltime) {} bool operator>(const State &rhs) const { return (e.cost >...
insert
55
55
55
58
TLE
p01146
C++
Memory Limit Exceeded
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <vector> #define INF 100000000 using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int main() { int n, m, k, l, a, h; ...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <vector> #define INF 100000000 using namespace std; typedef pair<int, int> P; typedef pair<int, P> PP; int main() { int n, m, k, l, a, h; ...
insert
52
52
52
53
MLE
p01146
C++
Runtime Error
#ifndef _WIN32 #include <iostream> #endif // !_WIN32 #include <algorithm> #include <queue> #include <tuple> #include <vector> using namespace std; typedef long long LL; const LL INF = 1e17; #define FOR(i, bg, ed) for (int i = (bg); i < (ed); i++) #define REP(i, n) FOR(i, 0, n) typedef tuple<LL, int, int> edge; typ...
#ifndef _WIN32 #include <iostream> #endif // !_WIN32 #include <algorithm> #include <queue> #include <tuple> #include <vector> using namespace std; typedef long long LL; const LL INF = 1e17; #define FOR(i, bg, ed) for (int i = (bg); i < (ed); i++) #define REP(i, n) FOR(i, 0, n) typedef tuple<LL, int, int> edge; typ...
replace
22
25
22
25
0
p01146
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <vector> #define INF (1 << 29) using namespace std; int V, E, L, M, A, H, P, Q, R, C; int main() { while (true) { scanf("%d", &V); scanf("%d", &M); scanf("%d", &L); scanf("%d", &E); scanf("%d", &A); scanf("%d", &H); if (V == 0) { b...
#include <algorithm> #include <cstdio> #include <vector> #define INF (1 << 29) using namespace std; int V, E, L, M, A, H, P, Q, R, C; int main() { while (true) { scanf("%d", &V); scanf("%d", &M); scanf("%d", &L); scanf("%d", &E); scanf("%d", &A); scanf("%d", &H); if (V == 0) { b...
replace
60
64
60
66
TLE
p01146
C++
Runtime Error
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) struct Edge { int to; int cost; }; struct Node { int cit...
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) struct Edge { int to; int cost; }; struct Node { int cit...
replace
84
85
84
85
0
p01146
C++
Runtime Error
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) struct Edge { int to; int cost; }; struct Node { int cit...
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) struct Edge { int to; int cost; }; struct Node { int cit...
replace
82
88
82
87
0
p01147
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(), (c).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; vector<string> uvs; pair<int, string> solve(void) { string answer = ""; for (string &s : uvs) { int ol = min(answ...
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(), (c).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; vector<string> uvs; pair<int, string> solve(void) { string answer = ""; for (string &s : uvs) { int ol = min(answ...
replace
22
23
22
24
TLE
p01150
C++
Time Limit Exceeded
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; int sum = 0; vector<int> solve(bitset<13> &used, vector<int> &nums) { if (used.count() == 13) { return vector<int>{-1}; } else { for (int i = 0; i < 13; ++i) { if (!used[i]...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; int sum = 0; vector<int> solve(bitset<13> &used, vector<int> &nums) { if (used.count() == 13) { return vector<int>{-1}; } else { for (int i = 0; i < 13; ++i) { if (!used[i]...
insert
43
43
43
45
TLE
p01153
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int n, a[107], dp[107][107], K[107][107]; int main() { int t; cin >> t; for (int p = 0; p < t; p++) { for (int i = 0; i < 11449; i++) dp[i / 107][i % 107] = 0; cin >> n; if (n == 0) break; for (int i = 0; i ...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int n, a[107], dp[107][107], K[107][107]; int main() { int t; cin >> t; for (int p = 0; p < t; p++) { for (int i = 0; i < 11449; i++) dp[i / 107][i % 107] = 0; cin >> n; if (n == 0) break; for (int i = 0; i ...
replace
28
34
28
35
TLE
p01156
C++
Runtime Error
#include <iostream> #include <string> using namespace std; string S[15] = {"Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun"}; int N, a[10000], c[15]; string T; bool solve(int a, int b...
#include <iostream> #include <string> using namespace std; string S[15] = {"Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun"}; int N, a[10000], c[15]; string T; bool solve(int a, int b...
replace
39
40
39
40
0
p01160
C++
Memory Limit Exceeded
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int X[3001][3001]; int Y[3001][3001]; string lcs(string a, string b) { int n = a.size(); int m = b.size(); for (int i = 0; i < n + 1; i++) { for (int j = 0; j < m + 1; j++) { X[i][j] = 0; Y[i][j] = ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; short X[3001][3001]; short Y[3001][3001]; string lcs(string a, string b) { int n = a.size(); int m = b.size(); for (int i = 0; i < n + 1; i++) { for (int j = 0; j < m + 1; j++) { X[i][j] = 0; Y[i][j...
replace
6
8
6
8
MLE
p01160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; string s, t; int dp[1011][1011]; int used[1011][1011]; string solve() { string ans = ""; int i = s.size() - 1; int j = t.size() - 1; while (i > 0 && j > 0) { if (used[i][j] == 1) ans += t[j], i--, j--; else if (used[i][j] == 2) i--; else ...
#include <bits/stdc++.h> using namespace std; string s, t; int dp[2011][2011]; int used[2011][2011]; string solve() { string ans = ""; int i = s.size() - 1; int j = t.size() - 1; while (i > 0 && j > 0) { if (used[i][j] == 1) ans += t[j], i--, j--; else if (used[i][j] == 2) i--; else ...
replace
3
5
3
5
0
p01160
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define N 2050 string ss[2][N + 1]; int c[N + 1][N + 1]; string lcs(string X, string Y) { int m = X.size(); int n = Y.size(); int maxl = 0; X = ' ' + X; Y = ' ' + Y; ss[0][0] = ""; memset(c, 0, sizeof(c)); for (int i = 0; i <= m; i++) c[i][0] = 0; for ...
#include <bits/stdc++.h> using namespace std; #define N 2050 string ss[2][N + 1]; int c[N + 1][N + 1]; string lcs(string X, string Y) { int m = X.size(); int n = Y.size(); int maxl = 0; X = ' ' + X; Y = ' ' + Y; ss[0][0] = ""; memset(c, 0, sizeof(c)); for (int i = 0; i < N + 1; i++) ss[0][i] = ss[1]...
insert
13
13
13
15
0
p01163
C++
Runtime Error
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> // #include <b...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> // #include <b...
insert
62
62
62
64
TLE
p01163
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; const int MAX = 30000; int main() { vector<int> pr; bool p[MAX + 1] = {false}; for (int i = 2; i <= MAX; i++) p[i] = 1; for (int i = 2; i * i <= MAX; i++) if (p[i]) for (int k = i + i; k <= MAX; k += i) p[k] = 0; for (int i = ...
#include <iostream> #include <vector> using namespace std; const int MAX = 30000; int main() { vector<int> pr; bool p[MAX + 1] = {false}; for (int i = 2; i <= MAX; i++) p[i] = 1; for (int i = 2; i * i <= MAX; i++) if (p[i]) for (int k = i + i; k <= MAX; k += i) p[k] = 0; for (int i = ...
replace
24
28
24
33
TLE
p01163
C++
Time Limit Exceeded
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #inc...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #inc...
insert
74
74
74
77
TLE
p01168
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int m(int a, int k) { string s; while (a) { int tmp = a % k; if (tmp > 9) return -1; s += '0' + tmp; a /= k; } reverse(s.begin(), s.end()); return stoll(s); } signed main() { int a, b, c; while (cin >> a >> b >> c, ~...
#include <bits/stdc++.h> using namespace std; #define int long long int m(int a, int k) { if (!a) return 0; string s; while (a) { int tmp = a % k; if (tmp > 9) return -1; s += '0' + tmp; a /= k; } reverse(s.begin(), s.end()); return stoll(s); } signed main() { int a, b, c; whil...
insert
4
4
4
6
0
p01170
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; typedef complex<double> Point; namespace std { bool operator<(const Point &p1, const Point &p2) { if (p1.real() != p2.real()) return p1.real() < p2.real(); return p1.imag() < p2.imag(); } }; // namespace std str...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; typedef complex<double> Point; namespace std { bool operator<(const Point &p1, const Point &p2) { if (p1.real() != p2.real()) return p1.real() < p2.real(); return p1.imag() < p2.imag(); } }; // namespace std str...
insert
32
32
32
34
0