結果
| 問題 |
No.2339 Factorial Paths
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-02 22:41:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 786 bytes |
| コンパイル時間 | 1,219 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-12-28 20:42:06 |
| 合計ジャッジ時間 | 6,891 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<deque>
#include<cassert>
using namespace std;
vector<pair<int,int> >V;
int H,W;
void f(int N)
{
if(N==1)return;
if(N%2==0)
{
H+=N/2;
W+=N/2;
V.push_back(make_pair(N/2,N/2));
f(N/2);
f(N/2);
}
else
{
H+=(N+1)/2;
W+=(N-1)/2;
V.push_back(make_pair((N+1)/2,(N-1)/2));
f((N+1)/2);
f((N-1)/2);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
f(N);
cout<<H+1<<" "<<W+1<<"\n";
vector<string>S(H+1,string(W+1,'#'));
int x=0,y=0;
V.push_back(make_pair(0,0));
for(pair<int,int>hw:V)
{
for(int i=0;i<=hw.first;i++)for(int j=0;j<=hw.second;j++)
{
S[x+i][y+j]='.';
}
x+=hw.first;
y+=hw.second;
}
for(int i=0;i<=H;i++)cout<<S[i]<<"\n";
}