結果
| 問題 |
No.3334 I hate Image Convolution
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-11-08 10:46:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 127 ms / 3,000 ms |
| コード長 | 1,082 bytes |
| コンパイル時間 | 7,943 ms |
| コンパイル使用メモリ | 334,948 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-08 10:46:42 |
| 合計ジャッジ時間 | 28,619 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 56 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int main() {
FAST_IO
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
vector<int> C((N - 1) * (N - 1), 0);
for (auto& c : C) cin >> c;
ranges::sort(C);
vector A(N, vector(N, 0));
int p = 0;
for (int i = 1; i < N; i++) {
if (i % 2) {
for (int j = 1; j < N; j++) {
int s = A[i - 1][j] + A[i][j - 1] + A[i - 1][j - 1];
A[i][j] = C[p++] - s;
}
} else {
for (int j = N - 2; j >= 0; j--) {
int s = A[i - 1][j + 1] + A[i - 1][j] + A[i][j + 1];
A[i][j] = C[p++] - s;
}
}
}
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N; j ++) {
cout << A[i][j] << " ";
}
cout << "\n";
}
}
}
hiromi_ayase