結果

問題 No.1981 [Cherry 4th Tune N] アルゴリズムが破滅する例
ユーザー 🍮かんプリン
提出日時 2022-06-19 18:11:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 1,767 ms
コンパイル使用メモリ 166,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 21:21:49
合計ジャッジ時間 6,145 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.06.19 18:11:21
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    int n,k;cin >> n >> k;
    if ((n+1)/2>k) {
        puts("-1");
        return 0;
    }
    cout << k+(n-k)*2 << endl;
    for (int i = 0; i < k; i++) {
        cout << i+1 << " " << i+1 << endl;
    }
    for (int i = k; i < n; i++) {
        cout << i+1 << " " << i-k+1 << endl;
        cout << i-k+1 << " " << i+1 << endl;
    }
    return 0;
}
0