結果

問題 No.2441 行列累乗
ユーザー arafathq9arafathq9
提出日時 2023-08-25 21:35:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 9,122 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 209,328 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 21:35:31
合計ジャッジ時間 3,006 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

                                    /*
                                     █████  ██████   █████  ███████  █████  ████████ ██   ██ 
                                    ██   ██ ██   ██ ██   ██ ██      ██   ██    ██    ██   ██ 
                                    ███████ ██████  ███████ █████   ███████    ██    ███████ 
                                    ██   ██ ██   ██ ██   ██ ██      ██   ██    ██    ██   ██ 
                                    ██   ██ ██   ██ ██   ██ ██      ██   ██    ██    ██   ██⠀⠀⠀⠀⠀⠀⠀⠀⠀         
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣶⣶⣶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀
                                    ⠀⣀⠀⠀⠀⢀⣠⣤⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⢸⠿⣿⣿⣿⣿⣿⠟⢿⢀⣠⣴⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣶⣀⠀
                                    ⢀⣘⣷⢻⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣷⣶⣾⠀⠈⢻⣿⡿⠁⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠹⢿⣿⣧⣟⠛⠀
                                    ⠈⠿⠿⣿⡿⠻⠟⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⣀⣿⣦⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⢠⡿⠉⠛⣷⡀
                                    ⠀⠀⠀⣽⡇⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠘⠃⠀⠀⠈⠁
                                    ⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⢻⠿⠿⠟⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡿⡿⢿⣿⣿⠀⠀⣿⣿⣿⣿⣷⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢾⣿⣶⣿⢿⡄⢠⣿⣿⣾⣿⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⢀⣴⣶⣶⣶⣶⣤⣤⣤⣄⣀⠀⠀⢻⣿⣿⣿⠃⠘⣿⣿⣿⣿⣿⠀⠀⣀⣤⣤⣶⣶⣶⣶⣾⣿⣦⡀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣼⣿⣿⣿⠀⠀⢸⣿⣿⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⢿⣿⣿⣿⣿⣿⠿⠿⠛⠛⠿⣿⣿⣿⣿⣿⠿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣿⣿⣆⠀⠀⠀⣰⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣦⠀⣴⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⡉⢉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
                                    */
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);
#define FAST_INPUT cin.tie(0);
#define FAST_OUTPUT cout.tie(0);
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define vpll vector<pair<long long,long long>>
#define pll pair<ll,ll>
#define gcd __gcd
#define S string 
#define inf 1e18
#define minf INT_MIN
#define lmax LLONG_MAX
#define  pb push_back
#define ff first
#define ss second
#define f(i,a,n) for(long long int i=a;i<n;i++)
#define g(i,a,n) for(long long int i=a;i>=n;i--)
#define w(t)  int t; cin>>t; f(case_num,1,t+1)
#define odd(n) (n&1)
#define even(n) !(n&1)
#define endl "\n"
#define all(x) x.begin(),x.end()
#define yes()  cout<<"YES"<<endl 
#define no()   cout<<"NO"<<endl
#define no1() cout<<-1<<" "
#define ans(case_num,ans)cout<< "Case #" << case_num << ": " << ans << endl;
const int N=1e5+5;
#define Mod 1934917635
#define mod 998244353
//calculating factorial of a number
ll factorial(ll n)
{
    ll answer=1;
    while(n--)
    {
        answer*=n+1;
        answer%=Mod;
    }
    return answer;
}
//power of two numbers using binary exponentiation
ll power(ll a,ll b)
{
    if(b==0)
    return 1;
    ll res=power(a,b/2);
    if(odd(b))
    {
         return (a*res*res);
    }
    else 
    {
        return (res*res);
    }
}
//Modulo inverse of a number
ll modulo_inverse(ll n)
{
    return power(n,Mod-2);
}
//combinatorics formula
ll ncr(ll n,ll r)
{
     if (r==0 || n==0)
     {
         return 1;
     }
    ll fac[n+1];
    fac[0]=1;
    f(i,1,n+1)
    {
        fac[i]=(fac[i-1]*i)%Mod;
    }
    
    return (fac[n]*modulo_inverse(fac[r])%Mod*modulo_inverse(fac[n-r])%Mod)%Mod;
}
//number of digits in a number
ll digits(ll n)
{
    ll ct=0;
    while(n)
    {
        ct++;
        n/=10;
    }
    return ct;
}
//number of digits in binary form
ll b_digits(ll n)
{
    if(!n)
    {
        return 1;
    }
    ll ct=0;
    while(n)
    {
        ct++;
        n/=2;
    }
    return ct;
}
//primes using seive upto 1e5
vector<ll> seive()
{
   vector<bool>isprime(N,true);
    isprime[0]=isprime[1]=false;
    f(i,2,N+1)
    {
        if(isprime[i])
      {
            for(ll j=2*i;j<=N;j+=i)
         {
             isprime[j]=0;
         }
      }  
    }
    vector<ll> prime;
    f(i,2,N+1)
    {
        if(isprime[i])
        {
            prime.pb(i);
        }
    }
    return prime;
}
//bit array for the fenwick tree
ll bit[N]={0};
//fenwick tree update
void fenwick(ll ind,ll x,ll n)
{
    for(;ind<=n;ind+=(ind&(-ind)))
    {
         bit[ind]+=x;
    }
}
//fenwick tree retrieval
ll fenwick_sum(ll ind1)
{
    ll i=ind1;
    ll ans=0;
    while(i)
    {
       ans+=bit[i];
       i-=(i&(-i));
    }
    return ans;
}
  ll segment_tree[N]={0};
