Submission #9194564
Source Code Expand
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧_∧
∧_∧ (´<_` ) Welcome to My Coding Space!
( ´_ゝ`) / ⌒i @hamayanhamayan0
/ \ | |
/ / ̄ ̄ ̄ ̄/ |
__(__ニつ/ _/ .| .|____
\/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/
int N;
string ans[1010];
//---------------------------------------------------------------------------------------------------
void copy(int sx, int sy, vector<string>& vs) {
int n = vs.size();
rep(dx, 0, n) rep(dy, 0, n) ans[sy + dy][sx + dx] = vs[dy][dx];
}
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
if (N == 2) {
cout << -1 << endl;
return;
}
if (N == 3) {
cout << "aa." << endl;
cout << "..a" << endl;
cout << "..a" << endl;
return;
}
if (N == 7) {
cout << "aabbcc." << endl;
cout << "dd.dd.a" << endl;
cout << "..d..da" << endl;
cout << "..d..db" << endl;
cout << "dd.dd.b" << endl;
cout << "..d..dc" << endl;
cout << "..d..dc" << endl;
return;
}
rep(y, 0, N) rep(x, 0, N) ans[y] += ".";
int a, b, c = -1;
rep(c4, 0, N + 1) rep(c5, 0, N + 1) {
int d = N - c4 * 4 - c5 * 5;
if (0 <= d and d % 6 == 0) {
a = c4, b = c5, c = d / 6;
}
}
vector<string> vs4 = {
"aabc",
"ddbc",
"bcaa",
"bcdd"
};
vector<string> vs5 = {
"aabba",
"bcc.a",
"b..cb",
"a..cb",
"abbaa"
};
vector<string> vs6 = {
"aabc..",
"ddbc..",
"..aabc",
"..ddbc",
"bc..aa",
"bc..dd"
};
int x = 0, y = 0;
rep(i, 0, a) {
copy(x, y, vs4);
x += 4;
y += 4;
}
rep(i, 0, b) {
copy(x, y, vs5);
x += 5;
y += 5;
}
rep(i, 0, c) {
copy(x, y, vs6);
x += 6;
y += 6;
}
rep(y, 0, N) printf("%s\n", ans[y].c_str());
}
Submission Info
| Submission Time |
|
| Task |
C - Domino Quality |
| User |
hamayanhamayan |
| Language |
C++14 (GCC 5.4.1) |
| Score |
900 |
| Code Size |
2853 Byte |
| Status |
AC |
| Exec Time |
11 ms |
| Memory |
2304 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
900 / 900 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00-sample-01.txt, 00-sample-02.txt |
| All |
00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt, 01-54.txt, 01-55.txt, 01-56.txt, 01-57.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00-sample-01.txt |
AC |
1 ms |
256 KiB |
| 00-sample-02.txt |
AC |
1 ms |
256 KiB |
| 01-01.txt |
AC |
1 ms |
256 KiB |
| 01-02.txt |
AC |
1 ms |
256 KiB |
| 01-03.txt |
AC |
1 ms |
256 KiB |
| 01-04.txt |
AC |
1 ms |
256 KiB |
| 01-05.txt |
AC |
1 ms |
256 KiB |
| 01-06.txt |
AC |
1 ms |
256 KiB |
| 01-07.txt |
AC |
1 ms |
256 KiB |
| 01-08.txt |
AC |
1 ms |
256 KiB |
| 01-09.txt |
AC |
1 ms |
256 KiB |
| 01-10.txt |
AC |
1 ms |
256 KiB |
| 01-11.txt |
AC |
1 ms |
256 KiB |
| 01-12.txt |
AC |
1 ms |
256 KiB |
| 01-13.txt |
AC |
1 ms |
256 KiB |
| 01-14.txt |
AC |
1 ms |
256 KiB |
| 01-15.txt |
AC |
1 ms |
256 KiB |
| 01-16.txt |
AC |
1 ms |
256 KiB |
| 01-17.txt |
AC |
1 ms |
256 KiB |
| 01-18.txt |
AC |
1 ms |
256 KiB |
| 01-19.txt |
AC |
1 ms |
256 KiB |
| 01-20.txt |
AC |
2 ms |
512 KiB |
| 01-21.txt |
AC |
1 ms |
384 KiB |
| 01-22.txt |
AC |
1 ms |
256 KiB |
| 01-23.txt |
AC |
2 ms |
512 KiB |
| 01-24.txt |
AC |
3 ms |
768 KiB |
| 01-25.txt |
AC |
3 ms |
652 KiB |
| 01-26.txt |
AC |
3 ms |
768 KiB |
| 01-27.txt |
AC |
3 ms |
640 KiB |
| 01-28.txt |
AC |
1 ms |
256 KiB |
| 01-29.txt |
AC |
2 ms |
512 KiB |
| 01-30.txt |
AC |
5 ms |
1280 KiB |
| 01-31.txt |
AC |
6 ms |
1536 KiB |
| 01-32.txt |
AC |
5 ms |
1280 KiB |
| 01-33.txt |
AC |
6 ms |
1536 KiB |
| 01-34.txt |
AC |
6 ms |
1408 KiB |
| 01-35.txt |
AC |
7 ms |
1664 KiB |
| 01-36.txt |
AC |
8 ms |
1792 KiB |
| 01-37.txt |
AC |
3 ms |
768 KiB |
| 01-38.txt |
AC |
9 ms |
1920 KiB |
| 01-39.txt |
AC |
7 ms |
1664 KiB |
| 01-40.txt |
AC |
8 ms |
1792 KiB |
| 01-41.txt |
AC |
7 ms |
1664 KiB |
| 01-42.txt |
AC |
10 ms |
2304 KiB |
| 01-43.txt |
AC |
5 ms |
1280 KiB |
| 01-44.txt |
AC |
9 ms |
2048 KiB |
| 01-45.txt |
AC |
11 ms |
2304 KiB |
| 01-46.txt |
AC |
11 ms |
2304 KiB |
| 01-47.txt |
AC |
11 ms |
2304 KiB |
| 01-48.txt |
AC |
11 ms |
2304 KiB |
| 01-49.txt |
AC |
11 ms |
2304 KiB |
| 01-50.txt |
AC |
11 ms |
2304 KiB |
| 01-51.txt |
AC |
11 ms |
2304 KiB |
| 01-52.txt |
AC |
11 ms |
2304 KiB |
| 01-53.txt |
AC |
11 ms |
2304 KiB |
| 01-54.txt |
AC |
11 ms |
2304 KiB |
| 01-55.txt |
AC |
11 ms |
2304 KiB |
| 01-56.txt |
AC |
11 ms |
2304 KiB |
| 01-57.txt |
AC |
11 ms |
2304 KiB |