結果
問題 |
No.942 プレゼント配り
|
ユーザー |
|
提出日時 | 2019-12-09 01:28:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 793 ms |
コンパイル使用メモリ | 69,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 02:24:55 |
合計ジャッジ時間 | 3,140 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 5 |
コンパイルメッセージ
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+1;j<t;j++) { cout<<" "<<(j*K+K-i); } cout<<endl; } } else cout<<"No"<<endl; }