結果
| 問題 | No.3723 Climb or Detour |
| コンテスト | |
| ユーザー |
てんぷら
|
| 提出日時 | 2026-09-19 13:33:47 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 9 ms / 2,000 ms |
| + 418µs | |
| コード長 | 1,695 bytes |
| 記録 | |
| コンパイル時間 | 2,126 ms |
| コンパイル使用メモリ | 331,856 KB |
| 実行使用メモリ | 8,492 KB |
| 最終ジャッジ日時 | 2026-09-19 13:33:54 |
| 合計ジャッジ時間 | 6,442 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef TEMPURA
#else
#define debug(...) ((void)0)
#define msg(...) ((void)0)
#endif
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;
template <class T>
inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
// #include <atcoder/modint>
// using mint = atcoder::modint998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int sr, sc, tr, tc;
cin >> sr >> sc >> tr >> tc;
--sr;
--sc;
--tr;
--tc;
int mi = abs(sr - tr) + abs(sc - tc);
int ma = mi % 2 == 0 ? 2 * mi : 2 * mi - 1;
if(k < mi || k > ma || (k - mi) % 2 != 0) {
cout << -1 << endl;
return 0;
}
rep(i, n) {
rep(j, n) {
if(i < min(sr, tr) || i > max(sr, tr) || j < min(sc, tc) || j > max(sc, tc)) {
if((i + j) % 2 == (sr + sc) % 2) {
cout << '.';
} else {
cout << '#';
}
} else {
int d = abs(i - sr) + abs(j - sc);
if(d % 2 == 0) {
cout << '.';
} else if(d < k - mi) {
cout << '#';
} else {
cout << '.';
}
}
}
cout << "\n";
}
return 0;
}
てんぷら