Submission #7125024


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N;
int ans[500][500];
//---------------------------------------------------------------------------------------------------
void dfs(int l, int r, int level) {
    if(l + 1 == r) return;
    int c = (l + r) / 2;

    rep(x, l, c) rep(y, c, r) ans[x][y] = ans[y][x] = level;

    dfs(l, c, level + 1);
    dfs(c, r, level + 1);
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    dfs(0, N, 1);

    rep(i, 0, N) {
        rep(j, i + 1, N) {
            if(j != i + 1) printf(" ");
            printf("%d", ans[i][j]);
        }
        printf("\n");
    }
}





Submission Info

Submission Time
Task D - Classified
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1893 Byte
Status AC
Exec Time 12 ms
Memory 1536 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 600 / 600
Status
AC × 1
AC × 33
Set Name Test Cases
Sample sample_01.txt
Subtask1 sample_01.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt, sub1_30.txt, sub1_31.txt, sub1_32.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sub1_01.txt AC 1 ms 256 KB
sub1_02.txt AC 1 ms 256 KB
sub1_03.txt AC 1 ms 256 KB
sub1_04.txt AC 1 ms 256 KB
sub1_05.txt AC 1 ms 256 KB
sub1_06.txt AC 1 ms 256 KB
sub1_07.txt AC 1 ms 256 KB
sub1_08.txt AC 1 ms 256 KB
sub1_09.txt AC 1 ms 256 KB
sub1_10.txt AC 12 ms 1536 KB
sub1_11.txt AC 4 ms 768 KB
sub1_12.txt AC 4 ms 768 KB
sub1_13.txt AC 1 ms 384 KB
sub1_14.txt AC 1 ms 384 KB
sub1_15.txt AC 1 ms 384 KB
sub1_16.txt AC 1 ms 384 KB
sub1_17.txt AC 1 ms 384 KB
sub1_18.txt AC 1 ms 384 KB
sub1_19.txt AC 1 ms 384 KB
sub1_20.txt AC 1 ms 384 KB
sub1_21.txt AC 1 ms 384 KB
sub1_22.txt AC 2 ms 512 KB
sub1_23.txt AC 2 ms 512 KB
sub1_24.txt AC 2 ms 512 KB
sub1_25.txt AC 2 ms 512 KB
sub1_26.txt AC 3 ms 640 KB
sub1_27.txt AC 8 ms 1152 KB
sub1_28.txt AC 3 ms 640 KB
sub1_29.txt AC 9 ms 1280 KB
sub1_30.txt AC 1 ms 256 KB
sub1_31.txt AC 4 ms 768 KB
sub1_32.txt AC 4 ms 896 KB