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