제출 #674415

#제출 시각아이디문제언어결과실행 시간메모리
674415QwertyPiCostinland (info1cup19_costinland)C++14
20 / 100
1 ms304 KiB
#include <bits/stdc++.h> using namespace std; char c[51][51]; void defa(int n, int m){ for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if((i == n - 1) == (j == m - 1)) c[i][j] = '.'; else if(i == n - 1) c[i][j] = 'r'; else c[i][j] = 'd'; } } } void pr(int n, int m){ cout << n << ' ' << m << endl; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cout << c[i][j]; } cout << endl; } } void part1(int K){ int n = 0, m = 0; if(K <= 5){ n = 2; m = 5; defa(n, m); for(int i = 0; i < K - 1; i++){ c[0][i] = 'X'; } pr(n, m); }else if(K <= 8){ n = 5; m = 5; defa(n, m); for(int i = 0; i < 4; i++){ c[0][i] = 'X'; } for(int i = 0; i < K - 4; i++){ c[i][0] = 'X'; } pr(n, m); }else if(K <= 10){ n = 5; m = 5; defa(n, m); for(int i = 0; i < 4; i++){ c[0][i] = 'X'; } for(int i = 0; i < K - 6; i++){ c[i][0] = 'X'; } c[1][1] = 'X'; pr(n, m); }else if(K <= 12){ n = 5; m = 5; defa(n, m); for(int i = 0; i < 4; i++){ c[0][i] = 'X'; } for(int i = 0; i < K - 8; i++){ c[i][0] = 'X'; } c[1][1] = 'X'; c[2][2] = 'X'; pr(n, m); }else if(K <= 16){ n = 5; m = 5; defa(n, m); for(int i = 0; i < 3; i++){ c[0][i] = c[1][i] = 'X'; } K -= 10; if(K){ c[2][min(3, K) - 1] = 'X'; K -= min(3, K); } if(K){ c[3][min(3, K) - 1] = 'X'; K -= min(3, K); } pr(n, m); }else if(K <= 19){ n = 5; m = 5; defa(n, m); for(int i = 0; i < 4; i++){ c[0][i] = c[1][i] = 'X'; } K -= 15; if(K){ c[2][min(4, K) - 1] = 'X'; K -= min(4, K); } if(K){ c[3][min(4, K) - 1] = 'X'; K -= min(4, K); } pr(n, m); } } void part2(int K){ } int main(){ int K; cin >> K; if(K <= 19){ part1(K); }else{ part2(K); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...