結果

問題 No.1519 Diversity
ユーザー horoyoisawahoroyoisawa
提出日時 2022-02-01 15:23:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 167,800 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 02:31:07
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 30 ms
4,376 KB
testcase_04 AC 60 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 83 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 11 ms
4,380 KB
testcase_09 AC 31 ms
4,380 KB
testcase_10 AC 55 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 77 ms
4,380 KB
testcase_13 AC 85 ms
4,380 KB
testcase_14 AC 87 ms
4,376 KB
testcase_15 AC 82 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int times = 1;
    int m = 0;
    vector<pair<int, int>> out;
    for(int i=1;i<=n;i++) {
        if(i + 1 > n - i + 1) break;
        for(int j=i+1;j<=n-i+1;j++) {
            out.emplace_back(make_pair(i, j));
            m++;
        }
    }

    cout << m << endl;

    for(int i=0;i<m;i++) cout << out[i].first << ' ' << out[i].second << endl;

    return 0;
}
0