結果

問題 No.1169 Row and Column and Diagonal
ユーザー w2w2w2w2
提出日時 2020-08-14 21:35:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,089 bytes
コンパイル時間 1,667 ms
コンパイル使用メモリ 167,860 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-31 21:36:40
合計ジャッジ時間 2,703 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    ll a = 0;
    vector<ll> B(N);
    REP(i,N/2+1){
        B[i*2] = i+1;
    }
    REP(i,N/2){
        B[i*2+1] = N/2+i+2;
    }
    REP(i,N){
        REP(l,N){
            cout << B[a] << (l == N-1 ? "":" ");
            a++;
            a %= N;
        }
        cout << "\n";
        a++;
    }
}
0