結果

問題 No.689 E869120 and Constructing Array 3
ユーザー 夜
提出日時 2021-03-04 19:59:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 1,000 ms
コード長 914 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 96,584 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 12:09:04
合計ジャッジ時間 2,731 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
6,816 KB
testcase_01 AC 20 ms
6,944 KB
testcase_02 AC 20 ms
6,944 KB
testcase_03 AC 20 ms
6,944 KB
testcase_04 AC 21 ms
6,944 KB
testcase_05 AC 20 ms
6,944 KB
testcase_06 AC 21 ms
6,944 KB
testcase_07 AC 20 ms
6,940 KB
testcase_08 AC 20 ms
6,944 KB
testcase_09 AC 20 ms
6,940 KB
testcase_10 AC 20 ms
6,944 KB
testcase_11 AC 20 ms
6,940 KB
testcase_12 AC 20 ms
6,944 KB
testcase_13 AC 21 ms
6,944 KB
testcase_14 AC 20 ms
6,940 KB
testcase_15 AC 21 ms
6,944 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;
tuple<int, int, int> t[10010];
int main() {
	for (int i = 0; i <= 250; i++) {
		for (int j = 0; j <= 250; j++) {
			for (int k = 0; k <= 250; k++) {
				if (i + j + k <= 250) {
					if (i * j + i * k + max(0, k * (k - 1) / 2) <= 10000) {
						t[i * j + i * k + max(0, k * (k - 1) / 2)] = make_tuple(i, j, k);
					}
				}
			}
		}
	}
	int k;
	cin >> k;
	cout << get<0>(t[k]) + get<1>(t[k]) + get<2>(t[k]) << endl;
	for (int i = 0; i < get<0>(t[k]); i++) {
		cout << 2 << " ";
	}
	for (int i = 0; i < get<1>(t[k]); i++) {
		cout << 3 << " ";
	}
	for (int i = 0; i < get<2>(t[k]); i++) {
		cout << 1 << " ";
	}
	cout << endl;
}
0