結果
| 問題 |
No.2339 Factorial Paths
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-27 01:50:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 810 bytes |
| コンパイル時間 | 1,989 ms |
| コンパイル使用メモリ | 199,948 KB |
| 最終ジャッジ日時 | 2025-02-15 02:31:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main () {
int N;
cin >> N;
if (N == 1) {
puts("1 1\n.");
return 0;
}
char ans[2020][2020];
for (auto& a: ans) {
for (auto& b : a) {
b = '#';
}
}
std::vector<int> H, W;
queue<int> que;
que.push(N);
while (!que.empty()) {
int n = que.front();
que.pop();
if (n <= 1) continue;
int h = n / 2, w = (n + 1) / 2;
H.push_back(h);
W.push_back(w);
que.push(h);
que.push(w);
}
int hp = 0, wp = 0;
for (int p = 0; p < H.size(); p ++) {
for (int i = 0; i <= H[p]; i ++) {
for (int j = 0; j <= W[p]; j ++) {
ans[hp + i][wp + j] = '.';
}
}
hp += H[p]; wp += W[p];
}
printf("%d %d\n", hp + 1, wp + 1);
for (int i = 0; i <= hp; i ++) {
for (int j = 0; j <= wp; j ++) {
cout << ans[i][j];
}
cout << endl;
}
}