QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#546117#1806. Character Gridsurgutti#AC ✓1ms3940kbC++171.0kb2024-09-03 19:58:472024-09-03 19:58:47

Judging History

你现在查看的是最新测评结果

  • [2024-09-03 19:58:47]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3940kb
  • [2024-09-03 19:58:47]
  • 提交

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