結果
| 問題 |
No.690 E869120 and Constructing Array 4
|
| ユーザー |
|
| 提出日時 | 2018-05-18 23:21:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 778 bytes |
| コンパイル時間 | 1,620 ms |
| コンパイル使用メモリ | 170,452 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 14:00:03 |
| 合計ジャッジ時間 | 2,621 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
bool mat[32][32];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K;
cin >> K;
for (int i = 0; i < 31; i++) {
for (int j = i + 1; j < 31; j++) {
mat[i][j] = true;
}
}
for (int i = 0; i < 30; i++) {
if (K & (1 << i)) {
mat[i + 1][31] = true;
}
}
int n = 32;
vector<P> e;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (mat[i][j]) e.emplace_back(i + 1, j + 1);
}
}
int m = e.size();
cout << n << " " << m << endl;
for (auto& p : e) {
cout << p.first << " " << p.second << endl;
}
return 0;
}