QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546117 | #1806. Character Grid | surgutti# | AC ✓ | 1ms | 3940kb | C++17 | 1.0kb | 2024-09-03 19:58:47 | 2024-09-03 19:58:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 13;
char ans[N][N];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
ans[i][j] = '_';
char now = 'a';
for (int i = 0; i < N; i++) {
for (int j = (i & 1); j < N; j += 2)
ans[i][j] = now;
now++;
}
char xd = now;
for (int i = 0; i < N; i++) {
if (i % 2 == 0)
xd = now;
for (int j = 1 - (i & 1); j < N; j += 2) {
ans[i][j] = xd;
xd++;
}
}
set<string> S;
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++) {
string s(1, ans[i][j]);
string z(1, ans[i][j]);
for (int p = 1; j + p < N; p++) {
s += ans[i][j + p];
S.insert(s);
}
for (int p = 1; i + p < N; p++) {
z += ans[i + p][j];
S.insert(z);
}
}
assert(S.size() == N * N * (N - 1));
cout << N << '\n';
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++)
cout << ans[i][j];
cout << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3940kb
input:
output:
13 anaoapaqarasa tbubvbwbxbybz cncocpcqcrcsc tdudvdwdxdydz eneoepeqerese tfufvfwfxfyfz gngogpgqgrgsg thuhvhwhxhyhz inioipiqirisi tjujvjwjxjyjz knkokpkqkrksk tlulvlwlxlylz mnmompmqmrmsm
result:
ok accepted