結果
| 問題 |
No.942 プレゼント配り
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-09 01:36:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 892 bytes |
| コンパイル時間 | 736 ms |
| コンパイル使用メモリ | 69,376 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 02:52:05 |
| 合計ジャッジ時間 | 2,962 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 1 |
| other | AC * 15 WA * 3 |
コンパイルメッセージ
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(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;
}
}
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;
}