제출 #1315431

#제출 시각아이디문제언어결과실행 시간메모리
1315431ghammazhassanCostinland (info1cup19_costinland)C++20
61.10 / 100
0 ms332 KiB
// #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <unordered_map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> #include <deque> using namespace std; #define int long long #define endl "\n" #define fi first #define se second const int M=1e9+7; const int inf = 1e9; const int LOG=17; const int N=2e5+5; int n , m , c , w , k , t=1 , q=1 , x , y , z , l , r; void solve(){ cin >> n; if (n<=19){ cout << 5 << " " << 5 << endl; string s="....d"; vector<string>a(5,s); a[0][0]='X'; for (int i=0;i<4;i++){ a[4][i]='r'; if (!i)continue; a[2][i]='r'; } n-=2; if (n){ a[0][1]='X'; n--; } if (n){ a[0][2]='X'; n--; } if (n){ a[0][3]='X'; n--; } if (n){ a[1][3]='X'; n--; } if (n>=2){ a[1][2]='X'; n-=2; } if (n>=3){ a[1][1]='X'; n-=3; } if (n>=4){ a[1][0]='X'; n-=4; } if (n){ a[2][0]='X'; n--; } if (n){ a[3][0]='X'; n--; } if (n){ a[3][1]='X'; n--; } if (n){ a[3][2]='X'; n--; } if (n){ a[3][3]='X'; n--; } a[4][4]='.'; for (string i:a){ cout << i << endl; } } else{ string s; int f=125; cout << f << " " << f << endl; for (int i=0;i<f;i++){ s+='.'; } vector<string>a(f,s); a[0][0]='X'; int c=0; for (int i=1;i<f-1;i++){ a[i][i]='X'; if (n&(1ll<<c)){ a[i][i-1]='d'; n-=(1ll<<c); if (n){ a[i-1][i]='d'; } } else if(n==(1ll<<(c+1))){ break; } else if (n){ c++; a[i][i-1]='r'; a[i-1][i]='d'; } } for (int i=0;i<f-1;i++){ a[f-1][i]='r'; a[i][f-1]='d'; } for (string s:a){ cout << s << endl; } } } signed main() { // #ifndef ONLINE_JUDGE // freopen("input.txt","r" ,stdin); // freopen("output.txt","w",stdout); // #endif ios::sync_with_stdio(0);//DO NOT USE IN INTERACTIVE cin.tie(0), cout.tie(0);//DO NOT USE IN INTERACTIVE cout << fixed << setprecision(9); srand(time(0)); // int t=1; // cin >> t; for (int _=1;_<=t;_++){ solve(); q++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...