blocks.cpp: In function 'void update(long long int, long long int, long long int, long long int)':
blocks.cpp:32:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
32 | int m = l+r>>1;
| ~^~
blocks.cpp: In function 'long long int get_ans(long long int, long long int, long long int, long long int, long long int)':
blocks.cpp:45:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
45 | int m = l+r>>1;
| ~^~
blocks.cpp: At global scope:
blocks.cpp:72:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
72 | main(){
| ^
blocks.cpp: In function 'int main()':
blocks.cpp:15:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ^~~~~~~ ~~~~~~~~
| |
| long long int*
16 | #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 | #define all(s) s.begin(),s.end()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 | #define allr(s) s.rbegin(),s.rend()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 | #define pb push_back
| ~~~~~~~~~~~~~~~~~~~~
20 | #define sz(v) (int)v.size()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | #define endi puts("");
| ~~~~~~~~~~~~~~~~~~~~~~
22 | #define eps 1e-12
| ~~~~~~~~~~~~~~~~~
23 | const int N = 2e6+12,INF=1e9+7;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 | int q[N],n,ansmx=0,der[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | vector <int>g[N];
| ~~~~~~~~~~~~~~~~~
26 | bool vis[N];
| ~~~~~~~~~~~~
27 | void update(int v,int l,int r,int x){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 | if (l == r){
| ~~~~~~~~~~~~
29 | der[v]=x;
| ~~~~~~~~~
30 | ret ;
| ~~~~~
31 | }
| ~
32 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
33 | if (m < x)
| ~~~~~~~~~~
34 | update((v<<1)+1,m+1,r,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
35 | else update(v<<1,l,m,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~
36 | der[v] = der[v<<1]+der[(v<<1)+1];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | }
| ~
38 |
|
39 |
|
40 | int get_ans(int v,int l,int r,int ql,int qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 | if (l > qr || r < ql)ret 0;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 | if (ql <= l && r <= qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~
43 | ret der[v];
| ~~~~~~~~~~~
44 | }
| ~
45 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
46 | ret get_ans(v<<1,l,m,ql,qr)+get_ans((v<<1)+1,m+1,r,ql,qr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 | }
| ~
48 |
|
49 |
|
50 |
|
51 | int baty[N],baty_max[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~
52 | int dsu_get(int x){
| ~~~~~~~~~~~~~~~~~~~
53 | if (baty[x] == x)ret x;
| ~~~~~~~~~~~~~~~~~~~~~~~
54 | ret baty[x] = dsu_get(baty[x]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 | }
| ~
56 |
|
57 |
|
58 | void dsu_unite(int a,int b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 | a = dsu_get(a);
| ~~~~~~~~~~~~~~~
60 | b = dsu_get(b);
| ~~~~~~~~~~~~~~~
61 | if (rand()&1)swap(a,b);
| ~~~~~~~~~~~~~~~~~~~~~~~
62 | if (a != b)baty[a]=b;
| ~~~~~~~~~~~~~~~~~~~~~
63 | baty_max[a] = max(baty_max[a],baty_max[b]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | }
| ~
65 |
|
66 | int dsu_max(int x){
| ~~~~~~~~~~~~~~~~~~~
67 | x = dsu_get(x);
| ~~~~~~~~~~~~~~~
68 | ret baty_max[x];
| ~~~~~~~~~~~~~~~~
69 | }
| ~
70 |
|
71 |
|
72 | main(){
| ~~~~~~~
73 | int i,k,ans,sum=0,cou=0;
| ~~~~~~~~~~~~~~~~~~~~~~~~
74 | scan2(n,k)
| ~~~~~~~
blocks.cpp:74:5: note: in expansion of macro 'scan2'
74 | scan2(n,k)
| ^~~~~
blocks.cpp:15:28: note: format string is defined here
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ~^
| |
| int*
| %lld
blocks.cpp:15:26: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ^~~~~~~ ~~~~
| |
| long long int*
16 | #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 | #define all(s) s.begin(),s.end()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 | #define allr(s) s.rbegin(),s.rend()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 | #define pb push_back
| ~~~~~~~~~~~~~~~~~~~~
20 | #define sz(v) (int)v.size()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | #define endi puts("");
| ~~~~~~~~~~~~~~~~~~~~~~
22 | #define eps 1e-12
| ~~~~~~~~~~~~~~~~~
23 | const int N = 2e6+12,INF=1e9+7;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 | int q[N],n,ansmx=0,der[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | vector <int>g[N];
| ~~~~~~~~~~~~~~~~~
26 | bool vis[N];
| ~~~~~~~~~~~~
27 | void update(int v,int l,int r,int x){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 | if (l == r){
| ~~~~~~~~~~~~
29 | der[v]=x;
| ~~~~~~~~~
30 | ret ;
| ~~~~~
31 | }
| ~
32 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
33 | if (m < x)
| ~~~~~~~~~~
34 | update((v<<1)+1,m+1,r,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
35 | else update(v<<1,l,m,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~
36 | der[v] = der[v<<1]+der[(v<<1)+1];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | }
| ~
38 |
|
39 |
|
40 | int get_ans(int v,int l,int r,int ql,int qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 | if (l > qr || r < ql)ret 0;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 | if (ql <= l && r <= qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~
43 | ret der[v];
| ~~~~~~~~~~~
44 | }
| ~
45 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
46 | ret get_ans(v<<1,l,m,ql,qr)+get_ans((v<<1)+1,m+1,r,ql,qr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 | }
| ~
48 |
|
49 |
|
50 |
|
51 | int baty[N],baty_max[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~
52 | int dsu_get(int x){
| ~~~~~~~~~~~~~~~~~~~
53 | if (baty[x] == x)ret x;
| ~~~~~~~~~~~~~~~~~~~~~~~
54 | ret baty[x] = dsu_get(baty[x]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 | }
| ~
56 |
|
57 |
|
58 | void dsu_unite(int a,int b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 | a = dsu_get(a);
| ~~~~~~~~~~~~~~~
60 | b = dsu_get(b);
| ~~~~~~~~~~~~~~~
61 | if (rand()&1)swap(a,b);
| ~~~~~~~~~~~~~~~~~~~~~~~
62 | if (a != b)baty[a]=b;
| ~~~~~~~~~~~~~~~~~~~~~
63 | baty_max[a] = max(baty_max[a],baty_max[b]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | }
| ~
65 |
|
66 | int dsu_max(int x){
| ~~~~~~~~~~~~~~~~~~~
67 | x = dsu_get(x);
| ~~~~~~~~~~~~~~~
68 | ret baty_max[x];
| ~~~~~~~~~~~~~~~~
69 | }
| ~
70 |
|
71 |
|
72 | main(){
| ~~~~~~~
73 | int i,k,ans,sum=0,cou=0;
| ~~~~~~~~~~~~~~~~~~~~~~~~
74 | scan2(n,k)
| ~~~~~~~~~
blocks.cpp:74:5: note: in expansion of macro 'scan2'
74 | scan2(n,k)
| ^~~~~
blocks.cpp:15:31: note: format string is defined here
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ~^
| |
| int*
| %lld
blocks.cpp:14:24: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
14 | #define scan1(a) scanf("%d",&a);
| ^~~~ ~~~~
| |
| long long int*
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 | #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 | #define all(s) s.begin(),s.end()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 | #define allr(s) s.rbegin(),s.rend()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 | #define pb push_back
| ~~~~~~~~~~~~~~~~~~~~
20 | #define sz(v) (int)v.size()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | #define endi puts("");
| ~~~~~~~~~~~~~~~~~~~~~~
22 | #define eps 1e-12
| ~~~~~~~~~~~~~~~~~
23 | const int N = 2e6+12,INF=1e9+7;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 | int q[N],n,ansmx=0,der[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | vector <int>g[N];
| ~~~~~~~~~~~~~~~~~
26 | bool vis[N];
| ~~~~~~~~~~~~
27 | void update(int v,int l,int r,int x){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 | if (l == r){
| ~~~~~~~~~~~~
29 | der[v]=x;
| ~~~~~~~~~
30 | ret ;
| ~~~~~
31 | }
| ~
32 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
33 | if (m < x)
| ~~~~~~~~~~
34 | update((v<<1)+1,m+1,r,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
35 | else update(v<<1,l,m,x);
| ~~~~~~~~~~~~~~~~~~~~~~~~
36 | der[v] = der[v<<1]+der[(v<<1)+1];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | }
| ~
38 |
|
39 |
|
40 | int get_ans(int v,int l,int r,int ql,int qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 | if (l > qr || r < ql)ret 0;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 | if (ql <= l && r <= qr){
| ~~~~~~~~~~~~~~~~~~~~~~~~
43 | ret der[v];
| ~~~~~~~~~~~
44 | }
| ~
45 | int m = l+r>>1;
| ~~~~~~~~~~~~~~~
46 | ret get_ans(v<<1,l,m,ql,qr)+get_ans((v<<1)+1,m+1,r,ql,qr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 | }
| ~
48 |
|
49 |
|
50 |
|
51 | int baty[N],baty_max[N];
| ~~~~~~~~~~~~~~~~~~~~~~~~
52 | int dsu_get(int x){
| ~~~~~~~~~~~~~~~~~~~
53 | if (baty[x] == x)ret x;
| ~~~~~~~~~~~~~~~~~~~~~~~
54 | ret baty[x] = dsu_get(baty[x]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 | }
| ~
56 |
|
57 |
|
58 | void dsu_unite(int a,int b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 | a = dsu_get(a);
| ~~~~~~~~~~~~~~~
60 | b = dsu_get(b);
| ~~~~~~~~~~~~~~~
61 | if (rand()&1)swap(a,b);
| ~~~~~~~~~~~~~~~~~~~~~~~
62 | if (a != b)baty[a]=b;
| ~~~~~~~~~~~~~~~~~~~~~
63 | baty_max[a] = max(baty_max[a],baty_max[b]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | }
| ~
65 |
|
66 | int dsu_max(int x){
| ~~~~~~~~~~~~~~~~~~~
67 | x = dsu_get(x);
| ~~~~~~~~~~~~~~~
68 | ret baty_max[x];
| ~~~~~~~~~~~~~~~~
69 | }
| ~
70 |
|
71 |
|
72 | main(){
| ~~~~~~~
73 | int i,k,ans,sum=0,cou=0;
| ~~~~~~~~~~~~~~~~~~~~~~~~
74 | scan2(n,k)
| ~~~~~~~~~~
75 | ans=n;
| ~~~~~~
76 | vector <pii> v;
| ~~~~~~~~~~~~~~~
77 | for (i=1;i<=n;++i){
| ~~~~~~~~~~~~~~~~~~~
78 | baty[i]=i;
| ~~~~~~~~~~
79 | scan1(q[i])
| ~~~~~~~~~~
blocks.cpp:79:9: note: in expansion of macro 'scan1'
79 | scan1(q[i])
| ^~~~~
blocks.cpp:14:26: note: format string is defined here
14 | #define scan1(a) scanf("%d",&a);
| ~^
| |
| int*
| %lld
blocks.cpp:73:13: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
73 | int i,k,ans,sum=0,cou=0;
| ^~~
blocks.cpp:73:23: warning: unused variable 'cou' [-Wunused-variable]
73 | int i,k,ans,sum=0,cou=0;
| ^~~
blocks.cpp:15:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
15 | #define scan2(a,b) scanf("%d %d",&a, &b);
| ~~~~~^~~~~~~~~~~~~~~~
blocks.cpp:74:5: note: in expansion of macro 'scan2'
74 | scan2(n,k)
| ^~~~~
blocks.cpp:14:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
14 | #define scan1(a) scanf("%d",&a);
| ~~~~~^~~~~~~~~
blocks.cpp:79:9: note: in expansion of macro 'scan1'
79 | scan1(q[i])
| ^~~~~