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 | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class main4 {
// static Scanner sc = null;
static Scanner sc = new Scanner(System.in);
static class Tree {
int[] d = null;
int n;
public Tree(int n) {
this.d = new int[100 * 100000];
this.n = n;
}
private... | 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;
const int maxN = 2e6 + 1000;
int a[maxN];
int l[maxN], r[maxN], q[maxN];
inline void add_q(int cur, int fi, int se, int le, int ri, int qu) {
int mid = (fi + se) / 2;
if (fi == le and se == ri) {
a[cur] |= qu;
} else if (ri <= mid)
add_q(cur * 2, fi,... | 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.Arrays;
public class ProD2 {
static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static int nextInt() throws IOException
{
in.nextToken();
return (int)in.nval;
}
static PrintWriter out=new PrintWriter(new O... | 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 T[4 * 100005];
int Lz[4 * 100005];
long long update(int n, int l, int r, int i, int j, int val) {
if (Lz[n]) {
T[n] |= Lz[n];
if (l != r) {
Lz[2 * n] |= Lz[n];
Lz[2 * n + 1] |= Lz[n];
}
Lz[n] = 0;
}
if (i <= l and j >= r) {
T[n] |= ... | 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 = 100 * 1000 + 10, L = 30;
int n, m, a[N][L + 5], ps[N][L + 5], l[N], r[N], p[N], ans[N];
int main() {
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> l[i] >> r[i] >> p[i];
for (int j = 0; j <= L; j++) {
if ((1 << j) & p[i]) {
a[l[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;
const double eps = 0.000000000000001;
int n, m;
int A[100010];
int cum[100010][32];
struct que {
int l, r, q;
};
que qq[100010];
int main() {
scanf("%d%d", &n, &m);
int i, j;
for (i = 0; i < m; i++) {
int l, r, q;
scanf("%d%d%d", &l, &r, &q);
qq[i] = (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 namespace std;
const int N = (int)1e5 + 11;
int push[N << 2], aa[N], bb[N], cc[N], seg[N << 2];
int fin[N], segand[N << 2];
void pusher(int id) {
push[id << 1] |= push[id];
push[id << 1 | 1] |= push[id];
seg[id << 1] |= push[id];
seg[id << 1 | 1] |= push[id];
push[id] = 0;
}
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 | import java.io.*;
import java.util.*;
public class InterestingArray
{
static int MAXN = 111101;
static int LOGN = 32 , INF = Integer.MAX_VALUE;
static int X[][] = new int[LOGN][MAXN];
static int ST[] = new int[MAXN*4];
static int A[] = new int[MAXN];
static int L[]=new int[MAXN] , R[]=new int[MA... | 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 | /*
ID: govind.3, GhpS, govindpatel
LANG: JAVA
TASK: Main
*/
import java.io.*;
import java.util.*;
public class Main {
private int BIT = 30;
private int MAX = 1000 * 1000;//10^6
private int[] tree = new int[4 * MAX];
private int[] values = new int[MAX];
int[] sum = new int[MAX];
private ... | 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 MAX = 1e5 + 2;
int n, m;
struct Query {
int l, r, q;
bool operator<(const Query& rhs) const {
return l == rhs.l ? r < rhs.r : l < rhs.l;
}
} qry[MAX];
int ans[MAX];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m;
for (int i = 0; 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
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 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Aman Kumar Singh
*/
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 | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf482b {
public static void main(String[] args) throws IOException {
int n = rni(), m = ni(), rules[][] = new int[n + 1][30];
List<int[]> rr = new ArrayList<>();
for(int 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>
using namespace std;
using ll = long long;
constexpr int kMaxN = 1e5 + 3;
vector<int> in[kMaxN];
vector<int> out[kMaxN];
int q[kMaxN];
struct SegTree {
int sz;
static constexpr int kMax = (1 << 30) - 1;
struct node {
int v = kMax;
void merge(node& n1, node& n2) { v = n1.v & n2.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 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int seg[maxn << 2], lazy[maxn << 2], ul, ur;
void pushup(int cur) { seg[cur] = seg[cur << 1] & seg[cur << 1 | 1]; }
void pushdown(int cur) {
if (lazy[cur]) {
seg[cur << 1] |= lazy[cur];
seg[cur << 1 | 1] |= lazy[cur];
lazy[cur << 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 | # Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import combinations, permutations
from bisect import *
from fractions import Fractio... | 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 | #include <bits/stdc++.h>
using namespace std;
vector<long long int> a(100005, 0), seg(4 * 100005, 0), lazy(4 * 100005, 0);
void build(long long cur, long long st, long long end) {
if (st == end) {
seg[cur] = a[st];
return;
}
long long mid = (st + end) >> 1;
build(2 * cur, st, mid);
build(2 * cur + 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.*;
import java.io.*;
public class Solution implements Runnable {
FastScanner sc;
PrintWriter pw;
final class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamRe... | 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.sql.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class SegmentTree { // 1-based DS, OOP
public static void main(String[] args) thr... | 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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dx[8] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
const long long inf = 998244353;
vector<int> adj[200010], vis(200010, 0), par(200010, 0), dis(200010, 0),
di(200010, 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;
const long long N = 1e5 + 10;
long long n, Q, c[31][N], ans[31][N];
struct rec {
long long l, r, d;
} q[N];
void update(long long l, long long r, long long d) {
for (long long i = 30; i >= 0; i--)
if (d & (1ll << i)) c[i][l]++, c[i][r + 1]--;
}
void init() {
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 | #include <bits/stdc++.h>
using namespace std;
void RD(int &x) { scanf("%d", &x); }
void RD(long long &x) { scanf("%I64d", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(long long &x, long long &y) { scanf("%I64d%I64d", &x, &y); }
void RD(double &x, double &y) ... | 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>
const int MAXBIT = 30;
const int maxn = 1111111;
const int maxm = 1111111;
using namespace std;
int num[maxn << 2];
int sum[maxn], q[maxn], l[maxn], r[maxn], a[maxn];
void pushup(int rt) { num[rt] = num[rt << 1] & num[rt << 1 | 1]; }
void build(int l, int r, int rt) {
if (l == r) {
num[rt... | 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.text.DecimalFormat;
import java.util.*;
public class Main {
static int mod = (int)1e9+7;
static int inf = (int)(2e9+1e8);
static double eps = 1e-15;
static int N = 111111;
int[] l = new int[N], r = new int[N], num = new int[N];
int[] col = new int[N<<2], sum = new int[N<<2];
void P... | 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.util.concurrent.ArrayBlockingQueue;
import java.awt.List;
import java.io.*;
import java.lang.*;
import java.lang.reflect.Array;
public class code2 {
public static long INF = Long.MAX_VALUE/100;
public static long[] a;
public static long[] stree;
public static void main(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.*;
import java.util.*;
public class Main {
// main
public static void main(String [] args) throws IOException {
// makes the reader and writer
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));... | 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, q;
} s[100005];
int sum[100005 << 2], ans[100005], dis[100005];
void pustup(int i) { sum[i] = sum[i << 1] & sum[i << 1 | 1]; }
void build(int l, int r, int i) {
if (l == r) {
sum[i] = ans[l];
return;
}
int mid = (l + r) >> 1;
build(... | 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::cerr;
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::fixed;
using std::ios_base;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::ostream;
using std::pair;
using std::set;
using std::setprecision;
using std::string;
usin... | 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 Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=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;
int n;
int lazy[600005];
bool haslazy[600005];
int tree[600005];
int arr[200005];
int lft(int x) { return 2 * x + 1; }
int ryt(int x) { return 2 * x + 2; }
struct lol {
int x;
int y;
int z;
};
void updt(int x, int l, int r, int value) {
tree[x] = (value | 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;
const int N = 100007;
const int MAXBIT = 30;
int a[N];
int sum[N];
int tree[3 * N];
inline void build(int v, int l, int r) {
if (l + 1 == r) {
tree[v] = a[l];
return;
}
int mid = (l + r) >> 1;
build(v * 2, l, mid);
build(v * 2 + 1, mid, r);
tree[v] = tre... | 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 poo(int a, int b) {
long long int x = 1, y = a;
while (b > 0) {
if (b % 2 == 1) {
x = (x * y);
}
y = (y * y);
b /= 2;
}
return x;
}
int p[32], fck[100005][32], pre[100005][32], val[100005];
vector<pair<int, int> > v[32], chd;
vector<int> an... | 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 inf = 1e18;
const long long mod = 1e9 + 7;
const long long MOD = 998244353;
const double EPS = 1e-8;
const double PI = acos(-1.0);
template <class T>
class SegmentTree {
public:
SegmentTree(std::vector<T> data, T value, T (*combine)(T obj1, T obj2));
Se... | 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 mod = 1000000007;
const int MAXN = 100005;
int n, m, li, ri, qi;
int a[800001], upd[800001];
void add(int x, int val) {
a[x] |= val;
upd[x] |= val;
}
void push(int x) {
add(x + x, upd[x]);
add(x + x + 1, upd[x]);
upd[x] = 0;
}
void update(int x, int l, 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.awt.Point;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-... | 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 + 5;
struct node {
int l, r, q;
bool operator<(const node &b) const {
if (r == b.r)
return l < b.l;
else
return r < b.r;
}
} a[maxn];
int tree[maxn << 2];
int lazy[maxn << 2];
void pushup(int rt) { tree[rt] = (tree[rt << 1] & t... | 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], b[100005], c[100005];
struct node {
long long left, right, sum, lazy;
};
node f[100005 << 2];
void build(int i, int l, int r) {
f[i].left = l;
f[i].right = r;
if (l == r) return;
int mid = (l + r) >> 1;
build(i << 1, l, mid);
build(i << 1 | 1, 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 | #include <bits/stdc++.h>
using namespace std;
int t[400000 + 5], n, m, atas[100003], bawah[100003], nilai[100003],
haha[33][100003], a[100003];
bool ada;
void build(int node, int l, int r) {
if (l == r) {
t[node] = a[l];
return;
}
int mid = (l + r) >> 1;
build(2 * node, l, mid);
build(2 * node + 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>
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;
if (tree[node] == (1LL ... | 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>
const int N = 1e5 + 5;
int n, m, seg[N << 2], tag[N << 2], L[N], R[N], Q[N];
void pushup(int rt) { seg[rt] = seg[rt << 1] & seg[rt << 1 | 1]; }
void update(int rt, int k) { seg[rt] |= k, tag[rt] |= k; }
void pushdown(int rt) {
if (!tag[rt]) return;
update(rt << 1, tag[rt]), update(rt << 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>
using namespace std;
int main() {
int n, m;
scanf("%d %d", &n, &m);
vector<int> ans(n, 0);
vector<pair<pair<int, int>, int> > queries(m);
for (auto &x : queries) {
scanf("%d %d %d", &x.first.first, &x.first.second, &x.second);
x.first.first--;
}
for (int b = 1; b < (1 << 3... | 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.StringTokenizer;
public class Main {
public static int N, M;
public static int[][] delta, value, prefixes, inputs;
public static int[] res;
public static void main(String[] args) throws IOException {
Bu... | 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.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual so... | 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 + 5;
struct cc {
int l, r, len, num;
bool operator<(const cc &x) const { return len < x.len; }
} a[maxn];
int b[maxn], sum[maxn << 2], add[maxn << 2], ans, f[maxn][20];
void push_down(int rt) {
if (add[rt]) {
sum[rt << 1] |= add[rt];
sum[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 | import java.util.*;
import java.io.*;
import java.text.*;
public class B482 {
static class SegmentTree { // 1-based DS, OOP
int N; // the number of elements in the array as a power of 2 (i.e. after padding)
int[] array, sTree, lazy;
SegmentTree(int[] in) {
array = in;
N = in.length - 1;
sTree = 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 | 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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class Main{
public static class SegTree{
... | 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 static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
p... | 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 optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int inf = 1e9;
struct Node {
Node *l = 0, *r = 0;
int lo, hi, mset = 0, val = 0;
Node(int lo, int hi) : lo(lo), hi(hi... | 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.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class main4 {
// static Scanner sc = null;
static Scanner sc = new Scanner(System.in);
static class Tree {
int[] d = null;
int n;
public Tree(int n) {
this.d = new int[100 * 100000];
this.n = n;
}
private... | 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 = 200100, M = 33;
int n, m, size;
struct Sgmtree {
int son[2], bit[M];
};
Sgmtree sgm[N];
int ans[N], cover[N][M], l[N], r[N], q[N];
void maintain(int node) {
int sl = sgm[node].son[0], sr = sgm[node].son[1];
for (int i = 0; i <= 31; i++)
sgm[node].bit... | 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 {
// main
public static void main(String [] args) throws IOException {
// makes the reader and writer
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));... | 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 inf = 1e15, mod = 1e9 + 7;
struct query {
int l, r, x;
};
query q[100005];
int m, n, st[4 * 100005], lazy[4 * 100005];
void update(int node, int l, int r, int ql, int qr, int val) {
if (lazy[node]) {
st[node] |= lazy[node];
if (l != r) {
la... | 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 nmax = 100011;
long long n, m, l[nmax], r[nmax], q[nmax];
long long a[nmax][32], ans[nmax][32];
void nhapdl() {
cin >> n >> m;
for (long long i = 1; i <= m; ++i) {
cin >> l[i] >> r[i] >> q[i];
for (long long j = 0; j <= 30; ++j)
if (q[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;
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(long long _x) { return __builtin_popcountll(_x); }
const int iINF = 1L << 30;
const long long lINF = 1LL << 60;
double EPS = 1e-9;
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _... | 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.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
static class Reader
{
BufferedReader ... | 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 comment(linker, "/STACK:100000000")
using namespace std;
const double pi = acos(-1.0);
const int rms = (1 << 18) - 1;
const int hrms = rms / 2;
const int size = 300 * 1000 + 10;
int rmq[rms + 1];
int n, m;
int lb[size], rb[size], q[size];
int val[size];
void change(int v, int lb, int rb... | 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 INF = 1e9;
const long long INF64 = 1e18;
const long long MOD = 1e9 + 7;
const long long MOD9 = 1e9 + 9;
const long long MOD3 = 998244353;
const long long P = 37;
const long long mxn = 501;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
... | 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 = 100001;
const long long c = (1ll << 30) - 1;
long long A[32][N];
long long st[N << 2];
pair<pair<long long, long long>, long long> par[N];
void build(long long l, long long r, long long nod) {
if (l == r) {
long long aux = 0;
for (long long 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 n, m, tree[400001], p = 131072, tree2[400001], su[100001];
bool check[400001];
void ins(int le, int ri, int c) {
while (le <= ri) {
if (le & 1) tree[le++] |= c;
if (!(ri & 1)) tree[ri--] |= c;
le >>= 1;
ri >>= 1;
}
}
int find(int a) {
int s = 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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class R275QDInterestingArray {
static int ans[] = new int[100005];
static int segtree[] = new int[4 * 100005];
static int andtree[] = new int[4 * 100005];
... | 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 = 1000005;
long long T[N << 2];
long long L[N << 2];
void refresh(int x) {
T[x] |= L[x];
L[2 * x] |= L[x];
L[2 * x + 1] |= L[x];
L[x] = 0;
}
void update(int l, int r, int x, int a, int b, long long v) {
refresh(x);
if (l > b || r < a || l > r) 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 | import java.io.*;
import java.util.*;
public class B {
static void solve() throws IOException {
int n = nextInt();
int m = nextInt();
int[][] v = new int[30][n + 1];
int[] l = new int[m];
int[] r = new int[m];
int[] q = new int[m];
for (int i = 0; i < m; i++) {
l[i] = nextInt() - 1;
r[i] = nextIn... | 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.StringTokenizer;
public class D {
BufferedReader br;
StringTokenizer in;
PrintWriter out;
public String nextToken() throws IOException {
while (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;
int segtree[400001];
int val[100001];
int inf = (1 << 30) - 1;
void build(int l, int r, int pos) {
if (l == r) {
segtree[pos] = val[r];
return;
}
int mid = (l + r) / 2;
build(l, mid, 2 * pos + 1);
build(mid + 1, r, 2 * pos + 2);
segtree[pos] = (segtree[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;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const long long INFll = 1ll * 1000000000 * 1000000000;
const long double PI =
3.141592653589793238462643383279502884197169399375105820974944;
int mul(int a, int b, int mod = 100000000... | 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.math.*;
import java.util.*;
import java.util.Map.*;
public class Main
{
public static void main(String[] args) throws IOException
{
// System.setIn(new FileInputStream("copycat.in"));// 读入文件
// System.setOut(new PrintStream(new FileOutputStream("copycat.out")));// 输出到文件
Scanner sc ... | 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.util.StringTokenizer;
public class CR275_interesting_array {
public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int m ... | 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 + 5;
vector<int> node;
struct T {
int l, r, col;
} tree[maxn << 2];
void pushdown(int rt) {
if (tree[rt].l == tree[rt].r) return;
tree[rt << 1 | 1].col |= tree[rt].col;
tree[rt << 1].col |= tree[rt].col;
pushdown(rt << 1 | 1);
pushdown(rt <<... | 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 optimize("O3")
#pragma GCC target("sse4")
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
T gcd(T a, T b) {
if (a == 0) return b;
return gcd(b % a, a);
}
long long power(long long a, long long b, long long m = 1000000007) {
long long answer = 1;
while (b) ... | 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 tree[16 * 100000 + 5];
int lazy[16 * 100000 + 5];
void update(int si, int sj, int idx, int val, int ql, int qr) {
if (si == ql and sj == qr) {
lazy[idx] |= val;
tree[idx] |= val;
} else {
int mid = (si + sj) / 2;
if (qr <= mid)
update(si, 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;
const long long int mod = 1000000007;
const long long int inf = 1e17;
const long long int N = 1e5 + 5, M = 32;
long long int mark[M][N];
long long int arr[N];
long long int sum[M][N];
long long int l[N], r[N], val[N];
long long int tree[4 * N];
long long int merge(long long... | 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.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solver {
public static v... | 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 = 100005;
int K = INT_MAX;
int seg[N * 4], lazy[N * 4], a[N], b[N], c[N];
int l, r, x;
void fix(int i, int s, int e) {
if (!lazy[i]) return;
seg[i] |= lazy[i];
if (s != e) {
lazy[i * 2 + 1] |= lazy[i];
lazy[i * 2 + 2] |= lazy[i];
}
lazy[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;
vector<int> solve(vector<array<int, 2>> zero, vector<array<int, 2>> one) {
vector<int> d(n + 2, 0);
for (auto [l, r] : one) {
d[l]++;
d[r + 1]--;
}
vector<int> v(n + 1, 0);
for (int i = 1; i <= n; i++) v[i] = v[i - 1] + d[i];
vector<int> nxt(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.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.IllegalCharsetNameException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class B482 {
class Segment implements Comparable<... | 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.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author Roman Elizarov
*/
public class Round_275_B {
public static final int BITS = 30;
public static void main(String[] args) {
new Round_275_B().go();
}
int n;
int m;
Cons[] cs;
static class Cons {
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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dx[8] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
const long long inf = 998244353;
vector<int> adj[200010], vis(200010, 0), par(200010, 0), dis(200010, 0),
di(200010, 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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Pradyumn Agrawal coderbond0... | 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, ft[100005];
void add(int x, int v) {
for (; x; x -= x & -x) ft[x] |= v;
}
int query(int x) {
int ans = 0;
for (; x <= n; x += x & -x) ans |= ft[x];
return ans;
}
class segtree {
vector<int> st;
vector<int> lazy;
int n;
void prop(int p) {
if (lazy[... | 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 sum[100050 << 2], ans[100050], num = 0;
struct que {
int st, ed, val;
} query[100050];
void Update(int L, int R, int val, int l, int r, int rt) {
if (L <= l && R >= r) {
sum[rt] |= val;
return;
}
int m = (l + r) >> 1;
if (L <= m) Update(L, R, val, 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.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class InterestingArray {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int MAX_LEN = 100002;
int MAX_BITS = 32;
... | 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 PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
static int n,m,ju,a;
static Pair[] aa=new Pair[100005];
static int[][] sum=new int[40][100005];
static int[][] mm=new int[40][100005];
static class Pair implements Comparable<Pair>... | 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.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class TestClass {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int num... | 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.*;
import java.io.InputStream;
public class Solution {
public static void main(String[] args) throws IOException {
InputStream inputStream =... | 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 INF = 1e9 + 322;
const long long LINF = 2e18 + 228;
const int MAXN = 1e5 + 228;
const int MOD = 1e9 + 7;
const double eps = 1e-14;
int n, m;
pair<pair<int, int>, int> a[MAXN];
int pr[MAXN][30], hmm[MAXN], t[4 * MAXN];
void build(int v, int tl, int tr) {
if (tl =... | 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 demand {
int L, R, V;
demand(int _L, int _R, int _V) {
L = _L;
R = _R;
V = _V;
}
};
long long arr[100100];
long long dp[100100];
bool call(int n, vector<demand> &d, int *ans) {
memset((arr), (0), sizeof(arr));
;
for (auto x : d) {
if (x.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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public 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 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 4e5 + 10;
int n, m, seg[4 * MAX], fen[33][MAX];
vector<pair<int, int> > v[33];
int res[MAX];
struct node {
node(int xx, int yy, int zz) {
X = xx;
Y = yy;
Z = zz;
}
int X, Y, Z;
};
vector<node> Q;
void upd(int a, int b, int c) {
while (b <... | 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 optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const long double eps = 1e-9;
mt19937 RNG(chrono::steady_clock::n... | 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 le, ri, x;
} nodes[100010];
int ans[100010], sum[100010];
int main() {
int n, m;
while (~scanf("%d%d", &n, &m)) {
for (int i = 0; i < m; i++) {
scanf("%d%d%d", &nodes[i].le, &nodes[i].ri, &nodes[i].x);
}
int flag = 0;
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 | #include <bits/stdc++.h>
using namespace std;
struct node {
int l, r, v;
bool operator<(const node& tt) const {
if (l == tt.l) return r < tt.r;
return l < tt.l;
}
} con[100008];
int ans[100008], rec[35][100008];
int main() {
int n, m, i, j, k;
bool f = true;
scanf("%d%d", &n, &m);
for (i = 0; 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 l[(int)1e5 + 5], r[(int)1e5 + 5], q[(int)1e5 + 5], t[4 * (int)1e5 + 5],
a[(int)1e5 + 5], sum[(int)1e5 + 5];
void build(int node, int l, int r) {
if (l == r) {
t[node] = a[l];
return;
}
int mid = (l + r) >> 1;
build(2 * node + 1, l, mid);
build(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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.StandardSocketOptions;
import java.util.Arrays;
import java.util.Collection;
import java.util.EmptyStackException;
import java.util.Locale;
import java.util.StringTokenizer;
public 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 | //package Graphs;
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class main482B {
public static PrintWriter out = new PrintWriter(System.out);
public static FastScanner enter = new FastScanner(System.in);
public static void main(String[] args) throws IOException {
... | 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 INF = 2000000000;
const int N = 1e5 + 5;
const int TN = 1 << 18;
const double PI = acos(-1);
int n, m, k;
long long tree[TN], lazy[TN] = {0};
void probagate(int l, int r, int p) {
tree[p] |= lazy[p];
if (l != r) {
lazy[p << 1] |= lazy[p];
lazy[(p << 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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long mod = 1e9 + 7;
const int phash = 3;
const long long modhash = 1000000000000000003;
int a[100005];
int tree[400005];
void build(int v, int tl, int tr) {
if (tl == ... | 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.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class InterestingArray {
public static void main(String[] arg... | 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 m, n;
const int N = 10e5 + 5;
vector<int> l(N), r(N), q(N), SS(N), SC(N), a(N);
bool work(int x) {
fill(SS.begin(), SS.end(), 0);
fill(SC.begin(), SC.end(), 0);
for (int i = 0; i < m; i++) {
if (q[i] >> (x - 1) & 1) {
SS[l[i]]++;
SS[r[i] + 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>
using namespace std;
int n, m, q[31][100100], pa[31][100100], ar[100100];
vector<int> v1[31][100100];
int main() {
if (fopen("input.in", "r")) freopen("input.in", "r", stdin);
cin >> n >> m;
for (int a, b, c, i = 0; i < m; i++) {
cin >> a >> b >> c;
for (int j = 0; j < 31; j++) {
... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.