Submission #1234744

#TimeUsernameProblemLanguageResultExecution timeMemory
1234744SolikhaCostinland (info1cup19_costinland)C++20
0 / 100
0 ms324 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ss second #define ff first #define pb push_back void solve(){ int k; cin >> k; vector<vector<char>> v(5, vector<char> (5, '.')); vector<vector<int>> cnt(5, vector<int> (5)); v[0][0] = 'X'; cnt[0][1] = 1; cnt[1][0] = 1; for(int i = 0; i < 5; i ++){ for(int j = 0; j < 5; j ++){ if(i < 4 && j == 4) v[i][j] = 'd'; if(i == 4 && j < 4) v[i][j] = 'r'; } } int ans = 2; for(int i = 0; i < 4; i++){ bool d = false; for(int j = 0; j < 4; j++){ if(i == 0 && j == 0) continue; if(ans == k) v[i][j] = '.'; else{ if(cnt[i][j] <= k - ans && !d){ v[i][j] = 'X'; ans += cnt[i][j]; cnt[i][j + 1] += cnt[i][j]; cnt[i + 1][j] += cnt[i][j]; }else{ d = true; } } } } for(int i = 0; i < 5; i++){ for(int j = 0; j < 5; j++) cout << v[i][j]; cout << endl; } } signed main() { cin.tie(nullptr)->sync_with_stdio(false); int t = 1; //cin >> t; while(t--){ solve(); cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...