結果

問題 No.1519 Diversity
ユーザー Mister
提出日時 2021-05-28 21:37:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 73,184 KB
最終ジャッジ日時 2025-01-21 19:54:00
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n;
    cin >> n;

    vector<pair<int, int>> es;
    int l = 1, r = n;
    while (l < r) {
        for (int i = l; i < r; ++i) es.emplace_back(i, r);
        ++l, --r;
    }

    cout << es.size() << "\n";
    for (auto [u, v] : es) cout << u << " " << v << "\n";
}

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

    solve();

    return 0;
}
0