-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestcase generator
84 lines (68 loc) · 1.7 KB
/
testcase generator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
#include <fstream>
#define MP make_pair
#define PB push_back
#define pb push_back
#define nn '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define UNIQUE(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end()))) ;
#define all(vec) vec.begin(),vec.end()
#define int long long
#define ll long long
#define pii pair<int,int>
#define pdd pair<double,double>
#define ff first
#define ss second
#define edge(u,v) adj[u].pb(v) , adj[v].pb(u)
#define white 0
#define blue 1
#define red 2
using namespace std;
typedef long long LL;
const int MOD=998244353;
const int N=1e6;
//const int oo=2LL*MOD*MOD*1LL+MOD;
const double pie=acos(-1.0);
const double EPS=1e-9;
//include this headers for random generator...
#include <chrono>
#include <iostream>
#include <random>
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll gen_random(ll l, ll r) {
return uniform_int_distribution<ll>(l, r)(rng);
}
int ask(int l,int r);
void update(int idx, int x,int n);
int tree[N+7], p[N+7];
int32_t main()
{
IOS
return 0;
}
void update(int idx, int x,int n)
{
while(idx<=n)
{
tree[idx]+=x;
idx+=(idx&-idx);
}
}
int query(int idx)
{
int sum=0;
while(idx>0)
{
sum+=tree[idx];
idx-=(idx&-idx);
}
return sum ;
}
int ask(int l,int r)
{
return query(r) - query(l-1) ;
}