結果
問題 |
No.942 プレゼント配り
|
ユーザー |
|
提出日時 | 2019-12-09 01:25:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 632 ms |
コンパイル使用メモリ | 69,852 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-03 02:19:41 |
合計ジャッジ時間 | 2,631 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 4 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<vector> using namespace std; int N,K; main() { cin>>N>>K; int t=N/K; if(t%2==0) { cout<<"Yes"<<endl; for(int i=0;i<K;i++) { for(int j=0;j<t;j++) { cout<<(j%2==0?j*K+i+1:j*K+K-i)<<" "; } cout<<endl; } } else if(t>2&&N%2==1) { cout<<"Yes"<<endl; vector<vector<int> >X(2,vector<int>(K)); for(int i=0;i<K;i++) { X[0][i]=i+1; X[1][i]=K+i+1; } for(int i=K/2-1;i>0;i--) { swap(X[0][K-i],X[0][K-i-1]); swap(X[1][i-1],X[1][i]); } swap(X[0][K-1],X[1][0]); for(int i=0;i<K;i++) { cout<<X[0][i]<<" "<<X[1][i]; for(int j=2;j<t/2;j++) { cout<<" "<<(j*K+1+i); } for(int j=t/2;j<t;j++) { cout<<" "<<(j*K+K-i); } cout<<endl; } } else cout<<"No"<<endl; }