結果

問題 No.1619 Coccinellidae
ユーザー 夜
提出日時 2021-07-23 19:09:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 938 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 91,388 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 18:05:57
合計ジャッジ時間 3,653 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 102 ms
4,376 KB
testcase_02 AC 134 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 131 ms
4,376 KB
testcase_05 AC 78 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 79 ms
4,380 KB
testcase_08 AC 75 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 66 ms
4,376 KB
testcase_11 AC 91 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 123 ms
4,380 KB
testcase_14 AC 131 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[100010];
int main() {
	long long n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i < n; i++) {
		a[i] = i;
	}
	for (int i = n - 2; i >= 0; i--) {
		if (k > n - i - 1) {
			k -= n - i - 1;
		}
		else {
			a[i + k] = i;
			bool bo = false;
			for (int j = i - 1; j >= 0; j--) {
				if (a[i - j - 1] != i - j - 1) {
					bo = true;
				}
				a[i - j - 1 + bo] = i - j - 1;
			}
			for (int j = i + 1; j < n; j++) {
				if (a[n - j + i] != n - j + i) {
					bo = true;
				}
				a[n - j + i - bo] = j;
			}
			break;
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] == n - 1) {
			a[i] += m - n * (n - 1) / 2;
		}
		cout << a[i] << endl;
	}
}
0