結果

問題 No.942 プレゼント配り
ユーザー kotatsugame
提出日時 2019-12-09 00:47:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 60,140 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 23:15:29
合計ジャッジ時間 2,873 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
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*t+i+1:j*t+t-i)<<" ";
			}
			cout<<endl;
		}
	}
	else if(t==K)
	{
		cout<<"Yes"<<endl;
		for(int i=0;i<K;i++)
		{
			for(int j=0;j<t;j++)
			{
				cout<<(j*t+1+(j+i)%t)<<" ";
			}
			cout<<endl;
		}
	}
	else cout<<"No"<<endl;
}
0