답안 #738327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
738327 2023-05-08T13:18:22 Z sandry24 Costinland (info1cup19_costinland) C++17
63.589 / 100
1 ms 328 KB
#include <bits/stdc++.h>
//#include "grader.h"
using namespace std;
 
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

int get_log(ll k){
    int cnt = 0;
    while(k > 0){
        cnt++;
        k /= 2;
    }
    return cnt;
}

ll check(vector<vector<char>> &grid, int n, int m){
    ll r[1000][1000], d[1000][1000];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            r[i][j] = d[i][j] = 0;
        }
    }
    r[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(i == n-1 && j == m-1)
                continue;
            if(grid[i][j] == '.'){
                r[i][j+1] += r[i][j];
                d[i+1][j] += d[i][j];
            } else if(grid[i][j] == 'X'){
                r[i][j+1] += r[i][j] + d[i][j];
                d[i+1][j] += r[i][j] + d[i][j];
            } else if(grid[i][j] == 'r'){
                r[i][j+1] += r[i][j] + d[i][j];
            } else {
                d[i+1][j] += r[i][j] + d[i][j];
            }
        }
    }
    ll ans = r[n-1][m-1] + d[n-1][m-1];
    /*for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cout << setw(8) << r[i][j] << ' ' << d[i][j];
        }
        cout << '\n';
    }*/
    return ans;
}
 
void solve(){
    ll k;
    cin >> k;
    int n = get_log(k);
    vector<vector<char>> a(n+1, vector<char>(n+1, '.'));
    for(int i = 0; i < n-1; i++){
        a[i][i] = 'X';
        a[i+1][i] = ((1LL << i) & k ? 'X' : 'r');
        a[i][i+1] = 'd';
    }
    for(int i = 0; i <= n; i++){
        a[n][i] = 'r';
        a[i][n] = 'd';
    }
    a[n][n] = '.';
    cout << n+1 << ' ' << n+1 << '\n';
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++)
            cout << a[i][j];
        cout << '\n';
    }
    //cout << check(a, n+1, n+1) << '\n';
}

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Correct! Your size: 3
2 Correct 1 ms 212 KB Correct! Your size: 4
3 Correct 0 ms 212 KB Correct! Your size: 4
4 Correct 1 ms 212 KB Correct! Your size: 4
5 Correct 0 ms 212 KB Correct! Your size: 4
6 Correct 0 ms 212 KB Correct! Your size: 5
7 Correct 0 ms 212 KB Correct! Your size: 5
8 Correct 0 ms 212 KB Correct! Your size: 5
9 Partially correct 0 ms 212 KB Partially Correct! Your size: 6
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 212 KB Partially Correct! Your size: 60
2 Partially correct 0 ms 328 KB Partially Correct! Your size: 60
3 Partially correct 0 ms 212 KB Partially Correct! Your size: 61
4 Partially correct 1 ms 328 KB Partially Correct! Your size: 61
5 Partially correct 1 ms 212 KB Partially Correct! Your size: 61
6 Partially correct 1 ms 212 KB Partially Correct! Your size: 61
7 Partially correct 0 ms 212 KB Partially Correct! Your size: 61
8 Partially correct 1 ms 212 KB Partially Correct! Your size: 59