foo.cc: In function 'int main()':
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~
foo.cc:63:5: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~
foo.cc:63:15: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:63:25: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:63:35: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:63:46: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:4:25: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'll*' {aka 'long long int*'} [-Wformat=]
4 | #define GetI64(x) scanf("%I64d",&x)
| ^~~~~~~ ~~~
| |
| ll* {aka long long int*}
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:63:56: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:30: note: format string is defined here
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~^
| |
| int*
| %I64lld
foo.cc:5:33: warning: format '%d' expects argument of type 'int', but argument 2 has type 'll' {aka 'long long int'} [-Wformat=]
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ^~~~~~~~~~~~~~
6 |
|
7 | ll mod;
| ~~~~~~~
8 |
|
9 | ll mul(ll a,ll b){
| ~~~~~~~~~~~~~~~~~~
10 | ll ans=0;
| ~~~~~~~~~
11 | while(b){
| ~~~~~~~~~
12 | if(b&1)ans=(ans+a)%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~
13 | a=(a+a)%mod;
| ~~~~~~~~~~~~
14 | b>>=1;
| ~~~~~~
15 | }
| ~
16 | return ans;
| ~~~~~~~~~~~
17 | }
| ~
18 |
|
19 |
|
20 |
|
21 | struct mat{
| ~~~~~~~~~~~
22 | int m,n;
| ~~~~~~~~
23 | ll a[3][3];
| ~~~~~~~~~~~
24 | mat(int M=0,int N=0){m=M;n=N;}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 | void clear(){
| ~~~~~~~~~~~~~
26 | for(int i=1;i<=m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~
27 | for(int j=1;j<=n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~
28 | a[i][j]=0;
| ~~~~~~~~~~
29 | }
| ~
30 | }
| ~
31 | }
| ~
32 | ll*operator[](int d){return a[d];}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 | };
| ~~
34 |
|
35 | mat operator*(mat a,mat b){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | mat c(a.m,b.n);
| ~~~~~~~~~~~~~~~
37 | //a.n==b.m
| ~~~~~~~~~~
38 | c.clear();
| ~~~~~~~~~~
39 | for(int k=1;k<=a.n;++k){
| ~~~~~~~~~~~~~~~~~~~~~~~~
40 | for(int i=1;i<=a.m;++i){
| ~~~~~~~~~~~~~~~~~~~~~~~~
41 | for(int j=1;j<=b.n;++j){
| ~~~~~~~~~~~~~~~~~~~~~~~~
42 | c[i][j]+=mul(a[i][k],b[k][j]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | c[i][j]%=mod;
| ~~~~~~~~~~~~~
44 | if(c[i][j]<0)c[i][j]+=mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
45 | }
| ~
46 | }
| ~
47 | }
| ~
48 | return c;
| ~~~~~~~~~
49 | }
| ~
50 |
|
51 | mat operator^(mat x,ll p){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | if(p==1)return x;
| ~~~~~~~~~~~~~~~~~
53 | if(p==2)return x*x;
| ~~~~~~~~~~~~~~~~~~~
54 | mat t=x^(p/2);
| ~~~~~~~~~~~~~~
55 | t=t*t;
| ~~~~~~
56 | if(p&1)t=t*x;
| ~~~~~~~~~~~~~
57 | return t;
| ~~~~~~~~~
58 | }
| ~
59 |
|
60 |
|
61 | int main(){
| ~~~~~~~~~~~
62 | ll m,a,c,x0,n,g;
| ~~~~~~~~~~~~~~~~
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | mod=m;
| ~~~~~~
65 | mat b(1,2);
| ~~~~~~~~~~~
66 | b[1][1]=x0;
| ~~~~~~~~~~~
67 | b[1][2]=c;
| ~~~~~~~~~~
68 | mat f(2,2);
| ~~~~~~~~~~~
69 | f[1][1]=a;
| ~~~~~~~~~~
70 | f[1][2]=0;
| ~~~~~~~~~~
71 | f[2][1]=1;
| ~~~~~~~~~~
72 | f[2][2]=1;
| ~~~~~~~~~~
73 | mat ans=b*(f^n);
| ~~~~~~~~~~~~~~~~
74 | ll x=ans[1][1]%g;
| ~~~~~~~~~~~~~~~~~
75 | if(x<0)x+=g;
| ~~~~~~~~~~~~
76 | PutI64(x,"\n");
| ~~~~~~~~~~~~~
| |
| ll {aka long long int}
foo.cc:76:5: note: in expansion of macro 'PutI64'
76 | PutI64(x,"\n");
| ^~~~~~
foo.cc:5:38: note: format string is defined here
5 | #define PutI64(x,arg...) printf("%I64d" arg,x)
| ~~~~^
| |
| int
| %I64lld
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:5: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:15: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:25: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:35: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:46: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~
foo.cc:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
4 | #define GetI64(x) scanf("%I64d",&x)
| ~~~~~^~~~~~~~~~~~
foo.cc:63:56: note: in expansion of macro 'GetI64'
63 | GetI64(m);GetI64(a);GetI64(c);GetI64(x0);GetI64(n);GetI64(g);
| ^~~~~~