結果

問題 No.3722 Blended Taste
コンテスト
ユーザー Nihonielse
提出日時 2026-09-19 14:05:50
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,051 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,443 ms
コンパイル使用メモリ 359,216 KB
実行使用メモリ 9,956 KB
最終ジャッジ日時 2026-09-19 14:06:08
合計ジャッジ時間 7,503 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#line 1 "codes/Libraries/Core.hpp"



#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define rep(i,n) for(int i=0; i<n; i++)
#define rrep(i,n,s) for (int i=s; i<n; i++)


#line 1 "codes/Libraries/Inout.hpp"



#line 5 "codes/Libraries/Inout.hpp"

inline void yn(const bool &tf) {
    if(tf)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

inline void YN(const bool &tf) {
    if(tf)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

inline void Yes() { cout << "Yes" << endl; }
inline void YES() { cout << "YES" << endl; }
inline void No() { cout << "No" << endl; }
inline void NO() { cout << "NO" << endl; }

template <typename T,typename S>
istream& operator>>(istream& is,pair<T,S>& pa){
    is >> pa.first >> pa.second;
    return is;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,pair<T,S>& pa){
    os << pa.first << " " << pa.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is,vector<T>& vec){
    for(T& item:vec){
        is >> item;
    }
    return is;
}

template <typename T>
ostream& operator<<(ostream& os,vector<T>& vec){
    for(int i=0;i<vec.size();i++){
        if(i) os << " ";
        os << vec[i];
    }
    return os;
}
template <typename T>
ostream& operator<<(ostream& os,vector<vector<T>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,vector<pair<T,S>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}


#line 3 "codes/B.cpp"

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	vector ans(n,vector<int>(n,-1));
	vector<int> count(n,n*n/m);
	rep(i,n){
		rep(j,n){
			if(i%k*k+j%k<m){
				ans[i][j]=i%k*k+j%k+1;
				count[i%k*k+j%k]--;
			}
		}
	}
	int now=0;
	rep(i,n){
		rep(j,n){
			while(now<n&&count[now]==0)now++;
			if(ans[i][j]==-1){
				ans[i][j]=now+1;
				count[now]--;
			}
		}
	}
	cout<<ans<<endl;
}
0