結果
| 問題 | No.3723 Climb or Detour |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2026-09-19 14:13:45 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 992 bytes |
| 記録 | |
| コンパイル時間 | 449 ms |
| コンパイル使用メモリ | 93,448 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-09-19 14:14:07 |
| 合計ジャッジ時間 | 5,030 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 WA * 10 |
ソースコード
// 対称性をなんとかする, 対角線ごとに考える
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
int main() {
int n, K;
int sy, sx, ty, tx;
cin >> n >> K;
cin >> sy >> sx >> ty >> tx;
sy--; sx--; ty--; tx--;
bool flip = false;
if (sy > ty) {
swap(sx, tx);
swap(sy, ty);
}
if (sx > tx) {
flip = true;
swap(sx, tx);
}
int d = (ty - sy) + (tx - sx);
int L = K - d;
if (L < 0 || L > d || L % 2 != 0) { cout << -1 << endl; return 0; }
int i, j;
vector<vector<bool>> black(n, vector<bool>(n));
rep(i, n) {
rep(j, n) {
int p = (i + j) - (sx + sy);
if ((sx + sy) % 2 == (i + j) % 2 || (i + j) == (tx + ty)) {
black[i][j] = false;
}
else if (0 <= p && p < L && p % 2 == 1) {
black[i][j] = true;
}
else {
black[i][j] = false;
}
}
}
rep(i, n) {
rep(j, n) {
if (black[i][j]) cout << "#";
else cout << ".";
}
cout << endl;
}
return 0;
}
startcpp