답안 #315243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315243 2020-10-22T06:12:57 Z Kevin_Zhang_TW Costinland (info1cup19_costinland) C++17
62.2287 / 100
1 ms 332 KB
#include<bits/stdc++.h>
#define pb emplace_back
#define AI(i) begin(i), end(i)
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void debug(auto L, auto R) { while (L < R) cerr << *L << " \n"[L+1==R], ++L; }
void kout(){ cerr << endl; }
template<class T1, class ...T2> void kout(T1 a, T2 ...e) { cerr << a << ' ', kout(e...); }
#else
#define DE(...) 0
#define deubg(...) 0
#endif
const int MAX_N = 111, wid1 = 4;
const ll inf = 1e18 + 10;
ll K;
char w[MAX_N][MAX_N];
void special(ll K) {
	if (K == 2) {
		cout << "2 2\nxd\nr.\n";
		return;
	}
	int lev = 3;
	lev = 60;
	int n = lev + 2;
	for (int i = 1;i <= n;++i)
		for (int j = 1;j <= n;++j)
			w[i][j] = '.';

	for (int i = 1;i <= n;++i)
		w[i][n] = 'd', w[n][i] = 'r';

	w[1][1] = 'X';
	w[n][n] = '.';
	
	K -= 2;

	for (int i = 2;i < n;++i) {
		w[i][i] = 'X';
		w[i][i+1] = 'd';
		w[i+1][i] = 'r';
	}

	for (ll i = 2, v = 1ll<<lev;i < n;++i, v>>=1) {
		if (K & (v<<1)) {
			w[1][i] = w[i][1] = 'X';
			K ^= v<<1;
		}
		else if (K & v) {
			w[1][i] = 'X', K ^= v;
		}
	}

	DE(K);	
	if (K) {
		assert(K == 1);
		w[n-1][1] = 'X';
		w[n-1][2] = 'd';
	}

	cout << n << ' ' << n << '\n';
	for (int i = 1;i <= n;++i)
		cout << w[i]+1 << '\n';
}

void logone(ll K) {
	int lev = __lg(--K);
	int n = lev + 2;
	for (int i = 1;i <= n;++i)
		for (int j = 1;j <= n;++j)
			w[i][j] = '.';

	for (int i = 1;i <= n;++i)
		w[i][n] = 'd', w[n][i] = 'r';

	w[1][1] = 'r';
	w[n][n] = '.';

	for (int i = 2;i < n;++i) {
		w[i][i] = 'X';
		w[i][i+1] = 'd';
		w[i+1][i] = 'r';
	}
	for (ll i = 2, v = 1ll<<lev;i < n;++i, v>>=1) {
		if (K & v) w[1][i] = 'X';
		else w[1][i] = 'r';
	}
	if (K&1) w[1][1] = 'X';

	cout << n << ' ' << n << '\n';
	for (int i = 1;i <= n;++i)
		cout << w[i]+1 << '\n';
	DE(check1());
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> K;
	if (K <= 19)
		special(K);
	else
		logone(K);
}

Compilation message

costinland.cpp: In function 'void special(ll)':
costinland.cpp:12:17: warning: statement has no effect [-Wunused-value]
   12 | #define DE(...) 0
      |                 ^
costinland.cpp:55:2: note: in expansion of macro 'DE'
   55 |  DE(K);
      |  ^~
costinland.cpp: In function 'void logone(ll)':
costinland.cpp:12:17: warning: statement has no effect [-Wunused-value]
   12 | #define DE(...) 0
      |                 ^
costinland.cpp:94:2: note: in expansion of macro 'DE'
   94 |  DE(check1());
      |  ^~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
2 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
3 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
4 Partially correct 1 ms 332 KB Partially Correct! Your size: 62
5 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
6 Partially correct 1 ms 332 KB Partially Correct! Your size: 62
7 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
8 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
9 Partially correct 1 ms 204 KB Partially Correct! Your size: 62
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 332 KB Partially Correct! Your size: 60
2 Partially correct 1 ms 204 KB Partially Correct! Your size: 60
3 Partially correct 1 ms 204 KB Partially Correct! Your size: 61
4 Partially correct 1 ms 204 KB Partially Correct! Your size: 61
5 Partially correct 1 ms 204 KB Partially Correct! Your size: 61
6 Partially correct 1 ms 204 KB Partially Correct! Your size: 61
7 Partially correct 1 ms 332 KB Partially Correct! Your size: 61
8 Partially correct 1 ms 204 KB Partially Correct! Your size: 59