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 <bits/stdc++.h> using namespace std; int n, q; const long long inf = (1ll << 31); const int max_n = (1 << 17); long long seg[max_n * 2 - 1]; long long lazy[max_n * 2 - 1]; void init() { int _n = n; n = 1; while (n < _n) n *= 2; fill(seg, seg + 2 * n - 1, inf); fill(lazy, lazy + 2 * n - 1, i...
#include <bits/stdc++.h> using namespace std; int n, q; const long long inf = (1ll << 31) - 1; const int max_n = (1 << 17); long long seg[max_n * 2 - 1]; long long lazy[max_n * 2 - 1]; void init() { int _n = n; n = 1; while (n < _n) n *= 2; fill(seg, seg + 2 * n - 1, inf); fill(lazy, lazy + 2 * n - ...
[["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13]]
1
558
2
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a...
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["-", 31, 16, 12, 16, 31, 2, 3, 4, 0, 24]]
1
700
6
#include <bits/stdc++.h> using namespace std; int t[(1 << 18)]; void Set(int a, int b, int x, int k = 0, int l = 0, int r = (1 << 18)) { if (b <= l || r <= a) return; if (a <= l && r <= b) { t[k] = max(t[k], x); return; } int m = (l + r) / 2; Set(a, b, x, k * 2 + 1, l, m); Set(a, b, x, k * 2 +...
#include <bits/stdc++.h> using namespace std; int t[(1 << 18)]; // 0 2 1 0 0 // 0 2 1 0 0 65536 // 0 2 1 0 0 2 void Set(int a, int b, int x, int k = 0, int l = 0, int r = (1 << 17)) { if (b <= l || r <= a) return; if (a <= l && r <= b) { t[k] = max(t[k], x); return; } int m = (l + r) / 2; Set(a,...
[["-", 54, 55, 0, 356, 365, 23, 0, 16, 12, 13], ["+", 54, 55, 0, 356, 365, 23, 0, 16, 12, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
346
4
#include <bits/stdc++.h> using namespace std; class RUQSegmentTree { const int n; const int flag = -1; const int id = 1; vector<int> data, data2; int size(int n) { int res = 1; while (res < n) res <<= 1; return res; } void sub(int l, int r, int node, int lb, int ub, int val) { if (u...
#include <bits/stdc++.h> using namespace std; class RUQSegmentTree { const int n; const int flag = -1; const int id = 1; vector<int> data, data2; int size(int n) { int res = 1; while (res < n) res <<= 1; return res; } void sub(int l, int r, int node, int lb, int ub, int val) { if (u...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 0, 52, 8, 9, 0, 57, 64, 93, 0, 94], ["-", 0, 52, 8, 9, 0, 57, 64, 93, 0, 35]]
1
470
4
#include <iostream> using namespace std; #define INF 2147483647 #define ASTART (1 << 17) int a[1 << 18][2]; int ti = 1; int find(int i) { int nv = INF, t = 0; i += ASTART - 1; nv = a[i][0]; t = a[i][1]; while (i > 0) { i = (i - 1) / 2; if (t < a[i][1]) nv = a[i][0], t = a[i][1]; // cout <<...
#include <iostream> using namespace std; #define INF 2147483647 #define ASTART (1 << 17) int a[1 << 18][2]; int ti = 1; int find(int i) { int nv = INF, t = 0; i += ASTART - 1; nv = a[i][0]; t = a[i][1]; while (i > 0) { i = (i - 1) / 2; if (t < a[i][1]) nv = a[i][0], t = a[i][1]; } return n...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20]]
1
381
2
#include <bits/stdc++.h> using namespace std; #define MAX 100005 // 262144 = 2^18 int tree[262144]; int dfs(int a, int b, int k, int l, int r) { if (r < a || b < l) return 0; if (a <= l && r <= b) return tree[k]; int m = (l + r) / 2; return dfs(a, b, k * 2 + 1, l, m) + dfs(a, b, k * 2 + 2, m + 1, r); ...
#include <bits/stdc++.h> using namespace std; #define MAX 100005 // 262144 = 2^18 int tree[262144]; int dfs(int a, int b, int k, int l, int r) { if (r < a || b < l) return 0; if (a <= l && r <= b) return tree[k]; int m = (l + r) / 2; return dfs(a, b, k * 2 + 1, l, m) + dfs(a, b, k * 2 + 2, m + 1, r); ...
[["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 13]]
1
322
2
n, q = map(int, input().split()) answer = [] # create segtree size = 1 while size < n : size *= 2 size = size * 2 - 1 segtree = [0 for x in range(size)] # update query def update(i, x) : ind = size // 2 + i segtree[ind] += x while ind : ind = (ind - 1) // 2 # parent ch1 = se...
n, q = map(int, input().split()) answer = [] # create segtree size = 1 while size < n : size *= 2 size = size * 2 - 1 segtree = [0 for x in range(size)] # print(size) # update query def update(i, x) : ind = size // 2 + i segtree[ind] += x while ind : ind = (ind - 1) // 2 # parent ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
277
6
import sys class BIT: def __init__(self, node_size): self._node = node_size+1 self.bit = [0]*self._node def add(self, index, add_val): index += 1 while index < self._node: self.bit[index] += add_val index += index & -index def sum(self, index): ...
import sys class BIT: def __init__(self, node_size): self._node = node_size+1 self.bit = [0]*self._node def add(self, index, add_val): index += 1 while index < self._node: self.bit[index] += add_val index += index & -index def sum(self, index): ...
[["+", 0, 1, 0, 677, 12, 657, 12, 664, 17, 33]]
5
199
13
import sys import itertools class RSQ: def __init__(self, n): self.sz = 1 self.inf = (1 << 31) - 1 while self.sz < n: self.sz = self.sz << 1 self.dat = [0] * (2 * self.sz - 1) def update(self, idx, x): idx += self.sz - 1 self.dat[idx] += x while idx ...
import sys import itertools class RSQ: def __init__(self, n): self.sz = 1 self.inf = (1 << 31) - 1 while self.sz <= n: self.sz = self.sz << 1 self.dat = [0] * (2 * self.sz - 1) def update(self, idx, x): idx += self.sz - 1 self.dat[idx] += x while idx...
[["-", 0, 14, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 14, 8, 196, 0, 52, 15, 666, 667, 19]]
5
365
2
class BIT: def __init__(self, size): self.size = size self.bit = [0] * (size + 1) # sum [0, i) def sum(self, i): s = 0 while (i > 0): s += self.bit[i] i -= i & -i return s # sum [i, j) def sum_sec(self, i, j): return self.sum(...
class BIT: def __init__(self, size): self.size = size self.bit = [0] * (size + 1) # sum [0, i) def sum(self, i): s = 0 while (i > 0): s += self.bit[i] i -= i & -i return s # sum [i, j) def sum_sec(self, i, j): return self.sum(...
[["-", 0, 37, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 0, 37, 0, 657, 12, 652, 3, 4, 0, 22]]
5
209
2
# coding: utf-8 class BinaryIndexedTree(object): def __init__(self, N): self.N = N self.tree = [0] * (N + 1) def add(self, a, w): x = a while x <= self.N: self.tree[x] += a x += (x & -x) def sum(self, a): if a == 0: return 0 ...
# coding: utf-8 class BinaryIndexedTree(object): def __init__(self, N): self.N = N self.tree = [0] * (N + 1) def add(self, a, w): x = a while x <= self.N: self.tree[x] += w x += (x & -x) def sum(self, a): if a == 0: return 0 ...
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22]]
5
218
2
class SegmentTree(): def __init__(self,n): self.dat = [0 for _ in range(n*2-1)] #index n???????????????????????¢?????????: #???????????? : (n-1)//2 #???????????? : (2n+1) , (2n+2) self.n = n def update (self,node_index,value): """ index?????????value????????´?????? """ index = node_index + (self.n-1) #...
class SegmentTree(): def __init__(self,n): self.dat = [0 for _ in range(n*2-1)] #index n???????????????????????¢?????????: #???????????? : (n-1)//2 #???????????? : (2n+1) , (2n+2) self.n = n def update (self,node_index,value): """ index?????????value????????´?????? """ index = node_index + (self.n-1) #...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
377
2
n, q = map(int, input().split()) n_ = 1 # 実際に確保した配列のサイズ while n_ < n: n_ *= 2 seg_tree = [0 for i in range(2*n_-1)] def add(i, x): i += n_ - 1 seg_tree[i] += x while i > 0 : i = int((i - 1)/2) #seg_tree[i] = seg_tree[i*2+1] + seg_tree[i*2+2] seg_tree[i] += x def getSum(s, t): return query(s, ...
n, q = map(int, input().split()) n_ = 1 # 実際に確保した配列のサイズ while n_ < n: n_ *= 2 seg_tree = [0 for i in range(2*n_-1)] def add(i, x): i += n_ - 1 seg_tree[i] += x while i > 0 : i = int((i - 1)/2) #seg_tree[i] = seg_tree[i*2+1] + seg_tree[i*2+2] seg_tree[i] += x def getSum(s, t): return query(s, ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
284
6
import sys sys.setrecursionlimit(10000) def initRMQ(n): n_ = 1 while n_ < n: n_ *= 2 D = [] for _ in range(2*n_ - 1): D.append(0) return n_, D def update(k, a): k += n_ - 1 D[k] += a while k > 0: k = int((k - 1) / 2) D[k] = D[k*2 + 1] + D[k*2 + 2] ...
import sys sys.setrecursionlimit(10000) def initRMQ(n): n_ = 1 while n_ < n: n_ *= 2 D = [] for _ in range(2*n_ - 1): D.append(0) return n_, D def update(k, a): k += n_ - 1 D[k] += a while k > 0: k = int((k - 1) / 2) D[k] = D[k*2 + 1] + D[k*2 + 2] ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
319
4
import math class SegmentTree(): def __init__(self, n): self.n = n self.height = math.ceil(math.log2(n)) self.nodes = [0 for i in range(pow(2, self.height+1)-1)] self.leaf_start = pow(2, self.height)-1 def update(self, i, x): pntr = self.leaf_start + i self.node...
import math class SegmentTree(): def __init__(self, n): self.n = n self.height = math.ceil(math.log2(n)) self.nodes = [0 for i in range(pow(2, self.height+1)-1)] self.leaf_start = pow(2, self.height)-1 def update(self, i, x): pntr = self.leaf_start + i self.node...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
408
4
package main import ( "bufio" "fmt" "os" "strconv" ) var MIN int = 0 var sc = bufio.NewScanner(os.Stdin) func next() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } type RMQ struct { data []int size int } func NewRMQ(size int) *RMQ { s := 1 for s < size { s *= 2 } r := make([]int, s+2)...
package main import ( "bufio" "fmt" "os" "strconv" ) var MIN int = 0 var sc = bufio.NewScanner(os.Stdin) func next() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } type RMQ struct { data []int size int } func NewRMQ(size int) *RMQ { s := 1 for s < size { s *= 2 } r := make([]int, s*2+...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 433]]
7
486
2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // [Tips] // XCode??§???EOF??\??????Ctrl+D // ?\???Alt+\ // ans???????§?INT?????????2,147,483,647????¶????????????¨??????????????§long // long?????£??????????????????????????? ///////////////////////...
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // [Tips] // XCode??§???EOF??\??????Ctrl+D // ?\???Alt+\ // ans???????§?INT?????????2,147,483,647????¶????????????¨??????????????§long // long?????£??????????????????????????? ///////////////////////...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
1,083
8
import java.util.Scanner; public class Main { static int N = 100005; static int tree[]; // start from 0, with all uncertain value // data structure: tree from 0 // how to represent the tree node, // node: the segment of the public static void main(String[] args) { int n, m; Scanner in = new Scanner...
import java.util.Scanner; public class Main { static int N = 300005; static int tree[]; // start from 0, with all uncertain value // data structure: tree from 0 // how to represent the tree node, // node: the segment of the public static void main(String[] args) { int n, m; Scanner in = new Scanner...
[["-", 0, 235, 8, 498, 0, 124, 49, 200, 51, 499], ["+", 0, 235, 8, 498, 0, 124, 49, 200, 51, 499], ["-", 8, 196, 0, 1, 0, 11, 12, 91, 17, 33], ["-", 8, 196, 0, 1, 0, 11, 12, 91, 439, 499], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 499]]
3
569
5
#include <algorithm> #include <cfloat> #include <complex> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> #define fs first ...
#include <algorithm> #include <cfloat> #include <complex> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> #define fs first ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
647
4
#include <bits/stdc++.h> #define int long long #define moder (int)(1e9 + 7) #define inf (int)(3e18 + 7) #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i < n; i++) #define P pair<int, int> #define all(v) v.begin(), v.end() #define mkp make_pair #define mkt make_tuple #define prique(T) pr...
#include <bits/stdc++.h> #define int long long #define moder (int)(1e9 + 7) #define inf (int)(3e18 + 7) #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i < n; i++) #define P pair<int, int> #define all(v) v.begin(), v.end() #define mkp make_pair #define mkt make_tuple #define prique(T) pr...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
817
6
#include <algorithm> #include <cstdio> #include <vector> using namespace std; // Abstract Lazy Segment Tree (抽象・汎化遅延セグメント木) // Verified: AOJ のセグ木 verify 問全部 const int SIZE = 1 << 17; // 2^17 = 131072 template <typename T> struct lazysegtree { // ノード、単位元 T node[2 * SIZE], lazy[2 * SIZE], I_upd, I_qry; bool need_...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; // Abstract Lazy Segment Tree (抽象・汎化遅延セグメント木) // Verified: AOJ のセグ木 verify 問全部 const int SIZE = 1 << 17; // 2^17 = 131072 template <typename T> struct lazysegtree { // ノード、単位元 T node[2 * SIZE], lazy[2 * SIZE], I_upd, I_qry; bool need_...
[["-", 0, 37, 0, 16, 12, 16, 31, 23, 0, 24], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 37, 0, 16, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 37, 0, 16, 12, 16, 17, 48]]
1
969
6
// AOJ DSL_3_B The Smallest Window II // 2018.5.6 bal4u@uu #include <stdio.h> #include <stdlib.h> #include <string.h> #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } #define MAX_N ...
// AOJ DSL_3_B The Smallest Window II // 2018.5.6 bal4u@uu #include <stdio.h> #include <stdlib.h> #include <string.h> #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } #define MAX_N ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]]
0
370
6
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int A[100005]; int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) cin >> A[i]; map<int, int> cts; int values_in_window = 0; int m = 100005; for (int f = 0, b = 0; f < n; ++f) { if (!cts[A[f]] and A[f] <=...
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int A[100005]; int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) cin >> A[i]; map<int, int> cts; int values_in_window = 0; int m = 100005; for (int f = 0, b = 0; f < n; ++f) { if (!cts[A[f]] and A[f] <=...
[["+", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
182
3
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <c...
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) #define rep(i, a, b) for (int i = a; i < (b); ++i) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return fa...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
269
3
#include <cstdio> #include <iostream> using namespace std; long long p[100005], N, Q, A; int main() { cin >> N >> Q; for (int i = 0; i < N; i++) scanf("%lld", p[i]); for (int i = 0; i < Q; i++) { long long sum = 0, R = 0; cin >> A; long long cnt = 0; for (int i = 0; i < N; i++) { while (...
#include <cstdio> #include <iostream> using namespace std; long long p[100005], N, Q, A; int main() { cin >> N >> Q; for (int i = 0; i < N; i++) scanf("%lld", &p[i]); for (int i = 0; i < Q; i++) { long long sum = 0, R = 0; cin >> A; long long cnt = 0; for (int i = 0; i < N; i++) { while ...
[["+", 8, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
186
15
//#pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned)time(NULL)); }; } __initon; //衝突対策 #define ws ___ws struct T { ...
//#pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned)time(NULL)); }; } __initon; //衝突対策 #define ws ___ws struct T { ...
[["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78]]
1
6,834
2
//#pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned)time(NULL)); }; } __initon; //衝突対策 #define ws ___ws struct T { ...
//#pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned)time(NULL)); }; } __initon; //衝突対策 #define ws ___ws struct T { ...
[["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78]]
1
6,615
2
#include <bits/stdc++.h> using namespace std; #define MAX 100005 #define endl '\n' typedef long long ll; typedef pair<int, int> pii; const ll MOD = 1000003; ll st[4 * MAX]; ll lazy[4 * MAX]; void addLazy(ll n, ll b, ll e, ll v) { lazy[n] = lazy[n] + v; st[n] = st[n] + (v * (e - b + 1)); } void push(ll n, ll ...
#include <bits/stdc++.h> using namespace std; #define MAX 100005 #define endl '\n' typedef long long ll; typedef pair<int, int> pii; const ll MOD = 1000003; ll st[4 * MAX]; ll lazy[4 * MAX]; void addLazy(ll n, ll b, ll e, ll v) { lazy[n] = lazy[n] + v; st[n] = st[n] + (v * (e - b + 1)); } void push(ll n, ll ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
594
2
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for (int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define RA...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for (int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define RA...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13]]
1
831
2
#include "bits/stdc++.h" using namespace std; using ll = 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++) template <class I, class BiOp = I (*)(I, I)> class SegTree { private: int n; std::vector<I> dat, lazy; BiOp op; I e; public: SegTree(int n...
#include "bits/stdc++.h" using namespace std; using ll = 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++) template <class I, class BiOp = I (*)(I, I)> class SegTree { private: int n; std::vector<I> dat, lazy; BiOp op; I e; public: SegTree(int n...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
754
4
#include <bits/stdc++.h> #define int long long int #define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORE(i, a, b) for (int i = (a); i <= (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define RFORE(i, a, b) for (int i = (b); i >= (a); --i) #de...
#include <bits/stdc++.h> #define int long long int #define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORE(i, a, b) for (int i = (a); i <= (b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i) #define RFORE(i, a, b) for (int i = (b); i >= (a); --i) #de...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
1,738
2
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define...
[["-", 0, 30, 0, 353, 8, 123, 0, 124, 365, 13], ["+", 0, 30, 0, 353, 8, 123, 0, 124, 365, 22]]
1
1,070
2
#include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template ...
#include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using PII = pair<ll, ll>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template ...
[["-", 8, 9, 0, 37, 0, 41, 15, 16, 12, 13], ["+", 8, 9, 0, 37, 0, 41, 15, 16, 12, 22]]
1
3,943
2
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #inc...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #inc...
[["-", 8, 9, 0, 37, 0, 41, 15, 16, 12, 13], ["+", 8, 9, 0, 37, 0, 41, 15, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
1,039
4
#include <algorithm> #include <bitset> #include <climits> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #...
#include <algorithm> #include <bitset> #include <climits> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #...
[["-", 0, 43, 49, 50, 51, 4, 0, 91, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 27, 17, 29]]
1
1,344
2
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_fast...
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_fast...
[["-", 0, 77, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 0, 77, 49, 185, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
1,692
4
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <st...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <st...
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 31, 22]]
1
206
4
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n;...
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n;...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 19]]
1
266
2
#include <bits/stdc++.h> using namespace std; int N, S, sum = 0, ans = 1e9, k; int a[100000]; int main() { scanf("%d %d", &N, &S); for (int i = 0; i < N; i++) { scanf("%d", &a[i]); sum += a[i]; if (sum - a[k] >= S) { sum -= a[k]; k++; } if (sum >= S) ans = min(ans, i - k + 1)...
#include <bits/stdc++.h> using namespace std; int N, S, sum = 0, ans = 1e9, k; int a[100000]; int main() { scanf("%d %d", &N, &S); for (int i = 0; i < N; i++) { scanf("%d", &a[i]); sum += a[i]; while (sum - a[k] >= S) { sum -= a[k]; k++; } if (sum >= S) ans = min(ans, i - k +...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89]]
1
147
2
#include <bits/stdc++.h> using namespace std; int N, S; int a[100000]; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cin >> a[i]; int ans = 1000000; int sum = 0, cnt = 0, j = 0; for (int i = 0; i < N; i++) { while (sum < S && j < N) { sum += a[j]; cnt++; j++; } ...
#include <bits/stdc++.h> using namespace std; int N, S; int a[100000]; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cin >> a[i]; int ans = 1000000; int sum = 0, cnt = 0, j = 0; for (int i = 0; i < N; i++) { while (sum < S && j < N) { sum += a[j]; cnt++; j++; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
153
2
#include <iostream> using namespace std; int main() { int N, n[100001], s, t, min, sum = 0; cin >> N >> s; t = 0; min = 100001; for (int i = 0; i < N; i++) { cin >> n[i]; sum += n[i]; if (sum > s) { while (sum >= s) { sum -= n[t]; t++; } t--; sum += n[t]; ...
#include <iostream> using namespace std; int main() { int N, n[100001], s, t, min, sum = 0; cin >> N >> s; t = 0; min = 100001; for (int i = 0; i < N; i++) { cin >> n[i]; sum += n[i]; if (sum >= s) { while (sum >= s) { sum -= n[t]; t++; } t--; sum += n[t];...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
162
2
#include <bits/stdc++.h> using namespace std; long long i, a, N, s, A = INT_MAX, l, r, S[100002]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> s; for (; i < N; i++) { cin >> a; S[i] += S[i - 1] + a; } for (;;) { if (S[r] - S[l] >= s) { A = min(A, r - l); l++; ...
#include <bits/stdc++.h> using namespace std; long long i, a, N, s, A = INT_MAX, l, r, S[100002]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> s; for (; i < N; i++) { cin >> a; S[i + 1] += S[i] + a; } for (;;) { if (S[r] - S[l] >= s) { A = min(A, r - l); l++; ...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
153
4
#include <bits/stdc++.h> long long i, a, N, s, A = INT_MAX, l, r, S[100002]; int main() { scanf("%ll%ll", &N, &s); for (; i < N; i++) { scanf("%ll", &a); S[i + 1] += S[i] + a; } for (;;) { if (S[r] - S[l] >= s) { A = std::min(A, r - l); l++; } else r++; if (r > N) { i...
#include <bits/stdc++.h> long long i, a, N, s, A = INT_MAX, l, r, S[100002]; int main() { scanf("%ld%ld", &N, &s); for (; i < N; i++) { scanf("%ld", &a); S[i + 1] += S[i] + a; } for (;;) { if (S[r] - S[l] >= s) { A = std::min(A, r - l); l++; } else r++; if (r > N) { i...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
154
6
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define all(r) begin(r), end(r) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout << #x << ": " << x << endl #define fcout(n) cout << fixed << setprecision((...
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define all(r) begin(r), end(r) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout << #x << ": " << x << endl #define fcout(n) cout << fixed << setprecision((...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
448
4
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long lli; typedef vector<lli> vll; typedef vector<bool> vbl; typedef vector<vector<lli>> mat;...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long lli; typedef vector<lli> vll; typedef vector<bool> vbl; typedef vector<vector<lli>> mat;...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
246
4
#include "bits/stdc++.h" #include <fstream> #include <sys/timeb.h> using namespace std; #define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repl(i, 0, n) #define replrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define reprev(i, n) replrev(i, 0, n) #define repi(itr, ds) for ...
#include "bits/stdc++.h" #include <fstream> #include <sys/timeb.h> using namespace std; #define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repl(i, 0, n) #define replrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define reprev(i, n) replrev(i, 0, n) #define repi(itr, ds) for ...
[["-", 51, 16, 31, 16, 31, 16, 12, 16, 17, 33], ["+", 51, 16, 31, 16, 31, 16, 12, 16, 17, 72]]
1
530
2
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> #define INF 999999999 using namespace std; int n, s, ans; int a[105000]; void solve() { int ret = n + 1; int l = 0, r = 0, sum = 0; while (1) { while (r < n && sum < s) { sum += a[r++]; } if (sum <...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> #define INF 999999999 using namespace std; int n, s, ans; int a[105000]; void solve() { int ret = n + 1; int l = 0, r = 0, sum = 0; while (1) { while (r < n && sum < s) { sum += a[r++]; } if (sum <...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
184
4
#include <stdio.h> const int INF = (1 << 30); int main() { int n, s, a[100010], back = 0, ans = INF; long long int now = 0; scanf("%d%d", &n, &s); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); now += a[i]; while (now >= s) { if (i - back + 1 < ans) ans = i - back + 1; now -= ...
#include <stdio.h> const int INF = (1 << 30); int main() { int n, s, a[100010], back = 0, ans = INF; long long int now = 0; scanf("%d%d", &n, &s); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); now += a[i]; while (now >= s) { if (i - back + 1 < ans) ans = i - back + 1; now -= ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
161
2
#include <stdio.h> typedef long long ll; int main(void) { ll i, j, k, n, s, h = 0, t = 1, now, ans = 1000000; scanf("%lld%lld", &n, &s); ll a[n]; for (i = 0; i < n; ++i) scanf("%lld", &a[i]); now = a[0]; while (1) { if (now < s) { if (t == n - 1) break; t++; now += a[t]; ...
#include <stdio.h> typedef long long ll; int main(void) { ll i, j, k, n, s, h = 0, t = 0, now, ans = 1000000; scanf("%lld%lld", &n, &s); ll a[n]; for (i = 0; i < n; ++i) scanf("%lld", &a[i]); now = a[0]; while (1) { if (now < s) { if (t == n - 1) break; t++; now += a[t]; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13]]
1
180
6
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { private static FastScanner sc = new FastScanner(); static NodeSegmentTree[] V; static int N; public static void main(String[] args) { int n = sc.nextInt(); ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { private static FastScanner sc = new FastScanner(); static NodeSegmentTree[] V; static int N; public static void main(String[] args) { int n = sc.nextInt(); ...
[["+", 15, 15, 0, 16, 31, 16, 31, 509, 500, 274], ["+", 15, 15, 0, 16, 31, 16, 31, 509, 0, 131], ["+", 15, 15, 0, 16, 12, 16, 31, 509, 500, 274], ["+", 15, 15, 0, 16, 12, 16, 31, 509, 0, 131]]
3
780
4
#include <bits/stdc++.h> using namespace std; // BEGIN CUT HERE template <typename T, typename E> struct SegmentTree { using F = function<T(T, T)>; using G = function<T(T, E)>; using H = function<E(E, E)>; using P = function<E(E, size_t)>; int n; F f; G g; H h; T ti; E ei; P p; vector<T> dat; ...
#include <bits/stdc++.h> using namespace std; // BEGIN CUT HERE template <typename T, typename E> struct SegmentTree { using F = function<T(T, T)>; using G = function<T(T, E)>; using H = function<E(E, E)>; using P = function<E(E, size_t)>; int n; F f; G g; H h; T ti; E ei; P p; vector<T> dat; ...
[["-", 0, 218, 8, 9, 0, 37, 0, 2, 63, 22], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25]]
1
1,035
5
#include <cstddef> #include <cstdint> #include <functional> #include <memory> #include <utility> template <class Monoid, template <class> class Allocator = std::allocator, class Index = std::size_t> class PersistentSegmentTree { public: using value_type = Monoid; using reference = value_type &; using c...
#include <cstddef> #include <cstdint> #include <functional> #include <memory> #include <utility> template <class Monoid, template <class> class Allocator = std::allocator, class Index = std::size_t> class PersistentSegmentTree { public: using value_type = Monoid; using reference = value_type &; using c...
[["-", 12, 118, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 12, 118, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 118, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 12, 118, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
1,629
6
#include <cstddef> #include <cstdint> #include <functional> #include <memory> #include <utility> template <class Monoid, template <class> class Allocator = std::allocator, class Index = std::size_t> class PersistentSegmentTree { public: using value_type = Monoid; using reference = value_type &; using c...
#include <cstddef> #include <cstdint> #include <functional> #include <memory> #include <utility> template <class Monoid, template <class> class Allocator = std::allocator, class Index = std::size_t> class PersistentSegmentTree { public: using value_type = Monoid; using reference = value_type &; using c...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
1,636
2
#include <climits> #include <iostream> #include <sstream> #include <vector> using namespace std; const int INF = INT32_MAX; int N; int Q; int n; const int N_MAX = 100000; vector<int> node; void change(int i, int val) { i = i + n - 1; node[i] = val; while (i > 0) { i = (i - 1) / 2; node[i] = min(node[2 ...
#include <climits> #include <iostream> #include <sstream> #include <vector> using namespace std; const int INF = INT32_MAX; int N; int Q; int n; const int N_MAX = 100000; vector<int> node; void change(int i, int val) { i = i + n - 1; node[i] = val; while (i > 0) { i = (i - 1) / 2; node[i] = min(node[2 ...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
337
4
#include "algorithm" #include "bitset" #include "climits" #include "cmath" #include "cstdio" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "string" #include "unordered_map" #inclu...
#include "algorithm" #include "bitset" #include "climits" #include "cmath" #include "cstdio" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "string" #include "unordered_map" #inclu...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
1,316
2
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for (int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; using ll = long long int; using P = pair<int, int>; using T = tuple<int, int, int>; using edge = struct { int to, cost; }; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for (int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; using ll = long long int; using P = pair<int, int>; using T = tuple<int, int, int>; using edge = struct { int to, cost; }; ...
[["-", 0, 359, 0, 122, 8, 123, 0, 124, 39, 40], ["+", 0, 359, 0, 122, 8, 123, 0, 124, 39, 78], ["-", 8, 123, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 123, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0...
1
581
10
#pragma GCC optimize("O3") #include "bits/stdc++.h" using namespace std; using ll = long long int; #define debugos clog #define debug(v) \ { \ printf("L%d %s > ", __LINE__, #v...
#pragma GCC optimize("O3") #include "bits/stdc++.h" using namespace std; using ll = long long int; #define debugos clog #define debug(v) \ { \ printf("L%d %s > ", __LINE__, #v...
[["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
2,515
2
#include <bits/stdc++.h> using ll = long long; using namespace std; constexpr ll inf = 1e15; constexpr ll mod = 1e9 + 7; class SegTree { int n = 1; // represents the tree as an array // parent of k: (k-1)/2, child of k: 2*k+1, 2*k+2 vector<ll> nodes; public: SegTree(int size, ll v) { while (n < size) ...
#include <bits/stdc++.h> using ll = long long; using namespace std; constexpr ll inf = 1e15; constexpr ll mod = 1e9 + 7; class SegTree { int n = 1; // represents the tree as an array // parent of k: (k-1)/2, child of k: 2*k+1, 2*k+2 vector<ll> nodes; public: SegTree(int size, ll v) { while (n < size) ...
[["+", 49, 50, 51, 4, 0, 16, 31, 23, 0, 24], ["-", 49, 50, 51, 4, 0, 16, 12, 16, 31, 13], ["+", 51, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 4, 0, 16, 31, 23, 0, 25]]
1
494
4
#include <iostream> using std::cin; using std::cout; using std::endl; using ll = long long; template <typename T> T min(T a, T b) { return (a < b) ? a : b; } template <typename T> class SegTree { static const int MAXN = 100010; T INF; int n; T A[MAXN * 4]; public: SegTree(int size, T INF) : INF(INF) { ...
#include <iostream> using std::cin; using std::cout; using std::endl; using ll = long long; template <typename T> T min(T a, T b) { return (a < b) ? a : b; } template <typename T> class SegTree { static const int MAXN = 100010; T INF; int n; T A[MAXN * 4]; public: SegTree(int size, T INF) : INF(INF) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
444
4
#include <bits/stdc++.h> using namespace std; struct SegTree { int n; vector<int> node; SegTree(int sz) { n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, INT_MIN); } void update(int p, int v) { p += n - 1; node[p] = v; while (p) { p = (p - 1) / 2; node[p] = min...
#include <bits/stdc++.h> using namespace std; struct SegTree { int n; vector<int> node; SegTree(int sz) { n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, INT_MAX); } void update(int p, int v) { p += n - 1; node[p] = v; while (p) { p = (p - 1) / 2; node[p] = min...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22]]
1
315
4
#include <bits/stdc++.h> using namespace std; #define int long long template <class T> struct Segtree { int n; vector<T> node; Segtree(int sz) { n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, INT_MAX); // UNITY } T merge(T a, T b) { // NEED TO EDIT return min(a, b); } void s...
#include <bits/stdc++.h> using namespace std; #define int long long template <class T> struct Segtree { int n; vector<T> node; Segtree(int sz) { n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, INT_MAX); // UNITY } T merge(T a, T b) { // NEED TO EDIT return min(a, b); } void s...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22]]
1
348
2
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
#include <bits/stdc++.h> using namespace std; #define li long long int #define rep(i, to) for (li i = 0; i < ((li)(to)); i++) #define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define all...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 16, 31, 2, 63, 22], ["+", 51, 4, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 51, 4, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 51, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
863
7
#include "bits/stdc++.h" using namespace std; // RMQ struct SegmentTree { private: int N; vector<long long> node, lazy; vector<bool> lazyFlg; const long long DEFAULT = 9223372036854775807LL; public: void init(int n) { //初期化 O(N) node.clear(); lazy.clear(); lazyFlg.clear(); N = 1; while (...
#include "bits/stdc++.h" using namespace std; // RMQ struct SegmentTree { private: int N; vector<long long> node, lazy; vector<bool> lazyFlg; const long long DEFAULT = 9223372036854775807LL; public: void init(int n) { //初期化 O(N) node.clear(); lazy.clear(); lazyFlg.clear(); N = 1; while (...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,017
2
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; const int INF = 1 << 28; const ll MOD = 1'000'000'007; template <class T> bool chmax(T &a, const T &b) ...
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; const int INF = INT_MAX; const ll MOD = 1'000'000'007; template <class T> bool chmax(T &a, const T &b) ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22]]
1
778
4
#include <algorithm> #include <iostream> #include <limits.h> #include <math.h> #include <vector> using namespace std; typedef long long ll; //半開区間なことに注意 // L<=P<R template <typename Monoid> class SegmentTree { public: //コンストラクタ n:サイズ pr:初期値 SegmentTree(ll n, Monoid pr) { size = pow(2, ceil(log2(n))); vec....
#include <algorithm> #include <iostream> #include <limits.h> #include <math.h> #include <vector> using namespace std; typedef long long ll; //半開区間なことに注意 // L<=P<R template <typename Monoid> class SegmentTree { public: //コンストラクタ n:サイズ pr:初期値 SegmentTree(ll n, Monoid pr) { size = pow(2, ceil(log2(n))); vec....
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
410
4
#include <algorithm> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include...
#include <algorithm> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include...
[["+", 0, 37, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 37, 0, 2, 3, 4, 0, 16, 12, 13]]
1
538
2
#include <bits/stdc++.h> using namespace std; #define DUMP(x) cerr << #x << "=" << x << endl #define DUMP2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl #define BINARY(x) static_cast<bitset<16>>(x) #define rep(i, n) for...
#include <bits/stdc++.h> using namespace std; #define DUMP(x) cerr << #x << "=" << x << endl #define DUMP2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl #define BINARY(x) static_cast<bitset<16>>(x) #define rep(i, n) for...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 31, 22]]
1
479
2
#include <bits/stdc++.h> using namespace std; #define MAX (1 << 19) #define INF INT_MAX class RMQ { public: int N, dat[2 * MAX - 1]; void init(int n) { N = 1; while (N < n) N *= 2; for (int i = 0; i < 2 * N - 1; i++) { dat[i] = INF; } } void update(int i, int x) { i += N - 1...
#include <bits/stdc++.h> using namespace std; #define MAX (1 << 19) #define INF INT_MAX class RMQ { public: int N, dat[2 * MAX - 1]; void init(int n) { N = 1; while (N < n) N *= 2; for (int i = 0; i < 2 * N - 1; i++) { dat[i] = INF; } } void update(int i, int x) { i += N - 1...
[["-", 12, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 31, 16, 12, 2, 3, 4, 0, 118, 28, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 118, 17, 131], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
343
6
#include <bits/stdc++.h> using namespace std; typedef long long lli; const lli INF = (1LL << 31) - 1; const int MAX_N = 1 << 17; class LazySegTree { int n; lli dat[2 * MAX_N - 1], lazy[2 * MAX_N - 1]; public: LazySegTree(int _n = MAX_N) { n = 1; while (n < _n) n *= 2; fill(dat, dat + 2 * n -...
#include <bits/stdc++.h> using namespace std; typedef long long lli; const lli INF = (1LL << 31) - 1; const int MAX_N = 1 << 17; class LazySegTree { int n; lli dat[2 * MAX_N - 1], lazy[2 * MAX_N - 1]; public: LazySegTree(int _n = MAX_N) { n = 1; while (n < _n) n *= 2; fill(dat, dat + 2 * n -...
[["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 11, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 64, 9, 0, 1, 0, 11, 12, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
650
7
/* attention to typo and overflow */ #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; const int INF = -1 + (1 << 30) + (1 << 30); void io() { cin.tie(0); ios::sync_with_stdio(false); } // attention to use of endl /...
/* attention to typo and overflow */ #include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; const int INF = -1 + (1 << 30) + (1 << 30); void io() { cin.tie(0); ios::sync_with_stdio(false); } // attention to use of endl /...
[["-", 0, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 9, 0, 1, 0, 2, 63, 118, 119, 120]]
1
480
2
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef...
[["+", 12, 118, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 12, 118, 28, 2, 3, 4, 0, 16, 12, 13]]
1
531
2
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = (1LL << 31) - 1; struct SegmentTree { int n; vector<int> v; SegmentTree(int n_, int x) : v(n_ * 4) { for (int i = 0; (1 << i) <= n_; ++i, n = 1 << i) ; for (int i = 0; i < n * 4; ++i) v[i] = x; }...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; const int INF = (1LL << 31) - 1; struct SegmentTree { int n; vector<int> v; SegmentTree(int n_, int x) : v(n_ * 4) { for (int i = 0; (1 << i) <= n_; ++i, n = 1 << i) ; for (int i = 0; i < n_ * 4; ++i) v[i] = x; ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]]
1
425
2
#include <bits/stdc++.h> using namespace std; typedef long long st_t; const st_t INF = 1LL << 55; const int MAX_N = 100000; st_t st[1 << 18]; // 1 << 18 = 262144 void init(int n, st_t *st) { int nn = 1; while (nn < n) nn *= 2; fill(st, st + 2 * nn - 1, INF); } void update(int i, st_t a, int k, int l, in...
#include <bits/stdc++.h> using namespace std; typedef long long st_t; const st_t INF = 0x7fffffff; const int MAX_N = 100000; st_t st[1 << 18]; // 1 << 18 = 262144 void init(int n, st_t *st) { int nn = 1; while (nn < n) nn *= 2; fill(st, st + 2 * nn - 1, INF); } void update(int i, st_t a, int k, int l, i...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
455
4
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end()) typedef long long ll; typedef pair<int, int> P; typedef unsigned int uint; typedef unsigned long long ull;...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end()) typedef long long ll; typedef pair<int, int> P; typedef unsigned int uint; typedef unsigned long long ull;...
[["-", 8, 123, 0, 14, 8, 9, 0, 43, 39, 40]]
1
577
1
#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 numa(x, a) for (auto x : a) #define ite iterator #define mp make_pair #define rep(i, n) rep2(i, 0, n) #define rep2(i, m, n) for ...
#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 numa(x, a) for (auto x : a) #define ite iterator #define mp make_pair #define rep(i, n) rep2(i, 0, n) #define rep2(i, m, n) for ...
[["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22]]
1
1,012
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define pb(n) push_back(n) #define mp(n, m) make_pair(n, m) #def...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define pb(n) push_back(n) #define mp(n, m) make_pair(n, m) #def...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
485
5
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb emplace_back #define INF (1e9 + 1) // 0-index 抽象化半開区間遅延セグツリー template <typename T, typename E> class segment_tree { typed...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb emplace_back #define INF (1e9 + 1) // 0-index 抽象化半開区間遅延セグツリー template <typename T, typename E> class segment_tree { typed...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
812
4
#include <bits/stdc++.h> using Int = int64_t; using UInt = uint64_t; using C = std::complex<double>; #define rep(i, n) for (Int i = 0; i < (Int)(n); ++i) #define rep2(i, l, r) for (Int i = (Int)(l); i < (Int)(r); ++i) #define guard(x) \ if (not(x)) ...
#include <bits/stdc++.h> using Int = int64_t; using UInt = uint64_t; using C = std::complex<double>; #define rep(i, n) for (Int i = 0; i < (Int)(n); ++i) #define rep2(i, l, r) for (Int i = (Int)(l); i < (Int)(r); ++i) #define guard(x) \ if (not(x)) ...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
468
2
#include <algorithm> #include <iostream> #include <limits> #include <vector> using namespace std; // ------ RMQ Class ------ // template <typename Type> class RMQ { private: int size_; vector<Type> dat; Type query_(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return numeric_limits<Type>::m...
#include <algorithm> #include <iostream> #include <limits> #include <vector> using namespace std; // ------ RMQ Class ------ // template <typename Type> class RMQ { private: int size_; vector<Type> dat; Type query_(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return numeric_limits<Type>::m...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
522
2
#include <bits/stdc++.h> using namespace std; int seg[262156], d; void update(int i, int x) { i |= 1 << d; seg[i] = x; while (i > 1) { i >>= 1; seg[i] = min(seg[i * 2], seg[i * 2 + 1]); } } int query(int a, int b, int k, int l, int r) { if (a <= l && r <= b) return seg[k]; if (r <= a || b <= l) ...
#include <bits/stdc++.h> using namespace std; int seg[262156], d; void update(int i, int x) { i |= 1 << d; seg[i] = x; while (i > 1) { i >>= 1; seg[i] = min(seg[i * 2], seg[i * 2 + 1]); } } int query(int a, int b, int k, int l, int r) { if (a <= l && r <= b) return seg[k]; if (r <= a || b <= l) ...
[["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 48], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72]]
1
305
6
#include <bits/stdc++.h> using namespace std; const int maxv = 100000; const long long INF = (1 << 31) - 1; long long T[4 * maxv + 1]; int a, b, q; int Q, N; long long v; long long update(int ini, int fin, int nd, int x, long long v) { if (x < ini || x > fin) return T[nd]; if (ini == fin) { T[nd] = v; ...
#include <bits/stdc++.h> using namespace std; const int maxv = 100000; const long long INF = (1 << 31) - 1; long long T[4 * maxv + 1]; int a, b, q; int Q, N; long long v; long long update(int ini, int fin, int nd, int x, long long v) { if (x < ini || x > fin) return T[nd]; if (ini == fin) { T[nd] = v; ...
[["-", 64, 9, 0, 37, 0, 69, 341, 342, 0, 22], ["+", 64, 9, 0, 37, 0, 69, 341, 342, 0, 22]]
1
469
2
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (int i = (i...
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (int i = (i...
[["-", 0, 362, 8, 201, 0, 43, 49, 50, 51, 13], ["+", 0, 362, 8, 201, 0, 43, 49, 50, 51, 22]]
1
945
2
#include <bits/stdc++.h> using namespace std; template <typename D, typename T = D> class Tree { public: Tree(long long int size = 0, D InitialValueArg = D()) { long long int n = 1LL; CalcTree.emplace_back(vector<T>(n)); while (n <= size) { n <<= 1LL; addOneLine(n); } InitialValue = I...
#include <bits/stdc++.h> using namespace std; template <typename D, typename T = D> class Tree { public: Tree(long long int size = 0, D InitialValueArg = D()) { long long int n = 1LL; CalcTree.emplace_back(vector<T>(n)); while (n <= size) { n <<= 1LL; addOneLine(n); } InitialValue = I...
[["+", 0, 353, 8, 123, 0, 14, 39, 86, 0, 96], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96]]
1
909
6
#include <iostream> #include <vector> #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 using namespace std; struct edge { int from, to, cost; }; int V, E, d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { int count = 0; for (int i = 0; i < V; i++) { d[i] = INF; } d[s] = 0; while (true) { ...
#include <iostream> #include <vector> #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 using namespace std; struct edge { int from, to, cost; }; int V, E, d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { int count = 0; for (int i = 0; i < V; i++) { d[i] = INF; } d[s] = 0; while (true) { ...
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
328
2
using namespace std; #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 #include <iostream> #include <vector> struct edge { int from, to, cost; }; int V, E; int d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { int count = 0; for (int i = 0; i < V; i++) { d[i] = INF; } d[s] = 0; while (tr...
using namespace std; #define MAX_V 1000 #define MAX_E 2000 #define INF 1e9 #include <iostream> #include <vector> struct edge { int from, to, cost; }; int V, E; int d[MAX_V]; edge es[MAX_E]; bool find_negative_loop(int s) { int count = 0; for (int i = 0; i < V; i++) { d[i] = INF; } d[s] = 0; while (tr...
[["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
326
3
#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; typedef pair<int, int> ii; const int IINF = INT_MAX; vector<ii> G[100010]; int mincost[100010]; int V, E, r; struct Data { int cur, cost; bool operator<(const Data &data) const { return...
#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; typedef pair<int, int> ii; const int IINF = INT_MAX; vector<ii> G[100010]; int mincost[100010]; int V, E, r; struct Data { int cur, cost; bool operator<(const Data &data) const { return...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
449
2
class exist_negative_cycle(Exception): pass def bellman_ford(g, size, start=0): d = [float('inf')] * size d[start] = 0 for _ in range(size): for u in g: for length, v in g[u]: if d[v] > d[u] + length: d[v] = d[u] + length for u in g: ...
class exist_negative_cycle(Exception): pass def bellman_ford(g, size, start=0): d = [float('inf')] * size d[start] = 0 for _ in range(size): for u in g: for length, v in g[u]: if d[v] > d[u] + length: d[v] = d[u] + length for u in g: ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
233
2
class BellmanFord: """Bellman-Ford algorithm : find the shortest path from a vertex Complexity: O(VE) used in GRL1A(AOJ) """ def __init__(self, V, E, start, INF=10**9): """ V: the number of vertexes E: adjacency list (all edge in E must be 0 or positive) start:...
class BellmanFord: """Bellman-Ford algorithm : find the shortest path from a vertex Complexity: O(VE) used in GRL1A(AOJ) """ def __init__(self, V, E, start, INF=10**9): """ V: the number of vertexes E: adjacency list (all edge in E must be 0 or positive) start:...
[["+", 0, 57, 15, 679, 31, 666, 0, 206, 0, 70], ["+", 0, 57, 15, 679, 31, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 679, 31, 666, 0, 206, 0, 73]]
5
378
25
V, E, root = map(int, input().split()) visited = [False] * V nodes = [[] for i in range(V)] cost = [[] for i in range(V)] for i in range(E): s, t, d = map(int, input().split()) nodes[s].append(t) cost[s].append(d) dist = [float('inf')] * V dist[root] = 0 negative_cycle = False for k in range(V): for ...
V, E, root = map(int, input().split()) visited = [False] * V nodes = [[] for i in range(V)] cost = [[] for i in range(V)] for i in range(E): s, t, d = map(int, input().split()) nodes[s].append(t) cost[s].append(d) dist = [float('inf')] * V dist[root] = 0 negative_cycle = False for k in range(V): for ...
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 64, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 657, 31, 22]]
5
266
5
import sys INF = float('inf') def Bellmanford(n, edges, r): d = [INF] * n d[r] = 0 for i in range(n): flag = False for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c flag = True if f...
import sys INF = float('inf') def Bellmanford(n, edges, r): d = [INF] * n d[r] = 0 for i in range(n): flag = False for (u, v, c) in edges: if d[u] != INF and d[u] + c < d[v]: d[v] = d[u] + c flag = True if f...
[["+", 0, 57, 64, 196, 0, 37, 0, 634, 0, 70], ["+", 0, 57, 64, 196, 0, 37, 0, 634, 0, 73]]
5
213
10
V, E, r = map(int, input().split()) INF = 2 << 21 G = [[] for i in range(V)] dist = [INF for j in range(V)] def bellman_ford(s): p, flg = [-1 for i in range(V)], [False for i in range(V)] dist[s], flg[s], cnt = 0, True, 0 while True: if cnt >= V: return False on = [] ...
V, E, r = map(int, input().split()) INF = 2 << 21 G = [[] for i in range(V)] dist = [INF for j in range(V)] def bellman_ford(s): p, flg = [-1 for i in range(V)], [False for i in range(V)] dist[s], flg[s], cnt = 0, True, 0 while True: if cnt >= 2 * V: return False on = [] ...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48]]
5
320
2
#include <limits.h> #include <stdio.h> int n; int mins[270000]; void update(int ul, int ur, int val, int k, int nl, int nr) { if (ur < nl || ul > nr) return; else if (ul <= nl && ur >= nr) mins[k] = val; else { if (mins[k] >= 0) { update(nl, nr, mins[k], 2 * k + 1, nl, (nl + nr) / 2); up...
#include <limits.h> #include <stdio.h> int n; int mins[270000]; void update(int ul, int ur, int val, int k, int nl, int nr) { if (ur < nl || ul > nr) return; else if (ul <= nl && ur >= nr) mins[k] = val; else { if (mins[k] >= 0) { update(nl, nr, mins[k], 2 * k + 1, nl, (nl + nr) / 2); up...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
513
2
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define ...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i = (int)m; i < (int)n; ++i) #define ...
[["-", 51, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 51, 4, 0, 16, 31, 23, 0, 16, 12, 13]]
1
632
2
#define NDEBUG #include <cassert> #include <stdexcept> #include <utility> template <class ValueMonoid, class OperatorMonoid, class Modifier, template <class> class Container> class lazy_segment_tree { public: using value_structure = ValueMonoid; using value_type = typename value_structure::value_type; ...
#define NDEBUG #include <cassert> #include <stdexcept> #include <utility> template <class ValueMonoid, class OperatorMonoid, class Modifier, template <class> class Container> class lazy_segment_tree { public: using value_structure = ValueMonoid; using value_type = typename value_structure::value_type; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]]
1
1,624
4
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
[["+", 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
1,732
6
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 177], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 123, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,606
4
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
#include <algorithm> #include <array> #include <cstdint> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define ll long long #define rep(i, a, b) for (int i ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
1,691
2
#include <bits/stdc++.h> using namespace std; #define int long long // BEGIN CUT HERE struct RUP { int n; vector<int> dat, laz; const int def = INT_MAX; RUP() {} RUP(int n_) { init(n_); } void init(int n_) { n = 1; while (n < n_) n *= 2; dat.clear(); dat.resize(2 * n - 1, def); laz...
#include <bits/stdc++.h> using namespace std; #define int long long // BEGIN CUT HERE struct RUP { int n; vector<int> dat, laz; const int def = INT_MAX; RUP() {} RUP(int n_) { init(n_); } void init(int n_) { n = 1; while (n < n_) n *= 2; dat.clear(); dat.resize(2 * n - 1, def); laz...
[["+", 8, 123, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 14, 8, 9, 0, 37, 0, 69, 28, 22], ["+", 8, 9, 0, 37, 0, 69, 341, 342, 0, 70], ["+", 8, 9, 0, 37, 0, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 37, 0, 69, 341, 342, 0, 73], ["+", 8, 123, 0, 14, 8, 9, 0, 37, 0, 35]]
1
613
6
#include <bits/stdc++.h> using namespace std; using Int = long long; // BEGIN CUT HERE template <typename T, typename E> struct RBST { int xor128() { static int x = 123456789; static int y = 362436069; static int z = 521288629; static int w = 88675123; int t; t = x ^ (x << 11); x = y; ...
#include <bits/stdc++.h> using namespace std; using Int = long long; // BEGIN CUT HERE template <typename T, typename E> struct RBST { int xor128() { static int x = 123456789; static int y = 362436069; static int z = 521288629; static int w = 88675123; int t; t = x ^ (x << 11); x = y; ...
[["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
2,271
4
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; const int MAX_N = 1 << 17; const ll INF = 1LL << 60; class RMQ2 { public: struct data { bool type; // 0 - empty , 1 - update ll value; }; ll n, dat[2 * MAX_N - 1]; data td[2 * MAX_N - 1]; RMQ2() { n ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; const int MAX_N = 1 << 17; const ll INF = INT_MAX; class RMQ2 { public: struct data { bool type; // 0 - empty , 1 - update ll value; }; ll n, dat[2 * MAX_N - 1]; data td[2 * MAX_N - 1]; RMQ2() { n = ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22]]
1
723
4