結果
問題 | No.942 プレゼント配り |
ユーザー | kotatsugame |
提出日時 | 2019-12-09 01:40:21 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 904 bytes |
コンパイル時間 | 732 ms |
コンパイル使用メモリ | 72,420 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-31 01:20:07 |
合計ジャッジ時間 | 2,940 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 19 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | RE | - |
testcase_05 | AC | 19 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,376 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 17 ms
4,376 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
コンパイルメッセージ
main.cpp:5:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<vector> using namespace std; int N,K; main() { cin>>N>>K; int t=N/K; if(K==1) { cout<<"Yes"<<endl; for(int i=1;i<=N;i++)cout<<i<<" "; cout<<endl; } else 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; } return 1; } else if(t>3&&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 if(t==3) { return 1; } else cout<<"No"<<endl; }