結果

問題 No.690 E869120 and Constructing Array 4
ユーザー startcpp
提出日時 2018-05-18 22:31:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 581 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 62,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 13:52:28
合計ジャッジ時間 1,636 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
#define int long long

int n = 32;
vector<int> et[32];

signed main() {
	int i, j;
	int k;
	
	cin >> k;
	
	for (i = 1; i < n; i++)
		for (j = i + 1; j < n; j++)
			et[i].push_back(j);
	
	for (i = 1; i < n - 1; i++) {
		int id = n - 2 - i;
		if ((k >> id) & 1) {
			et[0].push_back(i);
		}
	}
	
	int m = 0;
	for (i = 0; i < n; i++) { m += et[i].size(); }
	
	cout << n << " " << m << endl;
	for (i = 0; i < n; i++) {
		for (j = 0; j < et[i].size(); j++) {
			cout << i + 1 << " " << et[i][j] + 1 << endl;
		}
	}
	return 0;
}
0