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 <iostream> #include <map> using namespace std; int main() { int N; while (cin >> N, N) { map<int, int> m; map<int, int>::iterator it; m.insert(make_pair(0, -1)); m.insert(make_pair(1000000001, -2)); while (N--) { char com; int I, S, P, ans = -1; cin >> com; swi...
#include <iostream> #include <map> using namespace std; int main() { int N; while (cin >> N, N) { map<int, int> m; map<int, int>::iterator it; m.insert(make_pair(0, -1)); m.insert(make_pair(1000000001, -2)); while (N--) { char com; int I, S, P, ans = -1; cin >> com; swi...
[["+", 8, 9, 0, 100, 0, 7, 15, 16, 17, 98], ["+", 8, 9, 0, 100, 0, 7, 15, 16, 12, 22]]
1
324
2
#include <bits/stdc++.h> using namespace std; struct file { int s, e, num; }; int main(int argc, char *argv[]) { int n; while (cin >> n, n) { list<file> sector; char ope; file tmp; int len, num; for (int i = 0; i < n; i++) { cin >> ope; list<file>::iterator ite = sector.begin(); ...
#include <bits/stdc++.h> using namespace std; struct file { int s, e, num; }; int main(int argc, char *argv[]) { int n; while (cin >> n, n) { list<file> sector; char ope; file tmp; int len, num; for (int i = 0; i < n; i++) { cin >> ope; list<file>::iterator ite = sector.begin(); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["-", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35]]
1
388
3
#include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X)) #define pb push_back #define eb emplace_back #define X first #define Y second using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pa...
#include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X)) #define pb push_back #define eb emplace_back #define X first #define Y second using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pa...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
593
4
#include <iostream> #include <list> #define LL long long using namespace std; struct R { LL cost; LL st; LL id; }; int main() { while (true) { LL n; cin >> n; if (n == 0) break; list<R> storage; storage.emplace_back(R{1ll << 60, 0, -1}); for (int i = 0; i < n; ++i) { char c...
#include <iostream> #include <list> #define LL long long using namespace std; struct R { LL cost; LL st; LL id; }; int main() { while (true) { LL n; cin >> n; if (n == 0) break; list<R> storage; storage.emplace_back(R{1ll << 60, 0, -1}); for (int i = 0; i < n; ++i) { char c...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
363
2
/* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2152 ?¨???¶?£???????map<kukan, int>??§????????????????????????priprity_queue??§????????? ????????? D??????erase??????????????? ??§??????????????????????????°???????????¬?????????????????????????????????????????????????¬????????´??????????????????¬?...
/* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2152 ?¨???¶?£???????map<kukan, int>??§????????????????????????priprity_queue??§????????? ????????? D??????erase??????????????? ??§??????????????????????????°???????????¬?????????????????????????????????????????????????¬????????´??????????????????¬?...
[["-", 3, 4, 0, 2, 3, 4, 0, 91, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
565
3
#include <algorithm> #include <complex> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n);...
#include <algorithm> #include <complex> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n);...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 8, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
645
4
#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; int main(void) { for (;;) { int n; cin >> n; if (!n) return 0; set<tuple<int, int, int>> f; /...
#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; int main(void) { for (;;) { int n; cin >> n; if (!n) return 0; set<tuple<int, int, int>> f; /...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
458
6
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define each(it, v) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<pint> vpint; #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, f, n) for (int i = (f); i < (n); i++) #define each(it, v) ...
[["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
508
7
/* template.cpp {{{ */ #include <bits/stdc++.h> using namespace std; #define get_macro(a, b, c, d, name, ...) name #define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep(...) \ get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, r...
/* template.cpp {{{ */ #include <bits/stdc++.h> using namespace std; #define get_macro(a, b, c, d, name, ...) name #define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep(...) \ get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, r...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
670
4
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const ll MOD = 1000000007; const int INF = 1000000010; struct Segment { int pos, size, id; Segment(int pos, int size, int id) : pos(pos), size(size), id(id) {} bool operator<(const Segment &right) const { return po...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const ll MOD = 1000000007; const int INF = 1000000010; struct Segment { int pos, size, id; Segment(int pos, int size, int id) : pos(pos), size(size), id(id) {} bool operator<(const Segment &right) const { return po...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
470
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define CH(N, A, B) (A <= N && N < B) #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = (b...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define CH(N, A, B) (A <= N && N < B) #define REP(i, a, b) for (int i = a; i < b; i++) #define RREP(i, a, b) for (int i = (b...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
509
4
#include <cmath> #include <iostream> using namespace std; int main() { double r; while (cin >> r) { if (r == 0.0) break; for (int i = 1; i <= 10000000; ++i) { int tmp = i * M_PI; if (fabs((double)tmp / i - M_PI) <= r) { cout << tmp << "/" << i << endl; break; } ...
#include <cmath> #include <iostream> using namespace std; int main() { double r; while (cin >> r) { if (r == 0.0) break; for (int i = 1; i <= 10000000; ++i) { int tmp = i * M_PI; if (fabs((double)tmp / i - M_PI) <= r) { cout << tmp << "/" << i << endl; break; } ...
[["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
124
2
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; int main() { int case_id = 0; while (true) { int W, H, N; cin >> W >> H >> N; if (!W) break; vector<vector<vector<int>>> walls(H, ...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; int main() { int case_id = 0; while (true) { int W, H, N; cin >> W >> H >> N; if (!W) break; vector<vector<vector<int>>> walls(H, ...
[["-", 341, 342, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
807
8
#include <bits/stdc++.h> using namespace std; double dp[2001][2000]; int main() { int n, m; while (cin >> n >> m && n) { string s; cin >> s; memset(dp, 0, sizeof(dp)); dp[0][1] = 1; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) for (int k = 1; k <= 6; k++) dp[i...
#include <bits/stdc++.h> using namespace std; double dp[2001][2000]; int main() { int n, m; while (cin >> n >> m && n) { string s; cin >> s; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) for (int k = 1; k <= 6; k++) dp[i...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]]
1
243
2
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
[["-", 0, 11, 12, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 11, 12, 2, 3, 4, 0, 118, 119, 120]]
1
1,055
2
#include <algorithm> #include <iostream> using namespace std; long long comb[61][61]; int main() { for (int i = 0; i <= 60; i++) { for (int j = 0; j <= 60; j++) { comb[i][j] = (j > i) ? 0 : (j == i || j == 0) ? 1 : comb[i - 1][j - 1]...
#include <algorithm> #include <iostream> using namespace std; long long comb[61][61]; int main() { for (int i = 0; i <= 60; i++) { for (int j = 0; j <= 60; j++) { comb[i][j] = (j > i) ? 0 : (j == i || j == 0) ? 1 : comb[i - 1][j - 1]...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
276
4
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) #define pb push_back const int N = 300; const double inf = 1000; const double eps = 1e-10; double cost[N][N]; double dp[N][N]; double le(vec...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) #define pb push_back const int N = 300; const double inf = 1000; const double eps = 1e-10; double cost[N][N]; double dp[N][N]; double le(vec...
[["-", 8, 9, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 8, 9, 0, 9, 0, 7, 15, 16, 17, 19]]
1
766
2
gets.to_i.times do n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) puts (0...n - 1).map {|i| xs[i + 1] - xs[i] }.sort.take(n - k).reduce(0) {|acc, x| acc + x } end
gets.to_i.times do n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) puts (0...n - 1).map {|i| xs[i + 1] - xs[i] }.sort[0..-k].reduce(0) {|acc, x| acc + x } end
[["-", 0, 652, 3, 4, 0, 652, 486, 652, 17, 131], ["-", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22], ["-", 3, 4, 0, 652, 486, 652, 3, 4, 0, 24], ["-", 0, 652, 486, 652, 3, 4, 0, 738, 31, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 70], ["+", 3, 4, 0, 652, 486, 742, 0, 475, 756, 612], ["+", 3, 4, 0, 652, 486, 742, 0, 475,...
4
81
9
N = int(input()) for i in range(N): n,k = map(int,input().split()) L = list(map(int,input().split())) if n <= k: print(0) else: A = [] for j in range(1,n): A.append(L[i]-L[i-1]) A.sort() A.reverse() S = L[n-1]-L[0] for l in range(k-1): ...
N = int(input()) for i in range(N): n,k = map(int,input().split()) L = list(map(int,input().split())) if n <= k: print(0) else: A = [] for j in range(1,n): A.append(L[j]-L[j-1]) A.sort() A.reverse() S = L[n-1]-L[0] for l in range(k-1): ...
[["-", 0, 652, 3, 4, 0, 657, 31, 206, 206, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 206, 206, 22], ["-", 3, 4, 0, 657, 12, 206, 206, 657, 31, 22], ["+", 3, 4, 0, 657, 12, 206, 206, 657, 31, 22]]
5
133
4
trial = int(input()) for t in range(trial): housecnt,elec = (int(n) for n in input().split(" ")) house = [int(n) for n in input().split(" ")] maxlist = [] for h in range(housecnt-1): maxlist.append(house[h+1]-house[h]) maxlist.sort() for p in range(min(housecnt,elec-1)): maxlist....
trial = int(input()) for t in range(trial): housecnt,elec = (int(n) for n in input().split(" ")) house = [int(n) for n in input().split(" ")] maxlist = [] for h in range(housecnt-1): maxlist.append(house[h+1]-house[h]) maxlist.sort() for p in range(min(housecnt-1,elec-1)): maxlis...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
122
2
t = int(input()) for i in range(t): n, k = [int(_) for _ in input().split()] x = [int(_) for _ in input().split()] d = [x[j + 1] - x[j] for j in range(n - 1)] d.sort(reverse=True) print((x[-1] - x[0] - sum(d[:k])))
t = int(input()) for i in range(t): n, k = [int(_) for _ in input().split()] x = [int(_) for _ in input().split()] d = [x[j + 1] - x[j] for j in range(n - 1)] d.sort(reverse=True) print((x[-1] - x[0] - sum(d[:k - 1])))
[["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 33], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]]
5
110
2
import java.util.ArrayList; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t = sc.nextInt(); for (int i = 0; i < t; i++) { solve(); } } static void solve() { int n = sc.nextInt(); ArrayList<Frac> a...
import java.util.ArrayList; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t = sc.nextInt(); for (int i = 0; i < t; i++) { solve(); } } static void solve() { int n = sc.nextInt(); ArrayList<Frac> a...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
522
4
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef vector<int> vi; inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } inline int lcm(int a, int b) { return a / gcd(a, b) * b; } inline int hex(char a) { return isdigit(a) ? (a - '0') : (a - 'A'); } inli...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef vector<int> vi; inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } inline int lcm(int a, int b) { return a / gcd(a, b) * b; } inline int hex(char a) { return isdigit(a) ? (a - '0') : (a - 'A'); } inli...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
524
38
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
526
2
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; vector<long long int> divisor(long long int n) { vector<long long int> res; for (long long int i = 1; i * i <= n; ++i) { if (n % i == 0) { res.push_back(i); if (i * i != n...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; vector<long long int> divisor(long long int n) { vector<long long int> res; for (long long int i = 1; i * i <= n; ++i) { if (n % i == 0) { res.push_back(i); if (i * i != n...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
784
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make_pair #define REP(i, n) for (int i = ...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make_pair #define REP(i, n) for (int i = ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
643
2
#include <bitset> #include <cstdio> #include <cstdlib> #include <vector> using namespace std; int GCD(int x, int y) { while (int z = x % y) x = y, y = z; return y; } int LCM(int x, int y) { return x / GCD(x, y) * y; } int A(char c) { char s[2] = {c}; return strtol(s, 0, 16); } int F(vector<int> &v, int n) {...
#include <bitset> #include <cstdio> #include <cstdlib> #include <vector> using namespace std; int GCD(int x, int y) { while (int z = x % y) x = y, y = z; return y; } int LCM(int x, int y) { return x / GCD(x, y) * y; } int A(char c) { char s[2] = {c}; return strtol(s, 0, 16); } int F(vector<int> &v, int n) {...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131]]
1
597
6
#include <algorithm> #include <assert.h> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const dou...
#include <algorithm> #include <assert.h> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const dou...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
877
2
#include <cstdio> #include <cstring> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int regularize(const char *s, int *r) { int len = strlen(s) / 2; rep(i, len) { char x[3] = {s[...
#include <cstdio> #include <cstring> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int regularize(const char *s, int *r) { int len = strlen(s) / 2; rep(i, len) { char x[3] = {s[...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
457
2
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; bool dp[81][350][350]; int main() { int T; cin >> T; while (T--) { int n; cin >> n; vector<int> e(n); for (int i = 0; i < n; ++i) { cin >> e[i]; } if (n <= 2) { cout << e.back(...
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; bool dp[81][350][350]; int main() { int T; cin >> T; while (T--) { int n; cin >> n; vector<int> e(n); for (int i = 0; i < n; ++i) { cin >> e[i]; } if (n <= 2) { cout << e.back(...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
322
6
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 85], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
1,031
4
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; typedef long long LL; bool go(LL x, LL y, LL a, LL b) { if (x == a) return true; if (y == b) return true; if (x + y == a + b) return true; if (x - y == a - b) return true; return false; } typed...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); ++i) using namespace std; typedef long long LL; bool go(LL x, LL y, LL a, LL b) { if (x == a) return true; if (y == b) return true; if (x + y == a + b) return true; if (x - y == a - b) return true; return false; } typed...
[["-", 3, 4, 0, 16, 31, 16, 31, 91, 17, 33], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33]]
1
515
3
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; const double EPS = 1e-8; const double INF = 1e12; const double PI = acos(-1); #define EQ(n, m) (abs((n) - (m)) < EPS)...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; const double EPS = 1e-8; const double INF = 1e12; const double PI = acos(-1); #define EQ(n, m) (abs((n) - (m)) < EPS)...
[["-", 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, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
1,873
6
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using name...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using name...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
1,455
7
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
1,035
4
#include <algorithm> #include <iostream> using namespace std; int dp[1 << 20], prev_[1 << 20], a[20][20], H, W; int main() { int T; cin >> T; for (int i = 1; i <= T; i++) { cin >> W >> H; for (int i = 0; i < (1 << W); i++) dp[i] = -1LL << 30; for (int i = 0; i < (1 << W); i++) prev_[i] = -...
#include <algorithm> #include <iostream> using namespace std; int dp[1 << 20], prev_[1 << 20], a[20][20], H, W; int main() { int T; cin >> T; for (int i = 1; i <= T; i++) { cin >> W >> H; for (int i = 0; i < (1 << W); i++) dp[i] = -1LL << 30; for (int i = 0; i < (1 << W); i++) prev_[i] = -...
[["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117]]
1
472
2
#include <iostream> using namespace std; int x[25], y[25], n, m, p, c; int main() { while (true) { cin >> n >> m; if (n == 0) break; for (int i = 0; i < 25; i++) x[i] = 0; x[0] = n; p++; c = 0; while (x[m] < 1) { c++; for (int i = 0; i < m; i++) y[i] = 0; ...
#include <iostream> using namespace std; int x[25], y[25], n, m, p, c; int main() { while (true) { cin >> n >> m; if (n == 0) break; for (int i = 0; i < 25; i++) x[i] = 0; x[0] = n; p++; c = 0; while (x[m] < 1) { c++; for (int i = 0; i < 25; i++) y[i] = 0; ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
220
2
#include <cstdio> #include <iostream> #include <set> #define REP(i, n) for (int i = 0; i < (int)(n); i++) int getInt() { int ret = 0, c; c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret *= 10; ret += c - '0'; c = getchar(); } return ret; } using namespace std; in...
#include <cstdio> #include <iostream> #include <set> #define REP(i, n) for (int i = 0; i < (int)(n); i++) int getInt() { int ret = 0, c; c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { ret *= 10; ret += c - '0'; c = getchar(); } return ret; } using namespace std; in...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 11, 31, 69, 28, 22]]
1
273
7
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) using namespace std; struct Edge { int dst, w; }; const int MAX = 110; int V, E, sp, ep, iHIT; vector<Edge> G[MAX]; int maxi[MAX]; void compute() { bool update = true; rep(i, V) maxi[i] = 0; vector<int>...
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) using namespace std; struct Edge { int dst, w; }; const int MAX = 110; int V, E, sp, ep, iHIT; vector<Edge> G[MAX]; int maxi[MAX]; void compute() { bool update = true; rep(i, V) maxi[i] = 0; vector<int>...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
496
4
#include <bits/stdc++.h> using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, s, e) for (int i = (s); i < (int)(e); i++) #define pb push_back #define all(r) (r).begin(), (r).end() #define rall(r) (r).rbegin(), (r).rend() #define fi first #define se second #define int long long typedef long long ll; ty...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, s, e) for (int i = (s); i < (int)(e); i++) #define pb push_back #define all(r) (r).begin(), (r).end() #define rall(r) (r).rbegin(), (r).rend() #define fi first #define se second #define int long long typedef long long ll; ty...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]]
1
533
2
#include <algorithm> #include <iostream> #include <list> #include <map> using namespace std; int n; main() { while (cin >> n, n) { list<pair<int, int>> L; L.push_back(make_pair(-1, 2e9)); for (int i = 0; i < n; i++) { char c; cin >> c; if (c == 'W') { int s, l; cin >> s >...
#include <algorithm> #include <iostream> #include <list> #include <map> using namespace std; int n; main() { while (cin >> n, n) { list<pair<int, int>> L; L.push_back(make_pair(-1, 2e9)); for (int i = 0; i < n; i++) { char c; cin >> c; if (c == 'W') { int s, l; cin >> s >...
[["-", 64, 9, 0, 7, 15, 16, 31, 16, 17, 47], ["+", 64, 9, 0, 7, 15, 16, 31, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
304
4
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef pair<int, int> P; typedef pair<int, P> File; void debug(const vector<File> &v) { cout << "[debug]" << endl; for (int i = 0; i < v.size(); i++) { int id = v[i].first; int L = v[i].second.first; int R ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef pair<int, int> P; typedef pair<int, P> File; void debug(const vector<File> &v) { cout << "[debug]" << endl; for (int i = 0; i < v.size(); i++) { int id = v[i].first; int L = v[i].second.first; int R ...
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
1
613
2
#include <cstdio> #include <iostream> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; static const ll MAX = 1e10; enum Data { Space, File }; struct Range { Data d; int id; ll start; ll end; ll size() const { return end - start; } bool operator<(const Range &r...
#include <cstdio> #include <iostream> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; static const ll MAX = 1e10; enum Data { Space, File }; struct Range { Data d; int id; ll start; ll end; ll size() const { return end - start; } bool operator<(const Range &r...
[["+", 64, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 64, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
669
2
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef int lli; struct Data { lli size, id; }; int main() { int N; while (cin >> N && N) { vector<Data> v; while (N--) { char op; cin >> op; if (op == 'W') { lli l, S; cin >...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef long long lli; struct Data { lli size, id; }; int main() { int N; while (cin >> N && N) { vector<Data> v; while (N--) { char op; cin >> op; if (op == 'W') { lli l, S; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 134, 39, 40], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["-", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68]]
1
383
6
#include <algorithm> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; struct Seg { int s, e, no; Seg() {} Seg(int a, int b, int c) : s(a), e(b), no(c) {} }; vector<Seg> v; void write(int l, int s) { for (int i = 0; s; i++) { if (v[i].no != -1) continue;...
#include <algorithm> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; struct Seg { int s, e, no; Seg() {} Seg(int a, int b, int c) : s(a), e(b), no(c) {} }; vector<Seg> v; void write(int l, int s) { for (int i = 0; s; i++) { if (v[i].no != -1) continue;...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
431
2
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #incl...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
666
4
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <st...
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <st...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
674
2
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #incl...
[["-", 49, 50, 51, 16, 31, 16, 31, 2, 63, 22], ["+", 49, 50, 51, 16, 31, 16, 31, 2, 63, 22]]
1
1,490
2
#include <iostream> #include <list> #include <string> using namespace std; struct Segment { int start; int end; int id; Segment() {} Segment(int s, int e, int id) : start(s), end(e), id(id) {} }; list<Segment> storage; void do_write(const int id, const int sectors) { list<Segment>::iterator it = storage...
#include <iostream> #include <list> #include <string> using namespace std; struct Segment { int start; int end; int id; Segment() {} Segment(int s, int e, int id) : start(s), end(e), id(id) {} }; list<Segment> storage; void do_write(const int id, const int sectors) { list<Segment>::iterator it = storage...
[["+", 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, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
494
6
//////////////////// /// template /// //////////////////// #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #i...
//////////////////// /// template /// //////////////////// #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #i...
[["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
2,038
6
import java.io.IOException; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.Queue; public class Main { int w, h; char[][] l, r; int[] ldx = {-1, 0, 0, 1}; int[] ldy = {0, -1, 1, 0}; int[] rdx = {1, 0, 0, -1}; int[] rdy = {0, -1, 1, 0}; int slx, sly, srx, sry; boo...
import java.io.IOException; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.Queue; public class Main { int w, h; char[][] l, r; int[] ldx = {-1, 0, 0, 1}; int[] ldy = {0, -1, 1, 0}; int[] rdx = {1, 0, 0, -1}; int[] rdy = {0, -1, 1, 0}; int slx, sly, srx, sry; boo...
[["+", 0, 1, 0, 492, 3, 4, 0, 510, 0, 101], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 62], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 510, 0, 102], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 62], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]]
3
1,375
8
import java.util.LinkedList; import java.util.Scanner; public class Main { public static final void main(String[] args) { new Main(); } int w; int h; char[][] map = new char[2][100 * 100]; int sl; int sr; public Main() { Scanner sc = new Scanner(System.in); while (true) { w = sc.nextInt...
import java.util.LinkedList; import java.util.Scanner; public class Main { public static final void main(String[] args) { new Main(); } int w; int h; char[][] map = new char[2][100 * 100]; int sl; int sr; public Main() { Scanner sc = new Scanner(System.in); while (true) { w = sc.nextInt...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60]]
3
802
2
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, s, n) for (int i = s; i < n; i++) #define all(x) x.begin(), x.end() typedef long long l...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define reps(i, s, n) for (int i = s; i < n; i++) #define all(x) x.begin(), x.end() typedef long long l...
[["-", 28, 69, 28, 69, 28, 69, 341, 342, 0, 22], ["+", 28, 69, 28, 69, 28, 69, 341, 342, 0, 22], ["-", 51, 91, 28, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 91, 28, 69, 28, 69, 341, 342, 0, 22]]
1
866
4
#include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<string> vs; typedef vector<int> vi; #define rep(i, b) loop(i, 0, b) #define loop(i, a, b) for (int i = (a); i < int(b); i++) int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0,...
#include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<string> vs; typedef vector<int> vi; #define rep(i, b) loop(i, 0, b) #define loop(i, a, b) for (int i = (a); i < int(b); i++) int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0,...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
633
4
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> using namespace std; typedef pair<int, int> Pi; bool used[50][50][50][50]; char masL[50][50], masR[50][50]; int W, H; Pi RinS, LenS; //スタート const int dy[] = {1, 0, -1, 0}, dx[] = {0, 1, 0, -1}; int bfs() { queue<Pi> Rin, Len...
#include <algorithm> #include <cstring> #include <iostream> #include <map> #include <queue> using namespace std; typedef pair<int, int> Pi; bool used[50][50][50][50]; char masL[50][50], masR[50][50]; int W, H; Pi RinS, LenS; //スタート const int dy[] = {1, 0, -1, 0}, dx[] = {0, 1, 0, -1}; int bfs() { queue<Pi> Rin, Len...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22]]
1
696
6
#include <bits/stdc++.h> using namespace std; #define LOG(...) fprintf(stderr, __VA_ARGS__) //#define LOG(...) #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EXIS...
#include <bits/stdc++.h> using namespace std; #define LOG(...) fprintf(stderr, __VA_ARGS__) //#define LOG(...) #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EXIS...
[["-", 64, 9, 0, 1, 0, 11, 12, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 11, 12, 118, 119, 120]]
1
1,042
4
#include <algorithm> #include <complex> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> #define ll long long int using namespace std; const int INF ...
#include <algorithm> #include <complex> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> #define ll long long int using namespace std; const int INF ...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
754
4
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <sstream> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define For(i, a, n) for (int i = a; i < n; i++) #define rep(i, n) For(i, 0, n) #define clr(n) memset(n, 0, sizeof n) #define all(n)...
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <sstream> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; #define For(i, a, n) for (int i = a; i < n; i++) #define rep(i, n) For(i, 0, n) #define clr(n) memset(n, 0, sizeof n) #define all(n)...
[["-", 64, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
853
2
#include <cstdio> #include <iostream> #include <queue> #include <string> #include <vector> #define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X)) #define pb push_back #define X first #define Y second using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<pii, pii> pi4; int dist[55][55][55]...
#include <cstdio> #include <iostream> #include <queue> #include <string> #include <vector> #define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X)) #define pb push_back #define X first #define Y second using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<pii, pii> pi4; int dist[55][55][55]...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
908
4
#include <iostream> #include <queue> #include <string> #include <vector> using namespace std; bool b[103][52][103][52] = {}; int main() { while (true) { long long int w, h; cin >> w >> h; if (w == 0) break; vector<string> map; map.push_back("###########################################...
#include <iostream> #include <queue> #include <string> #include <vector> using namespace std; bool b[103][52][103][52] = {}; int main() { while (true) { long long int w, h; cin >> w >> h; if (w == 0) break; vector<string> map; map.push_back("###########################################...
[["-", 12, 2, 63, 118, 28, 69, 341, 342, 0, 13], ["+", 12, 2, 63, 118, 28, 69, 341, 342, 0, 13]]
1
1,000
4
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <tuple> #include <utility> #include <vector> // cin.sync_with_stdio(false); // streambuf using namespace std; typedef long lon...
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <tuple> #include <utility> #include <vector> // cin.sync_with_stdio(false); // streambuf using namespace std; typedef long lon...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
805
4
#include <iostream> #include <queue> #include <string> using namespace std; struct state { int lx, ly, rx, ry; }; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; bool dp[50][50][50][50]; int main() { int h, w; while (cin >> w >> h, h) { int lx, ly, rx, ry; for (int i = 0; i < 50; i++) { for (int...
#include <iostream> #include <queue> #include <string> using namespace std; struct state { int lx, ly, rx, ry; }; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; bool dp[50][50][50][50]; int main() { int h, w; while (cin >> w >> h, h) { int lx, ly, rx, ry; for (int i = 0; i < 50; i++) { for (int...
[["-", 51, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["+", 51, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["-", 51, 16, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 51, 16, 12, 23, 0, 16, 12, 103, 0, 125]]
1
681
4
#include <array> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> enum PassageType { FREE, WALL, SEARCHED, GOAL, }; bool isSearched[50][50][50][50] = {false}; struct Point { Point() { x = 0; y = 0; }; Point(char x, char y) { this->...
#include <array> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> enum PassageType { FREE, WALL, SEARCHED, GOAL, }; bool isSearched[50][50][50][50] = {false}; struct Point { Point() { x = 0; y = 0; }; Point(char x, char y) { this->...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
961
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct Packet { int t, s, d; Packet() = default; Packet(int t, int s, int d) : t(t), s(s), d(d) {} bool operator<(const Packet &p) const { return t < p.t; } }; int main() { while (true) { int N, M; cin >> N >> M; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct Packet { int t, s, d; Packet() = default; Packet(int t, int s, int d) : t(t), s(s), d(d) {} bool operator<(const Packet &p) const { return t < p.t; } }; int main() { while (true) { int N, M; cin >> N >> M; ...
[["-", 0, 11, 31, 69, 341, 342, 0, 118, 119, 120], ["+", 0, 11, 31, 69, 341, 342, 0, 118, 119, 120]]
1
277
2
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; int main() { int n, m; bool infect[20001]; pair<int, pair<int, int>> packet[20000]; while (cin >> n >> m) { memset(infect, false, sizeof(infect)); infect[1] = true; for (int i = 0; i < m; i++) { ...
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; int main() { int n, m; bool infect[20001]; pair<int, pair<int, int>> packet[20000]; while (cin >> n >> m, n) { memset(infect, false, sizeof(infect)); infect[1] = true; for (int i = 0; i < m; i++) { ...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
225
2
#include <stdio.h> #include <stdlib.h> #include <string.h> struct P { int t; int s; int d; }; int cmp(const void *a, const void *b) { struct P *tmp1 = (struct P *)a; struct P *tmp2 = (struct P *)b; return tmp1->t - tmp2->t; } int main(void) { int n, m, count, i, j, p[20000]; struct P data[20000]; w...
#include <stdio.h> #include <stdlib.h> #include <string.h> struct P { int t; int s; int d; }; int cmp(const void *a, const void *b) { struct P *tmp1 = (struct P *)a; struct P *tmp2 = (struct P *)b; return tmp1->t - tmp2->t; } int main(void) { int n, m, count, i, p[20000]; struct P data[20000]; whil...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 105, 51, 23, 0, 69, 341, 342, 0, 70], ["+", 0, 105, 51, 23, 0, 69, 341, 342, 0, 13], ["+", 0, 105, 51, 23, 0, 69, 341, 342, 0, 73]]
1
289
5
#include <algorithm> #include <stdio.h> using namespace std; char str[20]; int t[110]; int p[110]; int q[110]; int c[110]; int dp[2][110000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i < a; i++) scanf("%d", c + i); int b; scanf("%d", &b); for (int i = 0; i < b; i++) { ...
#include <algorithm> #include <stdio.h> using namespace std; char str[20]; int t[110]; int p[110]; int q[110]; int c[110]; int dp[2][110000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i < a; i++) scanf("%d", c + i); int b; scanf("%d", &b); for (int i = 0; i < b; i++) { ...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 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]]
1
481
8
#include <bits/stdc++.h> using namespace std; int single[200010] = {}; int multi[200010] = {}; int hp[110]; int main() { int N; while (cin >> N && N) { for (int i = 0; i < 100010; i++) single[i] = 1e9; for (int i = 0; i < 100010; i++) multi[i] = 1e9; single[0] = multi[0] = 0; for (int i...
#include <bits/stdc++.h> using namespace std; int single[100010] = {}; int multi[100010] = {}; int hp[110]; int main() { int N; while (cin >> N && N) { for (int i = 0; i < 100010; i++) single[i] = 1e9; for (int i = 0; i < 100010; i++) multi[i] = 1e9; single[0] = multi[0] = 0; for (int i...
[["-", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 31, 22], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 17, 72], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 12, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
420
8
#include <algorithm> #include <iostream> #include <string> using namespace std; int multi[100010], single[100010], hp[110]; int main() { int N; while (cin >> N && N) { for (int i = 0; i < 100010; i++) { multi[i] = 1e9; single[i] = 1e9; } multi[0] = 0; single[0] = 0; for (int i = 0;...
#include <algorithm> #include <iostream> #include <string> using namespace std; int multi[100010], single[100010], hp[110]; int main() { int N; while (cin >> N && N) { for (int i = 0; i < 100010; i++) { multi[i] = 1e9; single[i] = 1e9; } multi[0] = 0; single[0] = 0; for (int i = 0;...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
407
2
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; #define F first #define S second vector<P> v1, v2; int a[101], dp1[100001], dp2[100001], n, t1, t2, t; string s; main() { while (cin >> n, n) { int ans = 1e8; r(i, 100001) dp1[i] = dp2[i] = 1e6;...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; #define F first #define S second vector<P> v1, v2; int a[101], dp1[100001], dp2[100001], n, t1, t2, t; string s; main() { while (cin >> n, n) { int ans = 1e8; r(i, 100001) dp1[i] = dp2[i] = 1e6;...
[["-", 3, 4, 0, 16, 12, 118, 28, 69, 28, 22], ["+", 3, 4, 0, 16, 12, 118, 28, 69, 28, 22]]
1
526
2
#include <bits/stdc++.h> using namespace std; #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) typedef long long LL; #define INF 1000000000 struct spell { int mp; int damage; }; struct spell sps[100], spa[100]; LL dps[100001], dpa[100001]; int main() { int n; while (1) {...
#include <bits/stdc++.h> using namespace std; #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) typedef long long LL; #define INF 1000000000 struct spell { LL mp; LL damage; }; struct spell sps[100], spa[100]; LL dps[100001], dpa[100001]; int main() { int n; while (1) { ...
[["-", 0, 30, 0, 122, 8, 123, 0, 124, 39, 40], ["+", 0, 30, 0, 122, 8, 123, 0, 124, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52...
1
551
12
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, m, d, h, i, j, r, s; string str; for (; cin >> n, n; cout << r << endl) { vector<int> monster(n); for (h = i = 0; i < n; i++) { cin >> monster[i]; if (h < monster[i]) h =...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, m, d, h, i, j, r, s; string str; for (; cin >> n, n; cout << r << endl) { vector<int> monster(n); for (h = i = 0; i < n; i++) { cin >> monster[i]; if (h < monster[i]) h =...
[["-", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13]]
1
453
2
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int n, m, d, h, i, j, r; string str; for (; cin >> n; cout << r << endl) { vector<int> monster(n); for (h = i = 0; i < n; i++) { cin >> monster[i]; if (h < monster[i]) h = monster[...
#include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int n, m, d, h, i, j, r; string str; for (; cin >> n, n; cout << r << endl) { vector<int> monster(n); for (h = i = 0; i < n; i++) { cin >> monster[i]; if (h < monster[i]) h = monst...
[["+", 0, 14, 8, 9, 0, 7, 15, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 7, 15, 34, 12, 22]]
1
468
2
import java.util.*; public class Main { int ans, n; int[] garr; private void doit() { Scanner sc = new Scanner(System.in); while (true) { n = sc.nextInt(); if (n == 0) break; char[] s = sc.next().toCharArray(); char[] g = sc.next().toCharArray(); int[] sarr = new in...
import java.util.*; public class Main { int ans, n; int[] garr; private void doit() { Scanner sc = new Scanner(System.in); while (true) { n = sc.nextInt(); if (n == 0) break; char[] s = sc.next().toCharArray(); char[] g = sc.next().toCharArray(); int[] sarr = new in...
[["-", 0, 57, 75, 57, 15, 15, 0, 16, 12, 499], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 12, 22]]
3
448
2
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define whole(xs) (xs).begin(), (xs).end() #define uniq(xs) ((xs).erase(unique((xs).begin(), (xs).end()), (xs).end())) int N; string s, t; bool input() { cin >> N; if (N == 0) return false; cin >> s >> t; re...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define whole(xs) (xs).begin(), (xs).end() #define uniq(xs) ((xs).erase(unique((xs).begin(), (xs).end()), (xs).end())) int N; string s, t; bool input() { cin >> N; if (N == 0) return false; cin >> s >> t; re...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
293
2
#include <bits/stdc++.h> #define inf 1 << 30 using namespace std; int k, ans; string a, b; void dfs(string s, int n, int num) { if (n == k - 1) { if (s == b) ans = min(ans, num); } else { int dif = (b[n] - s[n] + 10) % 10; if (s[n] == b[n]) { dfs(s, n + 1, num); } else { for (int...
#include <bits/stdc++.h> #define inf 1 << 30 using namespace std; int k, ans; string a, b; void dfs(string s, int n, int num) { if (n == k) { if (s == b) ans = min(ans, num); } else { int dif = (b[n] - s[n] + 10) % 10; if (s[n] == b[n]) { dfs(s, n + 1, num); } else { for (int i =...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
213
2
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define repi(i, a, b) \ for (long long i = (long long)(a); i < (long long)(b); i++) #define fi first #define se second #define mp make_pair using ll...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define repi(i, a, b) \ for (long long i = (long long)(a); i < (long long)(b); i++) #define fi first #define se second #define mp make_pair using ll...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
419
4
#include <iostream> #include <vector> using namespace std; int solve(vector<int> D, vector<int> imos, int i, int d) { int n = D.size(); if (i == n) return 0; d += imos[i]; D[i] += 10 - d; D[i] %= 10; int ret = 1e9; if (D[i]) { for (int j = i + 1; j <= n; ++j) { imos[j] -= D[i]; ret = ...
#include <iostream> #include <vector> using namespace std; int solve(vector<int> D, vector<int> imos, int i, int d) { int n = D.size(); if (i == n) return 0; d += imos[i]; D[i] += 10 - d; D[i] %= 10; int ret = 1e9; if (D[i]) { for (int j = i + 1; j <= n; ++j) { imos[j] -= D[i]; ret = ...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
283
2
#include <algorithm> #include <iostream> #include <string> using namespace std; char are(char c, int i) { int tmp = ((int)(c - '0' + i)) % 10; if (tmp >= 0) return (char)(tmp + '0'); return (char)((tmp + 10) + '0'); } int kore(string start, string goal, int sum) { if (start.empty()) return sum; int...
#include <algorithm> #include <iostream> #include <string> using namespace std; char are(char c, int i) { int tmp = ((int)(c - '0' + i)) % 10; if (tmp >= 0) return (char)(tmp + '0'); return (char)((tmp + 10) + '0'); } int kore(string start, string goal, int sum) { if (start.empty()) return sum; int...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
363
6
#include <bits/stdc++.h> using namespace std; int solve(vector<int> D, int i) { // i := 現在の位置 int n = D.size(); if (i == n) return 0; int ret = 1e9; if (D[i]) { int d = D[i]; for (int j = i + 1; j < n; j++) { D[j] = (D[j] - d + 10) % 10; ret = min(ret, 1 + solve(D, i + 1)); } } ...
#include <bits/stdc++.h> using namespace std; int solve(vector<int> D, int i) { // i := 現在の位置 int n = D.size(); if (i == n) return 0; int ret = 1e9; if (D[i]) { int d = D[i]; for (int j = i; j < n; j++) { D[j] = (D[j] - d + 10) % 10; ret = min(ret, 1 + solve(D, i + 1)); } } else...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
231
2
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int k; string cur, unlocking; int minCnt; void dfs(int idx, int cnt) { if (idx == k) { minCnt = min(minCnt, cnt); return; } if (minCnt <= cnt) return; string tmp = cur; // ツづつアツづ慊づ連ツ督ョツつウツつケツづゥツつゥツづ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int k; string cur, unlocking; int minCnt; void dfs(int idx, int cnt) { if (idx == k) { minCnt = min(minCnt, cnt); return; } if (minCnt <= cnt) return; string tmp = cur; // ツづつアツづ慊づ連ツ督ョツつウツつケツづゥツつゥツづ...
[["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
224
4
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
[["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13]]
1
319
2
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespac...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespac...
[["-", 8, 9, 0, 42, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 42, 0, 2, 3, 4, 0, 13]]
1
1,311
2
#include <bits/stdc++.h> using namespace std; #define int long long #define EPS (1e-1) #define equals(a, b) (fabs((a) - (b)) < EPS) #define PI 3.141592653589793238 // COUNTER CLOCKWISE static const int CCW_COUNTER_CLOCKWISE = 1; static const int CCW_CLOCKWISE = -1; static const int CCW_ONLINE_BACK = 2; static const i...
#include <bits/stdc++.h> using namespace std; #define int long long #define EPS (1e-5) #define equals(a, b) (fabs((a) - (b)) < EPS) #define PI 3.141592653589793238 // COUNTER CLOCKWISE static const int CCW_COUNTER_CLOCKWISE = 1; static const int CCW_CLOCKWISE = -1; static const int CCW_ONLINE_BACK = 2; static const i...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
4,231
2
#include <iostream> #include <random> #include <set> #include <vector> using namespace std; using ll = long long; struct P { ll x; ll y; bool operator<(const P &p) const { return (x != p.x) ? x < p.x : y < p.y; } }; vector<P> pos; int N; bool ok(const int i, const int j) { const ll x = (pos[i].x + pos[j].x) / ...
#include <iostream> #include <random> #include <set> #include <vector> using namespace std; using ll = long long; struct P { ll x; ll y; bool operator<(const P &p) const { return (x != p.x) ? x < p.x : y < p.y; } }; vector<P> pos; int N; bool ok(const int i, const int j) { const ll x = (pos[i].x + pos[j].x) / ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13]]
1
504
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
2,781
6
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; typedef vector<P> Polygon; double cross(P a, P b) { return (conj(a) * b).imag(); } // line,line P intersection(P a1, P a2, P b1, P b2) { P a = a2 - a1; P b = b2 - b1; return a1 + a * cross(b, b1 - a1) / cr...
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; typedef vector<P> Polygon; double cross(P a, P b) { return (conj(a) * b).imag(); } // line,line P intersection(P a1, P a2, P b1, P b2) { P a = a2 - a1; P b = b2 - b1; return a1 + a * cross(b, b1 - a1) / cr...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
553
2
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; // Point typedef pair<P, P> L; // Line, Segment const double EPS = 1e-8; const double PI = 6.0 * asin(0.5); namespace std { bool operator<(const P &a, const P &b) { return fabs(real(a) - real(b)) < EPS ? imag(a) < imag(b) : real(a) < real...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; // Point typedef pair<P, P> L; // Line, Segment const double EPS = 1e-8; const double PI = 6.0 * asin(0.5); namespace std { bool operator<(const P &a, const P &b) { return fabs(real(a) - real(b)) < EPS ? imag(a) < imag(b) : real(a) < real...
[["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
881
2
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, a, b) for (int i = (a); i < (b); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i) #define chmi...
#include <bits/stdc++.h> using namespace std; #define int long long // <-----!!!!!!!!!!!!!!!!!!! #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, a, b) for (int i = (a); i < (b); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i) #define chmi...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,157
2
#include <bits/stdc++.h> #define M 10 using namespace std; typedef complex<double> P; typedef pair<P, P> L; const double EPS = 1e-8; double dot(P a, P b) { return real(conj(a) * b); } double cross(P a, P b) { return imag(conj(a) * b); } int ccw(P a, P b, P c) { b -= a; c -= a; if (cross(b, c) > EPS) return...
#include <bits/stdc++.h> #define M 10 using namespace std; typedef complex<double> P; typedef pair<P, P> L; const double EPS = 1e-8; double dot(P a, P b) { return real(conj(a) * b); } double cross(P a, P b) { return imag(conj(a) * b); } int ccw(P a, P b, P c) { b -= a; c -= a; if (cross(b, c) > EPS) return...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
857
2
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <vector> #define _A_ true #define EPS 1e-10 #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLINE_FRONT -2 #define ON_SEGMENT 0 usi...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <vector> #define _A_ true #define EPS 1e-10 #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLINE_FRONT -2 #define ON_SEGMENT 0 usi...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
1,402
2
// Enjoy your stay. #include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i, n) rep2(i, 0, n) #define rep2(i, m,...
// Enjoy your stay. #include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i, n) rep2(i, 0, n) #define rep2(i, m,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
2,898
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; ...
[["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["-", 12, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 12, 23, 0, 16, 12, 69, 341, 342, 0, 22]]
1
728
8
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; vector<int> E[100]; bool used[200]; int match[200]; bool dfs(int u) { used[u] = true; for (int v : E[u]) { int w = match[v]; if (w == -1 || (!used[w] && dfs(w))) { match[u] = v; match[v] = u; re...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; vector<int> E[100]; bool used[200]; int match[200]; bool dfs(int u) { used[u] = true; for (int v : E[u]) { int w = match[v]; if (w == -1 || (!used[w] && dfs(w))) { match[u] = v; match[v] = u; re...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
438
4
#include <algorithm> #include <cstdio> using namespace std; int main() { const int M = 11 * 7 * 5 * 3 * 3 * 2 * 2 * 2 * 2; int n, d, t, q; while (scanf("%d", &n), n) { int v[25][24] = {}; for (int i = 0; i < n; ++i) { scanf("%d%d", &d, &t); for (int j = 0; j < d; ++j) { scanf("%d", &q...
#include <algorithm> #include <cstdio> using namespace std; int main() { const int M = 11 * 7 * 5 * 3 * 3 * 2 * 2 * 2 * 2; int n, d, t, q; while (scanf("%d", &n), n) { int v[25][24] = {}; for (int i = 0; i < n; ++i) { scanf("%d%d", &d, &t); for (int j = 0; j < d; ++j) { scanf("%d", &q...
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33]]
1
268
2
#include <iostream> #include <stack> using namespace std; int gcd(int a, int b); bool bigprime(int a); int main() { int n; while (cin >> n && n != 0) { int data[25][24]; for (int i = 0; i < 25; i++) { for (int j = 0; j < 24; j++) { data[i][j] = 0; } } int day, now, inp; fo...
#include <iostream> #include <stack> using namespace std; int gcd(int a, int b); bool bigprime(int a); int main() { int n; while (cin >> n && n != 0) { int data[25][24]; for (int i = 0; i < 25; i++) { for (int j = 0; j < 24; j++) { data[i][j] = 0; } } int day, now, inp; fo...
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22]]
1
413
2
#include <bits/stdc++.h> using namespace std; int N; int s[25][25]; int t[60000]; int u[25]; int lc; bool flg[100]; int main() { flg[1] = flg[13] = flg[17] = flg[19] = flg[23] = true; while (1) { cin >> N; if (N == 0) break; memset(s, 0, sizeof(s)); memset(t, 0, sizeof(t)); memset(u, 0, ...
#include <bits/stdc++.h> using namespace std; int N; int s[25][25]; int t[60000]; int u[25]; int lc; bool flg[100]; int main() { flg[1] = flg[13] = flg[17] = flg[19] = flg[23] = true; while (1) { cin >> N; if (N == 0) break; memset(s, 0, sizeof(s)); memset(t, 0, sizeof(t)); memset(u, 0, ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
364
2
#include <algorithm> #include <cstdio> #include <cstring> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { for (int n; scanf("%d", &n), n;) { int a[25][24] = {}; rep(_, n) { int m, t, q; scanf("%d%d", &m, &t); rep(i, m) scanf("%d", &q), a[m][(t + i) % m] +...
#include <algorithm> #include <cstdio> #include <cstring> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { for (int n; scanf("%d", &n), n;) { int a[25][24] = {}; rep(_, n) { int m, t, q; scanf("%d%d", &m, &t); rep(i, m) scanf("%d", &q), a[m][(i - t + m) % ...
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 341, 342, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 22]]
1
280
4
#include <algorithm> #include <stdio.h> using namespace std; int gcd(int a, int b) { while (a) { b %= a; int c = b; b = a; a = c; } return b; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int q[100][100]; int t[100000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = ...
#include <algorithm> #include <stdio.h> using namespace std; int gcd(int a, int b) { while (a) { b %= a; int c = b; b = a; a = c; } return b; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int q[100][100]; int t[100000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = ...
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 33]]
1
531
2
#include <algorithm> #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, j) REP((i), 0, (j)) #define REP(i, j, k) for (int i = (j); (i) < (k)...
#include <algorithm> #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, j) REP((i), 0, (j)) #define REP(i, j, k) for (int i = (j); (i) < (k)...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 67], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 109]]
1
553
2