結果
| 問題 | 
                            No.1587 012 Matrix
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Haa
                         | 
                    
| 提出日時 | 2021-07-08 23:17:24 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 18 ms / 1,000 ms | 
| コード長 | 1,164 bytes | 
| コンパイル時間 | 1,822 ms | 
| コンパイル使用メモリ | 175,836 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-01 13:12:33 | 
| 合計ジャッジ時間 | 3,059 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 22 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;
int main(){
    int n; cin >> n;
    VVI ans(n,VI(n,0));
    REP(i,n/2)REP(j,n/2){
        if(i==j){
            ans[i*2][j*2+1]=1;
            ans[i*2+1][j*2]=2;
            ans[i*2+1][j*2+1]=2;
        }
        else if(i<j){
            ans[i*2+1][j*2]=2;
            ans[i*2+1][j*2+1]=2;
        }
        else{
            ans[i*2][j*2+1]=2;
            ans[i*2+1][j*2+1]=2;
        }
    }
    set<int> s;
    VI x(n,0), y(n,0);
    REP(i,n){
        ll sum=0;
        REP(j,n){
            cout << ans[i][j];
            x[i]+=ans[i][j];
            y[j]+=ans[i][j];
        }
        cout << endl;
    }
    REP(i,n){
        s.insert(x[i]);
        s.insert(y[i]);
    }
    //cout << s.size() << endl;
    return 0;
}
            
            
            
        
            
Haa