답안 #1090793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090793 2024-09-18T18:27:04 Z vako_p Costinland (info1cup19_costinland) C++14
0 / 100
1 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long

const int mxN = 100;	
ll x,n;
char a[mxN][mxN];

void f(ll op, ll idx){
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3 and (j != 2 or i != 2); j++) a[idx + i][idx + j] = 'x';
	}
	a[idx][idx + 2] = 'd';
	if(!(op % 2)) a[idx + 2][idx] = 'r';
	if(op < 4) a[idx + 1][idx + 2] = 'd';
	if(op < 2) a[idx + 2][idx + 1] = 'r';  
}

void f1(ll op, ll idx){
	if(op > 1) a[idx][idx] = 'x';
	if(op > 2) a[idx][idx + 1] = 'x';
	if(op > 3) a[idx][idx + 2] = 'x';
	if(op > 4) a[idx + 1][idx] = 'x';
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> x;
  	if(x >= 8) assert(0);
	if(x <= 19) n = 5;
	else n = 49;
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++){
		a[i][j] = '.';
		if(i == n - 1 and j != n - 1) a[i][j] = 'r';
		if(j == n - 1 and i != n - 1) a[i][j] = 'd';
	}
	a[0][0] = 'r';
	ll curr = 1,idx = 0;
	cout << n << ' ' << n << '\n';
	for(int i = 0; i < 24; i++){
		ll op = x % (curr * 6) / curr;
		if(x < curr) break;
		if(x >= curr * 6) f(op, idx);
		else f1(op, idx);
		curr *= 6;
		idx += 2;
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(a[i][j] == 'x') cout << 'X';
			else cout << a[i][j];
		}
		cout << '\n';
	}
}

Compilation message

costinland.cpp: In function 'void f(long long int, long long int)':
costinland.cpp:16:33: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   16 |  if(op < 4) a[idx + 1][idx + 2] = 'd';
      |             ~~~~~~~~~~~~~~~~~~~~^~~~~
costinland.cpp:8:6: note: at offset 0 to object 'a' with size 10000 declared here
    8 | char a[mxN][mxN];
      |      ^
costinland.cpp:17:33: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   17 |  if(op < 2) a[idx + 2][idx + 1] = 'r';
      |             ~~~~~~~~~~~~~~~~~~~~^~~~~
costinland.cpp:8:6: note: at offset 0 to object 'a' with size 10000 declared here
    8 | char a[mxN][mxN];
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Correct! Your size: 5
2 Correct 0 ms 348 KB Correct! Your size: 5
3 Correct 0 ms 348 KB Correct! Your size: 5
4 Correct 0 ms 348 KB Correct! Your size: 5
5 Correct 0 ms 344 KB Correct! Your size: 5
6 Runtime error 1 ms 604 KB Execution killed with signal 6
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -