제출 #1318507

#제출 시각아이디문제언어결과실행 시간메모리
1318507ghammazhassanCostinland (info1cup19_costinland)C++20
0 / 100
1 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 = 1e15; const int LOG=17; const int N=2e5+5; int n , m , c , w , k , t=1 , q=1 , x , y , z , l , r; int dp[120][120][2]; void solve(){ cin >> k; if (k<=19){ int f=5; string s; for (int i=0;i<f;i++)s+='.'; vector<string>a(f,s); for (int i=0;i<f-1;i++){ a[f-1][i]='r'; a[i][f-1]='d'; } for (int i=1;i<4;i++){ a[2][i]='r'; } a[0][0]='X'; k-=2; if (k>=1){ a[0][1]='X'; k--; } if (k>=1){ a[0][2]='X'; k--; } if (k>=1){ a[0][3]='X'; k--; } if (k>=1){ a[1][0]='X'; k--; } if (k>=2){ a[1][1]='X'; k-=2; } if (k>=3){ a[1][2]='X'; k-=3; } if (k>=4){ a[1][3]='X'; k-=4; } if (k>=1){ a[2][0]='X'; k--; } if (k>=1){ a[3][0]='X'; k--; } if (k>=1){ a[3][1]='X'; k--; } if (k>=1){ a[3][2]='X'; k--; } if (k>=1){ a[3][3]='X'; k--; } cout << f << " " << f << endl; for (string i:a){ cout << i << endl; } } else{ int f=62; string s; for (int i=0;i<f;i++)s+='.'; vector<string>a(f,s); for (int i=0;i<f-1;i++){ a[f-1][i]='r'; a[i][f-1]='d'; } a[0][0]='X'; for (int i=1;i<f-1;i++){ a[i][i]='X'; if (k>=(1ll<<(i+1))){ a[i-1][i]='d'; a[i][i-1]='r'; } else{ a[i][i]='.'; break; } } for (int i=0;i<f-1;i++){ if (k&(1ll<<i)){ a[i+1][i]='X'; } } cout << f << " " << f << endl; for (string i:a){ cout << i << 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++; } }

컴파일 시 표준 에러 (stderr) 메시지

costinland.cpp: In function 'int main()':
costinland.cpp:129:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  129 |     freopen("input.txt","r" ,stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
costinland.cpp:130:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  130 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...