結果

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

ソースコード

diff #

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

int main(){

    int n,k;
    cin >> n >> k;

    if(n > 2*k){
        cout << -1 << endl;
    } else {

        cout << k+2*(n-k) << endl;
        for(int i=1;i<=k;i++){
            cout << i << " " << i << endl;
        }
        for(int i=k+1;i<=n;i++){
            cout << i-k << " " << i << endl;
            cout << i << " " << i-k << endl;
        }
    }

    return 0;
}
0