Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; int ok, n, m; struct Seg { static const int maxn = 1e5 + 10; struct node { int v, lazy; } tree[maxn << 3]; void build_tree() { memset(tree, 0, sizeof(tree)); } void push_down(int now, int l, int r) { if (tree[now].lazy) { tree...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") using namespace std; const int MAXN = 1e5 + 5, MAXBITS = 30, MAXBASE = 1 << 18; int n, m, base = 1, a[MAXN], t[MAXBASE * 2], q[MAXN], l[MAXN], r[MAXN], sum[MAXN]; void build() { for (i...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int ma[500000]; vector<pair<pair<int, int>, long long int> > v; long long int seg[500000]; long long int ans[500000]; long long int all = 0; long long int qry(int index, int start, int end, int qs, int qe) { if (start > end || end < qs || start > qe) { return all; }...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class Main{ final boolean isFileIO = false; BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer(""); String delim = " "; public static void main(String[] args) throws IOException { Main m = new Main(); m.ini...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.IOException; import java.util.InputMismatchException; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author karan173 */ public class Mai...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); new Main().run(in, out); out.close(); } void run(FastScanner in,...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> const int MAX = 100005, INF = (1 << 30) - 1; struct segtree { int a[MAX << 2], o[MAX << 2], ql, qr, qv; void pushDown(int x) { if (o[x]) { a[x << 1] |= o[x]; a[x << 1 | 1] |= o[x]; o[x << 1] |= o[x]; o[x << 1 | 1] |= o[x]; o[x] = 0; } } int query(in...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int Set(int N, int pos) { return N = N | (1 << pos); } int reset(int N, int pos) { return N = N & ~(1 << pos); } bool check(int N, int pos) { return (bool)(N & (1 << pos)); } void CI(int &_x) { scanf("%d", &_x); } void CO(int &_x) { cout << _x; } template <typename T> void ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int sum[maxn << 2]; vector<int> v; struct node { int l, r, q; } dot[maxn]; void build(int x, int l, int r) { if (l == r) { sum[l] = 0; return; } int mid = (l + r) / 2; build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r); } void ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; template <class A, class B> ostream &operator<<(ostream &out, const pair<A, B> &a) { return out << "(" << a.first << "," << a.second << ")"; } template <class A> ostream &operator<<(ostream &out, const vector<A> &a) { for (const A &it : a) out << it << " "; return out...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int n, m; int t[32][100100]; int l[100001], r[100001], q[100001]; int a[100100]; int st[100001][18]; int Log2[100001]; void buildSparse() { for (int i = 0; i < n; ++i) st[i][0] = a[i]; for (int j = 1; j < 18; ++j) { for (int i = 0; i + (1 << j) - 1 < n; ++i) { ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Solution { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static StringT...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; public class b { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(), m = input.nextInt(); int[] as = new int[m], bs = new int[m], cs = new int[m]; IT it = new ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pli = pair<ll, int>; const int INF = 0x3f3f3f3f, N = 1e5 + 5; const ll LINF = 1e18 + 5; int n, m, a[N]; struct query { int l, r, q; } Q[N]; int bit[N << 2][30]; bool tag[N << 2][30]; void pushdown(int p, int k, int l...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
//package round275; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = n...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long getMid(long long start, long long end) { return start + (end - start) / 2; } long long getFin_helper(vector<long long> &seg_tree, long long index, long long val) { if (2 * index + 1 < seg_tree.size() && 2 * index + 2 < seg_tree.size()) ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringToken...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class D { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); public void run() { int n = in.nextInt(), m = in.nextInt(); int[][] cs = new int[m][]; for (int i = 0; i < m; i++) cs[i] = new int[]{in.nextInt() - 1, in.next...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const double PI = 4 * atan(1); const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9 + 7; const int MAX_N = 2e6 + 10; int n, c; int L[MAX_N], R[MAX_N], Q[MAX_N]; ll sum[MAX_N]; ll a[MAX_N], t[4 ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; struct nod { int l, r; long long int q; } nods[100000 + 10]; bool compare(nod x, nod y) { if (x.l == y.l) return x.r < y.r; return x.l < y.l; } long long int ans[100000 + 10]; int bits[35]; int last[35]; long long int p2[35]; long long int segs[5 * 100000 + 10]; voi...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 10, allone = ((long long)1 << 31) - 1; long long segment[3 * N], segmentand[3 * N], n, q, l[N], r[N], k[N], a[N]; void addSEG(int L, int R, int num, int s, int f, int id) { if (R <= s || L >= f || s == f) return; if (L <= s && R >= f) { seg...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; public class D_483 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(), m = sc.nextInt(); int N = 1; while(N < n) N <<= 1; int[] array = new int[N + 1...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 17; private DataInputStream din; private byte[] buffe...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; public class Main { static long finArray[]; static long tree[]; static long ret = (1 << 31) - 1; public static void main(String [] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.read...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
//package codeforces; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * @author muhossain * @since 2020-02-20 */ public class B482 { public static void main(String[] args) { FastScanner fs = new FastScanner(); int n = fs.nextInt(); ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class D { class IntervalTree { int[] d; HashSet<Integer> badId; int neutral; boolean and; int cnt = 0; int n; public IntervalTree(int n, boolean and) { this.and = and; neutral = and ? Integ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const long long base = 1331; const long long N = 1e5 + 1; template <typename T> inline void Cin(T& x) { char c = getchar(); x = 0; while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); } template <typename T, typ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 19; int a[maxn][30], ff[maxn], l[maxn], r[maxn], q[maxn]; struct Tree { static const int LOW = (1 << 30) - 1; int f(int a, int b) { return (a & b); } vector<int> s; int n; Tree(int n = 0, int def = 0) : s(2 * n, def), n(n) {} void update(i...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class InterestingArray { static class C implements Comparator<Con> { @Override public int compare(Con arg0, Con arg1) { ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5; int n, m, l, r, p, cnt; int a[maxn + 10], st[(maxn + 10) << 2], tag[(maxn + 10) << 2]; struct node { int l, r, p; node(int a = 0, int b = 0, int c = 0) : l(a), r(b), p(c) {} } cc[maxn + 10]; void pushdown(int o, int l, int r) { if (tag[o]) { ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.util.*; public class Main implements Runnable { private class Query { private int id; private int l; private int r; private int q; ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class Main { static Scanner scanner = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static final long INF = (long) 1e18; public static void main(String[] args) throws Exception { //====================================...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.StringTokenizer; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int l[] = new int[m + 10]; int r[] = new int[m + 10]; int v[] = new int[m + 10]; for (int i = 1; i <= m; i++) { l[i] = sc.next...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long int tree[4 * 100001]; vector<long long int> A; void build(long long int i, long long int l, long long int r) { if (l == r) tree[i] = A[l]; else { long long int mid = (l + r) / 2; build(2 * i, l, mid); build(2 * i + 1, mid + 1, r); tree[i] =...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; import java.io.OutputStream...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.Arrays; import java.util.StringTokenizer; /** * 482B * * @author artyom */ public class InterestingArray implements Runnable { private static final int MAX_BIT = 30; pri...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class D275 { public static void main(String[] args) { MyScanner scan = new MyScanner(); PrintWriter out = new PrintWriter(Syst...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 110000; struct node { int val, lazy; } tree[N * 4]; int n, m, ql, qr, qa; int ans[N], ll[N], rr[N], aa[N]; void pushup(int x) { tree[x].val = tree[x << 1].val & tree[x << 1 | 1].val; } void pushdown(int x) { int &d = tree[x].lazy; if (d) { tree[x << ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int s[31][100003]; int bit[31][100003]; int countzero[31][100003]; int main() { int n, m; cin >> n >> m; int l[m], r[m], q[m]; for (int i = 0; i < m; i++) { cin >> l[i] >> r[i] >> q[i]; for (int j = 0; j < 30; j++) { if (q[i] & (1 << j)) { s[j]...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; public class Main implements Runnable { int INF = (int) 1e9 + 7; static class Pair { long a; long b; public Pair(long a, long b)...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; void make_unique(vector<int> &a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); } void printDouble(double f, int p) { cout << fixed; cout << setprecision(p) << f << endl; } int Set(int N, int cur) { return N = N | (1 << cur); } int Reset(i...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class Main { public static void main...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const long long mod = (long long)1e9 + 7; struct node { long long l, r, q; }; void test_case() { long long n, m; cin >> n >> m; vector<long long> arr(n); vector<node> query(m); vector<vector<long long> > bit(n + 1, vector<long long>(31)); for (long long i = 0;...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int N, M; int lt[100005], rt[100005], q[100005]; int a[100005], lg[100005]; int s[100005][31]; int Ask(int x, int y) { int tmp = lg[y - x + 1]; return s[x][tmp] & s[y - (1 << tmp) + 1][tmp]; } void End(int x) { printf("%s\n", x ? "YES" : "NO"); if (x) for (int i...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Stack; public class Main { static final int SIZE = (int) Math.pow(2, 17); static final int ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops") const int N = 2e5 + 5; const long long int mod = 1e9 + 7; const long long int Mod = 998244353; const long double Pi = acos(-1); const long long int Inf = 4e18; using namespace std; vector<int> a; struct SegmentTree { vecto...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class Problem_482B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(), q = sc.nextInt(); SegmentTree sgt = new SegmentTree(n); Triple[] query = new Triple[q...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int arr[1000000]; int tree[1000000]; int lazy[1000000]; void buildtree(int node, int a, int b) { if (a > b) return; if (a == b) { tree[node] = arr[a]; return; } buildtree(2 * node, a, (a + b) / 2); buildtree(2 * node + 1, (a + b) / 2 + 1, b); tree[node] ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class D { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); /* public void run() { int n = in.nextInt(), m = in.nextInt(); int[][] cs = new int[m][]; for (int i = 0; i < m; i++) cs[i] = new int[]{in.nextInt() - 1, in....
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, inf = 2e9 + 10; int seg[4 * N], flag[4 * N], l[N], r[N], q[N]; inline void relax(int ind) { int x = flag[ind]; if (!x) return; flag[ind] = 0; seg[2 * ind] |= x; flag[2 * ind] |= x; seg[2 * ind + 1] |= x; flag[2 * ind + 1] |= x; } int qu...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using std::cin; using std::cout; using std::vector; const int MAXBITS = 30; void buildTree(vector<unsigned int>* T, int n, const vector<unsigned int>& result) { for (int i = n; i < T->size(); ++i) { (*T)[i] = result[i - n]; } for (int i = n - 1; i > 0; --i) { (*T)[i...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub InputReader in = new InputReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); new Task().go(in, out); out.c...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.awt.image.ReplicateScaleFilter; import java.io.*; import java.math.*; import java.util.*; import javax.swing.RepaintManager; public class Main { static long mod = (long) 1e9 + 7; public static void main(String[] args) { FasterScanner s = new FasterScanner(); PrintWriter out = new PrintWriter(Syste...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int n, m, l, r, q; int d[2 * 131072 + 3]; int t[1000]; vector<int> st[100007], kon[100007]; pair<pair<int, int>, int> kraw[100007]; void insert(int poz, int val) { poz += 131072; d[poz] = val; poz /= 2; while (poz) { d[poz] = d[poz * 2] & d[poz * 2 + 1]; poz...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5; int n, m, x[N + 10], y[N + 10], z[N + 10]; bool tag[N * 4 + 10][31], bit[N * 4 + 10][31]; inline void down(int k, int i) { if (tag[k][i]) { tag[k << 1][i] = bit[k << 1][i] = 1; tag[k << 1 | 1][i] = bit[k << 1 | 1][i] = 1; tag[k][i] = 0;...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long x[100005], y[100005], q[100005], N = ((long long)1 << 40) - 1; struct node { long long r, l, v, sum; } tree[400005]; void buildtree(int i, int l, int r) { tree[i].l = l; tree[i].r = r; tree[i].v = 0; if (tree[i].r == tree[i].l) { tree[i].sum = 0; ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.math.*; import java.io.*; public class CF482B { class ST { int n, and[], lo[], hi[]; public ST(int nn, int[] a) { n = nn; and = new int[n << 2]; lo = new int[n << 2]; hi = new int[n << 2]; build(1, 0, n - 1, a); } void build(int i, int a, int b, int[] arr) { l...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class D { public static int[] seg; public static int[] initial; public static int[] cum; public static int[] ans; public static boolean[] lazy; public static void buildtree(int node, int i, int j) { if(i...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the t...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int b) { long long int res = 1; a = a % 1000000007; while (b > 0) { if (b & 1) { res = (res * a) % 1000000007; b--; } a = (a * a) % 1000000007; b >>= 1; } return res; } long long int gcd(lo...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long tree[3 * 100005]; bool lazy[3 * 100005]; void update(long long node, long long b, long long e, long long i, long long j, long long v) { if (i > e || j < b) { return; } if (b >= i && e <= j) { lazy[node] = true; { tree[node] = tree[nod...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
from sys import stdin input=stdin.readline def funcand(a,b): return a&b class SegmentTree: def __init__(self, data, default=(1<<31)-1, func=max): """initialize the segment tree with data""" self._default = default self._func = func self._len = len(data) self._size = _size = 1 << (self._len - 1).bit_length...
PYTHON3
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringToken...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long bigmod(long long b, long long p) { if (p == 0) return 1; long long my = bigmod(b, p / 2); my *= my; my %= 1000000007; if (p & 1) my *= b, my %= 1000000007; return my; } int setb(int n, int pos) { return n = n | (1 << pos); } int resb(int n, int pos) { ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; void update(vector<int> &BIT, int value, int index) { int n = BIT.size() - 1; while (index <= n) { BIT[index] += value; index += index & (-index); } } int query(vector<int> &BIT, int index) { int sum = 0; while (index > 0) { sum += BIT[index]; inde...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int a[112345], l[112345], r[112345], q[112345], sum[112345], tree[4 * 112345]; int maxx = (1ll << 30) - 1; void build_tree(int node, int s, int e) { if (s == e) { tree[node] = a[s]; return; } int mid = (s + e) / 2; int c1 = 2 * node + 1; int c2 = c1 + 1; ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the t...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int n, m, cum[31][100100], a[100100], seg[4 * 100100]; pair<int, pair<int, int> > pr[100100]; void build(int p, int l, int r) { if (l == r) { seg[p] = a[l]; return; } int md = (l + r) >> 1; build(p * 2, l, md); build(p * 2 + 1, md + 1, r); seg[p] = seg[p...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; /** *...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; struct node { int l, r, val; } q[150000]; int INF; int a[150000]; int sum[32][150000]; int now[32]; int tree[150000 * 4]; void pushup(int rt) { tree[rt] = tree[rt * 2] & tree[rt * 2 + 1]; } void build(int l, int r, int rt) { if (l == r) { tree[rt] = a[l]; return...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1e5 + 10, LG = 30, Non_And = ((1 << 30)) - 1; int ps[LG][N], n; pair<pair<int, int>, int> quer[N]; void upd(int l, int r, int bit) { ps[bit][r]--; ps[bit][l]++; } void mdfy(int bit) { for (int i = 1; i <= n; i++) ps[bit][i] += ps[bit][i - 1]; for (...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.util.*; public class InterestingArray { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[][] pre = new int[31][n+1]; int[][] queries = new int[3][m]; for(int q = 1; q <= m; q++) { int l = scan.nextInt()-1; ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& _p) { return os << "(" << _p.first << "," << _p.second << ")"; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& _V) { bool f = true; os << "["; for (auto v ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.regex.*; public class Myclass{ // public static ArrayList adj[]=new ArrayList[300001]; static long cal=0L; static void pre() { for(int i=0;i<32;i++) { ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> long double sqr(long double a) { return a * a; }; using namespace std; int n, m, l[100010], r[100010], t[4 * 100010], q[100010]; int ans[100010]; int s[35][100010]; void build(int v, int L, int R) { if (L == R) t[v] = ans[L]; else { int M = (L + R) >> 1; build(v + v, L, M); ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class Main { static int n, m; static long[] st, arr, l, r, q; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); n = sc.nextInt(); m = sc.nextInt(); flage = t...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int n, m, ST[1 << 18], Query[100000][3], RAQ(int, int, int, int, int); void Update(int, int, int, int, int, int); int main() { scanf("%d%d", &n, &m); for (int q = 0, l, r, x; q < m; q++) { scanf("%d%d%d", &l, &r, &x); l--, r--; Query[q][0] = l, Query[q][1] =...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> int tree[400005] = {0}, a[100005], b[100005], q[100005]; void add(int l, int r, int ll, int rr, int data, int node) { if (l <= ll && r >= rr) tree[node] |= data; else if (l > rr || r < ll) return; else { add(l, r, ll, (ll + rr) / 2, data, node * 2); add(l, r, (ll + rr) / 2...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int a[100005][31] = {0}; int L[100001]; int R[100001]; int Q[100001]; int main() { int n, m; scanf("%d %d", &n, &m); for (int z = 0; z < m; z++) { int l, r, q; scanf("%d %d %d", &l, &r, &q); L[z] = l; R[z] = r; Q[z] = q; for (int i = 0; i < 31;...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int ans[1000005], tree[1000005], n, l[1000005], r[1000005], x[1000005]; int an[1000005][35]; int anded(int a, int b) { a += n, b += n; int s = (1 << 30) - 1; while (a <= b) { if (a % 2 == 1) s &= tree[a++]; if (b % 2 == 0) s &= tree[b--]; a /= 2, b /= 2; ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.wri...
PYTHON3
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
// practice with rainboy import java.io.*; import java.util.*; public class CF482B extends PrintWriter { CF482B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF482B o = new CF482B(); o.main(); o.flush(); } int[] tt; int n; void update(int l, int r, ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int a[N], b[N]; struct node { int a, b, c; }; vector<node> v; int T[4 * N]; void inti(int n, int b, int e) { if (b == e) { T[n] = a[b]; return; } inti(n * 2, b, (b + e) / 2); inti(n * 2 + 1, (b + e) / 2 + 1, e); T[n] = T[n * 2] &...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.*; import java.util.*; public class Main implements Runnable { private class Query { private int id; private int l; private int r; private int q; Query(int l,int r,int q,int id) { this.l=l; this.r=r; this.q=q; ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 10, MOD = 1e9 + 7, INF = 1e9 + 10, SQ = 550, LOG = 25; long long n, m, x1, x2, d, z, t, y2, a[N], dp[N << 2], lazy[N << 2], mini, ptr, x, y, ptr1, ptr2, ans; pair<pair<long long, long long>, long long> pr[N]; void shift(int pos, int lch, int rc...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95 // ~/sudo apt-get Accpeted import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.*; public class a { public static void main(String[] Args) throws ...
JAVA
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int a[200005], tree[400005]; void build(int node, int l, int r) { if (l == r) { tree[node] = a[l - 1]; return; } int mid = (l + r) >> 1; build(node * 2, l, mid); build(node * 2 + 1, mid + 1, r); tree[node] = tree[node * 2] & tree[node * 2 + 1]; } int que...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000 + 10; struct Node { int l, r; int val; } t[MAX_N * 4]; vector<int> ans; int a[MAX_N], b[MAX_N], c[MAX_N], n, m; void build(int o, int l, int r) { t[o].l = l; t[o].r = r; t[o].val = 0; if (l == r) { return; } int mid = (l + r) >> ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; struct node { int l, r, val; } a[1000000 + 10]; int num[1000000 + 10], laze[1000000 + 10]; void pushup(int l, int r, int rt) { num[rt] = num[rt * 2] & num[rt * 2 + 1]; } void pushdown(int l, int r, int rt) { if (laze[rt]) { num[rt * 2] |= laze[rt]; num[rt * 2 + ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; long long dp[100005][35]; long long a[100005]; long long segtree[400005]; void build(long long node, long long start, long long end) { if (start == end) { segtree[node] = a[start]; return; } long long mid = (start + end) / 2; build(2 * node + 1, start, mid);...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int treeor[400000]; int treeand[400000]; int a[100001]; void modifyor(int v, int tl, int tr, int l, int r, int val) { if (l == tl && r == tr) treeor[v] |= val; else { int x = (tl + tr) / 2; if (l <= x) modifyor(v * 2, tl, x, l, min(x, r), val); if (r >= ...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; int value[101000 * 4], f[101000], l[101000], r[101000], q[101000]; void insert(int p, int L, int R, int l, int r, int q) { if (L == l && R == r) { value[p] |= q; return; } int mid = (L + R) >> 1; if (r <= mid) insert(p << 1, L, mid, l, r, q); else if (...
CPP
482_B. Interesting Array
We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≀ li ≀ ri ≀ n) meaning that value <image> should be equal to qi. Your task is to find any interesting array of n elements or state that su...
2
8
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int a[maxn << 2], n, m; int OR[maxn << 2]; struct IA { int l, r, q; } ia[maxn]; void push_up(int rt) { a[rt] = a[rt << 1] & a[rt << 1 | 1]; } void push_down(int rt) { if (OR[rt]) { a[rt << 1] |= OR[rt]; a[rt << 1 | 1] |= OR[rt]; OR[r...
CPP