結果

問題 No.2663 Zero-Sum Submatrices
ユーザー GOTKAKO
提出日時 2024-03-08 21:05:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 2,578 ms
コンパイル使用メモリ 197,296 KB
最終ジャッジ日時 2025-02-20 01:52:45
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,M; cin >> N >> M;
    vector<int> H(1<<N),W(1<<M);
    for(int i=0; i<(1<<N); i++) H.at(i) = i;
    for(int i=0; i<(1<<M); i++) W.at(i) = i*(1<<N);
	N = 1<<N; M = 1<<M;
    vector<vector<int>> answer(N,vector<int>(M));
    for(int i=0; i<N; i++) for(int k=0; k<M; k++) answer.at(i).at(k) = H.at(i)+W.at(k);

    for(int i=0; i<N; i++){
        for(int k=0; k<M; k++){
            if(k) cout << " ";
            cout << answer.at(i).at(k);
        }
        cout << endl;
    }
}
0