結果

問題 No.2339 Factorial Paths
ユーザー lgswdnlgswdn
提出日時 2023-06-04 16:46:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,629 bytes
コンパイル時間 2,323 ms
コンパイル使用メモリ 199,876 KB
実行使用メモリ 6,844 KB
最終ジャッジ日時 2023-08-28 08:16:55
合計ジャッジ時間 9,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,440 KB
testcase_14 AC 5 ms
4,752 KB
testcase_15 AC 8 ms
5,580 KB
testcase_16 AC 13 ms
6,108 KB
testcase_17 AC 17 ms
6,780 KB
testcase_18 AC 17 ms
6,696 KB
testcase_19 AC 17 ms
6,844 KB
testcase_20 AC 17 ms
6,700 KB
testcase_21 AC 17 ms
6,704 KB
testcase_22 AC 17 ms
6,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
  return x*w;
}

const int N=2009;
int n,m,k;
char s[N][N];

void work(int k,int &x,int &y) {
  if(k==1) {s[x][y]='.'; return;}
  rep(i,x,x+k/2) rep(j,y,y+(k+1)/2) s[i][j]='.';
  x+=k/2, y+=(k+1)/2;
  work(k/2,x,y);
  work((k+1)/2,x,y);
}

signed main() {
  k=read(); n=m=1;
  work(k,n,m);
  rep(i,1,n) rep(j,1,m) if(!s[i][j]) s[i][j]='#';
  printf("%d %d\n",n,m);
  rep(i,1,n) {
    rep(j,1,m) putchar(s[i][j]);
    puts("");
  }
  return 0;
}
0