Submission #1234780

#TimeUsernameProblemLanguageResultExecution timeMemory
1234780SolikhaCostinland (info1cup19_costinland)C++20
0 / 100
1 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;
  int n = 62;
  vector<vector<char>> v(n, vector<char> (n, '.'));
  vector<vector<int>> cnt(n, vector<int> (n));
  v[0][0] = 'X';
  cnt[0][1] = 1;
  cnt[1][0] = 1;
  for(int i = 0; i < n; i ++){
    for(int j = 0; j < n; j ++){
      if(i < n - 1 && j == n - 1) v[i][j] = 'd';
      if(i == n - 1 && j < n - 1) v[i][j] = 'r';
    }
  }

  int ans = 2;
  for(int i = 0; i < n - 1; i++){
    bool d = false;
    for(int j = 0; j < n - 1; j++){
      if(i == 0 && j == 0) continue;
      if(ans == k) v[i][j] = 'r';
      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{
          v[i][j] = 'r';
          d = true;
        }
      }
    }
  }

  cout << "49 49" << endl;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; 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...