#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pairll;
typedef pair<ll,ull>pairull;
typedef pair<ll,pairll>pair3l;
typedef long double ld;
typedef pair<ld,ll>pairld;
#define fr first
#define sc second
#define pb push_back
#define endl '\n'
#define N 100007
//#define MOD 998244353
#define INF 1000000000000000007
#define eps 0.0000000001
ll t,n,d[107][107],f[107][107],u[107][107],l[107][107];
int main(){
cin>>t;
//f[1][1]=1;
u[1][1]=1;
t--;
n=2;
for(int i=1;i<n;i++){
for(int j=1;j<i;j++){
f[j][i]=u[j][i]+l[j][i];
f[i][j]=u[i][j]+l[i][j];
f[j][i]=min(f[j][i],ll(INF));
f[i][j]=min(f[i][j],ll(INF));
if(t>=f[j][i]){
d[j][i]=1;
u[j+1][i]+=f[j][i];
l[j][i+1]+=f[j][i];
t-=f[j][i];
}else{
ll x=rand()%2;
if(x==0){
d[j][i]=2;
u[j+1][i]+=f[j][i];
}else{
d[j][i]=3;
l[j][i+1]+=f[j][i];
}
}
if(t>=f[i][j]){
d[i][j]=1;
u[i+1][j]+=f[i][j];
l[i][j+1]+=f[i][j];
t-=f[i][j];
}else{
ll x=rand()%2;
if(x==0){
d[i][j]=2;
u[i+1][j]+=f[i][j];
}else{
d[i][j]=3;
l[i][j+1]+=f[i][j];
}
}
}
f[i][i]=u[i][i]+l[i][i];
f[i][i]=min(f[i][i],ll(INF));
if(t>=f[i][i]){
d[i][i]=1;
u[i+1][i]+=f[i][i];
l[i][i+1]+=f[i][i];
t-=f[i][i];
}else{
u[i+1][i]+=u[i][i];
l[i][i+1]+=l[i][i];
}
if(t>0)n++;
}
//cout<<t<<endl;
cout<<n<<" "<<n<<endl;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(j==n && i!=n)cout<<"d";
else if(i==n && j!=n)cout<<"r";
else if(d[i][j]==1)cout<<"X";
else if(d[i][j]==2)cout<<"d";
else if(d[i][j]==3)cout<<"r";
else cout<<".";
}
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Correct! Your size: 3 |
2 |
Correct |
1 ms |
212 KB |
Correct! Your size: 3 |
3 |
Correct |
0 ms |
212 KB |
Correct! Your size: 4 |
4 |
Correct |
1 ms |
212 KB |
Correct! Your size: 3 |
5 |
Correct |
1 ms |
340 KB |
Correct! Your size: 4 |
6 |
Correct |
0 ms |
212 KB |
Correct! Your size: 4 |
7 |
Correct |
0 ms |
340 KB |
Correct! Your size: 5 |
8 |
Correct |
1 ms |
212 KB |
Correct! Your size: 4 |
9 |
Correct |
1 ms |
212 KB |
Correct! Your size: 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 58 |
2 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 63 |
3 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 66 |
4 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 59 |
5 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 57 |
6 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 61 |
7 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 62 |
8 |
Partially correct |
1 ms |
468 KB |
Partially Correct! Your size: 52 |