結果
| 問題 | No.3747 Hamming Distance on Torus |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-25 21:58:42 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,583 bytes |
| 記録 | |
| コンパイル時間 | 1,259 ms |
| コンパイル使用メモリ | 219,528 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-09-25 21:58:48 |
| 合計ジャッジ時間 | 3,864 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 46 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define P pair<ll, ll>
#define ALL(n) (n).begin(), (n).end()
#define INF (1ll << 60)
#define chmax(a, b) a = max(a, b)
void solve(ll n, ll a, ll b)
{
vector<vector<ll>> ans(n, vector<ll>(n, 0));
if (a == 0 and b == 0)
{
;
}
else if (a == n and b == 0)
{
REP(i, n)
{
REP(j, n)
{
if (j % 2 == 0)
ans[i][j] = 1;
}
}
}
else if (a == 0 and b == n)
{
REP(i, n)
{
REP(j, n)
{
if (i % 2 == 0)
ans[i][j] = 1;
}
}
}
else if (a == b)
{
REP(i, min(a, n / 2))
{
ll x = 0, y = i * 2;
REP(j, n / 2)
{
ans[x][y] = 1;
x = (x + 2) % n;
y = (y + 2) % n;
}
}
a -= n / 2;
REP(i, min(a, n / 2))
{
ll x = 1, y = 1 + i * 2;
REP(j, n / 2)
{
ans[x][y] = 1;
x = (x + 2) % n;
y = (y + 2) % n;
}
}
}
else
{
cout << -1 << endl;
return;
}
REP(i, n)
{
REP(j, n)
cout << ans[i][j];
cout << endl;
}
}
int main()
{
ll T;
cin >> T;
REP(i, T)
{
ll n, a, b;
cin >> n >> a >> b;
solve(n, b, a);
}
}