結果

問題 No.942 プレゼント配り
ユーザー KKT89
提出日時 2019-12-05 00:14:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 80,080 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 16:27:02
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n,k; cin >> n >> k;
	if(n/k%k){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
		int now=1;
		vector<int> ans[k];
		for(int i=0;i<k;i++){
			for(int j=0;j<n/k;j++){
				ans[(i+j)%k].push_back(now);
				now++;
			}
		}
		for(int i=0;i<k;i++){
			cout << ans[i][0];
			for(int j=1;j<n/k;j++){
				cout << " " << ans[i][j];
			}
			cout << endl;
		}
	}
}
0