void build(ll ind,ll start,ll end,vll &v)
{
    if(start==end)
    {
        segment_tree[ind]=v[end-1];
        return;
    }
    ll mid=(start+end)/2;
     build(2*ind,start,mid,v);
     build(2*ind+1,mid+1,end,v);
     segment_tree[ind]=min(segment_tree[2*ind],segment_tree[2*ind+1]);
}
ll an(ll ind,ll a,ll b,ll x,ll y)
{
    if(x<a&&y<a||x>b&&y>b)
    {
        return inf;
    }
    if(a>=x&&b<=y)
    {
        return segment_tree[ind];
    }
    ll mid=(a+b)/2;
    ll p=an(2*ind,a,mid,x,y);
    ll q=an(2*ind+1,mid+1,b,x,y);
    return min(p,q);
}
void update(ll ind,ll start,ll end,ll x,ll u)
{
    if(x<start&&x<end||x>start&&x>end)
    {
        return;
    }
    if(x==start&&x==end)
    {
         segment_tree[ind]=u;
         return;
    }
    if(start==end)
    {
         return;
    }
     ll mid=(start+end)/2;
     update(2*ind,start,mid,x,u);
     update(2*ind+1,mid+1,end,x,u);
     segment_tree[ind]=min(segment_tree[2*ind],segment_tree[2*ind+1]);

}
//SIGMA N
ll sigma(ll n)
{
    return (n*(n+1))/2;
}
//SQUARE ROOT OF A NUMBER
ll sq(ll n)
{
    ll ans=0;
    ll i=0;
    ll j=sqrt(n)+4;
    while(i<=j)
    {
        ll mid=i+(j-i)/2;
        if(mid*mid>n)
        {
            j=mid-1;
        }
        else 
        {
            i=mid+1;
            ans=mid;
        }
    }
    return ans;
}
//SUM OF DIGITS
ll sum(ll n)
{
    ll ct=0;
    while(n)
    {
        ct+=(n%10);
        n/=10;
    }
    return ct;
}
void func(vector<vector<ll>>a,vector<vector<ll>>b)
{
   
}
int main()
{
	FAST;
	FAST_INPUT;
	FAST_OUTPUT;
  vector<vector<ll>>dp(2,vector<ll>(2,0));
  f(i,0,2)
  {
     f(j,0,2)
     {
         cin>>dp[i][j];
     }
  }
   ll a,b,c,d;
   a=dp[0][0],b=dp[0][1],c=dp[1][0],d=dp[1][1];
   ll p,q,r,s;
   p=a*a+b*c,q=a*b+b*d,r=a*c+d*c,s=b*c+d*d;
   ll t,u,v,w;
   t=a*p+q*c,u=b*p+q*d,v=a*r+s*c,w=b*r+s*d;
   cout<<t<<" "<<u<<endl;
   cout<<v<<" "<<w<<endl;
    

}
0