結果

問題 No.690 E869120 and Constructing Array 4
ユーザー merom686
提出日時 2018-05-18 23:28:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 732 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 76,328 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 14:00:57
合計ジャッジ時間 1,589 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int k;
    cin >> k;
      
    int n = 32, m = 0;

    vector<array<int, 2>> e(n * (n - 1) / 2);
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int l = n - 2 - j;
            if (i == 0 && (!((1 << l) & k) || j == n - 1)) continue;
            e[m++] = { i, j };
        }
    }

    cout << n << ' ' << m << endl;

    for (int i = 0; i < m; i++) {
        cout << e[i][0] + 1 << ' ' << e[i][1] + 1 << '\n';
    }

    return 0;
}
0