結果

問題 No.3224 2×2行列入門
ユーザー cologne
提出日時 2025-09-02 18:19:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 3,121 ms
コンパイル使用メモリ 275,524 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-02 18:19:42
合計ジャッジ時間 4,440 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct M
{
    int64_t A, B, C, D;
};

M operator*(const M &a, const M &b)
{
    return M{a.A * b.A + a.B * b.C, a.A * b.B + a.B * b.D, a.C * b.A + a.D * b.C,
             a.C * b.B + a.D * b.D};
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    M a, b;
    cin >> a.A >> a.B >> a.C >> a.D;
    cin >> b.A >> b.B >> b.C >> b.D;
    M c = a * b * a * b;
    cout << c.A << ' ' << c.B << endl;
    cout << c.C << ' ' << c.D << endl;
}
0