Submission #19540289


Source Code Expand

Copy
// #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long

const ll p = 1e9 + 7, nax = 505;

int ans[nax][nax];

void solve(int l, int r, int lvl) {
	if (l == r) return;
	int mid = (r + l) / 2;
	for (int i = l; i <= mid; i++) {
		for (int j = mid + 1; j <= r; ++j) {
			ans[i][j] = lvl;
			ans[j][i] = lvl;
		}
	}
	solve(l, mid, lvl + 1);
	solve(mid + 1, r, lvl + 1);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	solve(1, n, 1);
	for (int i = 1; i < n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			cout << ans[i][j] << ' ';
		}
		cout << '\n';
	}
}

Submission Info

Submission Time
Task D - Classified
User Cervidae
Language C++ (GCC 9.2.1)
Score 600
Code Size 684 Byte
Status AC
Exec Time 18 ms
Memory 4516 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 5 ms 3560 KB
sub1_01.txt AC 3 ms 3552 KB
sub1_02.txt AC 3 ms 3460 KB
sub1_03.txt AC 2 ms 3464 KB
sub1_04.txt AC 3 ms 3528 KB
sub1_05.txt AC 2 ms 3528 KB
sub1_06.txt AC 2 ms 3572 KB
sub1_07.txt AC 3 ms 3524 KB
sub1_08.txt AC 3 ms 3556 KB
sub1_09.txt AC 2 ms 3592 KB
sub1_10.txt AC 18 ms 4516 KB
sub1_11.txt AC 10 ms 3984 KB
sub1_12.txt AC 6 ms 4056 KB
sub1_13.txt AC 4 ms 3588 KB
sub1_14.txt AC 2 ms 3540 KB
sub1_15.txt AC 2 ms 3736 KB
sub1_16.txt AC 2 ms 3636 KB
sub1_17.txt AC 2 ms 3708 KB
sub1_18.txt AC 6 ms 3700 KB
sub1_19.txt AC 2 ms 3648 KB
sub1_20.txt AC 3 ms 3644 KB
sub1_21.txt AC 2 ms 3648 KB
sub1_22.txt AC 5 ms 3756 KB
sub1_23.txt AC 3 ms 3820 KB
sub1_24.txt AC 4 ms 3728 KB
sub1_25.txt AC 4 ms 3712 KB
sub1_26.txt AC 9 ms 3904 KB
sub1_27.txt AC 11 ms 4304 KB
sub1_28.txt AC 8 ms 3920 KB
sub1_29.txt AC 14 ms 4324 KB
sub1_30.txt AC 4 ms 3540 KB
sub1_31.txt AC 6 ms 4088 KB
sub1_32.txt AC 7 ms 4084 KB