結果

問題 No.3722 Blended Taste
コンテスト
ユーザー Guran08
提出日時 2026-09-19 14:02:24
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 35 ms / 2,000 ms
+ 397µs
コード長 2,605 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,293 ms
コンパイル使用メモリ 380,844 KB
実行使用メモリ 9,972 KB
最終ジャッジ日時 2026-09-19 14:02:33
合計ジャッジ時間 8,943 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
template<typename T_>bool chmax(T_& a, const T_& b) { if (a < b) { a = b;return true; } else { return false; } }
template<typename T_>bool chmin(T_& a, const T_& b) { if (a > b) { a = b;return true; } else { return false; } }

#ifdef LOCAL
template<class T, class U> ostream& operator<<(ostream& o, const pair<T, U>& p) { return o << "(" << p.first << ", " << p.second << ")"; }
template<class... T> ostream& operator<<(ostream& o, const tuple<T...>& t) { o << "("; apply([&o](auto&&... a) { int c = 0; (((o << (c++ ? ", " : "") << a)), ...); }, t); return o << ")"; }
template<class V> auto operator<<(ostream& o, const V& v) -> std::enable_if_t<!std::is_same_v<V, std::string> && !std::is_same_v<V, std::string_view>, decltype(v.begin(), o)> { o << "{"; int c = 0; for (auto& x : v) o << (c++ ? ", " : "") << x; return o << "}"; }
#define dbg(...) cerr<<"["<<#__VA_ARGS__<<"]: ",([](auto&&... a){((cerr<<a<<' '),...);})(__VA_ARGS__),cerr<<'\n'
#else
#define dbg(...) void(0)
#endif

const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;

void solve() {
    int n, m, kk;cin >> n >> m >> kk;
    vector<int> a(m);
    int k = sqrt(m);
    if (k * k < m)k++;
    dbg(k);
    iota(a.begin(), a.end(), 1);
    vector ans(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        auto b = a;
        for (int j = 0; j < m; j++) {
            b[j] = a[(j + k) % m];
        }
        a = b;
        for (int j = 0; j < (n / m); j++) {
            for (int l = 0; l < m; l++) {
                ans[i][l + j * m] = a[l];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << ans[i][j] << ' ';
        }cout << "\n";
    }
    // bool ok = true;
    // for (int i = 0; i < n - kk + 1; i++) {
    //     for (int j = 0; j < n - kk + 1; j++) {
    //         set<int> st;
    //         for (int di = i; di < i + kk; di++) {
    //             for (int dj = j; dj < j + kk; dj++) {
    //                 st.emplace(ans[di][dj]);
    //             }
    //         }
    //         if ((int)st.size() != m)ok = false;
    //     }
    // }
    // cout << (ok ? "Yes" : "No") << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
0