#include <bits/stdc++.h>
//#include "grader.h"
//#include "grader.cpp"
#define f first
#define s second
#define pb push_back
#define vec vector
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef pair<int,int> pii;
typedef long double ld;
auto rng=bind(uniform_int_distribution<int>(1,1e9),mt19937(time(0)));
typedef long long ll;
const ll inf=1e18+100;
//const int N=49;
int get(vec<string> s){
int n=sz(s),m=sz(s[0]);
vec<vec<vec<ll>>>dp(n,vec<vec<ll>>(m,vec<ll>(2,0)));
dp[0][0][0]=1;
// dp[0][0][0]=1;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i==0 && j==0) continue;
dp[i][j][0]=(i&&s[i-1][j]!='r'?dp[i-1][j][1]:0);
dp[i][j][1]=(j&&s[i][j-1]!='d'?dp[i][j-1][0]:0);
ll sm=dp[i][j][0]+dp[i][j][1];
if(s[i][j]=='X'){
ll sm=dp[i][j][0]+dp[i][j][1];
dp[i][j][0]=sm;
dp[i][j][1]=sm;
}
else if(s[i][j]=='d') dp[i][j][0]=sm;
else if(s[i][j]=='r') dp[i][j][1]=sm;
}
}
return dp[n-1][m-1][0];
}
signed main(){
///let me bruteforce
vec<string>s(5,string(5,'.'));
for(int i=0;i<5;i++){
s[4][i]='r';
}
for(int i=0;i<5;i++) s[i][4]='d';
s[4][4]='X';
// debug()<<imie(s);
ll k;
cin>>k;
cout<<5<<' '<<5<<endl;
for(int mask=0;mask<(1<<(4*4));mask++){
vec<string>me=s;
for(int i=0;i<4*4;i++){
if((1<<i)&mask){
me[i/4][i%4]='X';
}
}
ll how=get(me);
if(how==k){
for(int i=0;i<5;i++) cout<<me[i]<<endl;
return 0;
}
// debug()<<imie(how);
// for(int i=0;i<4;i++) debug()<<imie(me[i]);
// debug()<<imie(me)imie(how);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
The output does not fit the requirements |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
103 ms |
204 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |