結果
問題 | No.1981 [Cherry 4th Tune N] アルゴリズムが破滅する例 |
ユーザー |
![]() |
提出日時 | 2022-06-18 00:38:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 352 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 1,980 ms |
コンパイル使用メモリ | 195,380 KB |
最終ジャッジ日時 | 2025-01-29 22:55:56 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 49 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,k; cin>>n>>k; int a=(n+1)/2; if(k<a){ cout<<-1<<endl; return 0; } vector<int> A,B; for(int i=1;i<=k;i++){ A.push_back(i),B.push_back(i); for(int j=i+1;j<=n;j++){ A.push_back(i),B.push_back(j); A.push_back(j),B.push_back(i); } } int b=B.size(); cout<<b<<endl; rep(i,b) cout<<A[i]<<" "<<B[i]<<endl; return 0; }