QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#421976#8278. Secret Poemsucup-team1069#AC ✓1ms3852kbC++231.4kb2024-05-26 15:37:312024-05-26 15:37:31

Judging History

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

  • [2024-05-26 15:37:31]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3852kb
  • [2024-05-26 15:37:31]
  • 提交

answer

#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;

char a[111][111];


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1 ; i <= n ; ++ i) {
		for (int j = 1 ; j <= n ; ++ j) {
			cin >> a[i][j];
		}
	}
	string s;
	for (int d = 1 ; d <= 2 * n ; ++ d) {
		if (d % 2 == 0) {
			for (int j = 1 ; j <= n ; ++ j) {
				int i = d - j;
				if (1 <= i && i <= n) {
					s += a[i][j];
				}
			}
		} else {
			for (int i = 1 ; i <= n ; ++ i) {
				int j = d - i;
				if (1 <= j && j <= n) {
					s += a[i][j];
				}
			}
		}
	}
	for (int i = 1 ; i <= n ; ++ i) {
		for (int j = 1 ; j <= n ; ++ j) {
			a[i][j] = '-';
		}
	}
	int l = 0;
	int x = 1, y = 1;
	while (a[x][y] == '-' && l < s.size()) {
		while (1) {
			if (l < s.size()) a[x][y] = s[l++];
			if (a[x][y + 1] != '-') break;
			y++;
		}
		++x;
		while (1) {
			if (l < s.size()) a[x][y] = s[l++];
			if (a[x + 1][y] != '-') break;
			x++;
		}
		y--;
		while (1) {
			if (l < s.size()) a[x][y] = s[l++];
			if (a[x][y - 1] != '-') break;
			y--;
		}
		x--;
		while (1) {
			if (l < s.size()) a[x][y] = s[l++];
			if (a[x - 1][y] != '-') break;
			x--;
		}
		y++;
	}
	for (int i = 1 ; i <= n ; ++ i) {
		for (int j = 1 ; j <= n ; ++ j) {
			cout << a[i][j];
		}
		cout << endl;
	}
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3812kb

input:

5
THSAD
IIVOP
SEOOH
RGETI
YMINK

output:

THISI
POEMS
DNKIA
OIHTV
OGYRE

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

2
AB
CD

output:

AB
DC

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

4
ABCD
EFGH
IJKL
MNOP

output:

ABEI
KHLF
NPOC
MJGD

result:

ok 4 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3492kb

input:

8
ABCEFDWL
ABCEFDWL
ABCEFDWL
ABCEFDWL
ABCEFDWL
ABCEFDWL
ABCEFDWL
ABCEFDWL

output:

ABAABCEC
WLWDFECB
DECEFDBA
FFWLLWAA
EDDLWLBB
CWFDWLCC
BLLWDFEE
AABCEFDF

result:

ok 8 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

20
ABCDEFGHEFGHEFGHIJKL
EFGHIJKLMNOPKLMNKEFW
IJKLIAAAAJKLIJKLEEEE
EFGHIJKLMNOPKLMNKEFW
IJKLIAAAAJKLIJKLEEEE
IJKLIAAAAJKLIJKLEEEE
JKLIJKLEEEEIJKLIAAAA
EFGHIJKLMNOPKLMNKEFW
ABCDEFGHEFGHEFGHIJKL
EFGHIJKLMNOPKLMNKEFW
IJKLIAAAAJKLIJKLEEEE
EFGHIJKLMNOPKLMNKEFW
IJKLIAAAAJKLIJKLEEEE
IJKLIAAAAJKLIJKLEEEE
JKL...

output:

ABEIFCDGJEIFKHEFILGJ
GJEIFKHEJLAANKPEFKLI
DLENELILKNIJKLMJIIOJ
IAAKIDGJIJKHEJLAAOJJ
KJAPILGNAEEWEEAKNFAK
AIMKLMJIIOFMAAKHKMEH
ALJJKKPELLLEEEAMPAKI
MLOEJEWEEAKHMWNJEKFJ
JFHLFLELLIEEJEGKLAIG
OAKGAJEKEWEKEFPLLILH
HEKJEOAJAJAWKEJKLIGK
GKKIAHNFJEFLKEJEEGJA
NKLLEKGAEAEINIKMEBII
ALKKIKLIEELKFMNHEEJL
LIELNK...

result:

ok 20 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

100
XIZRFKBGIFYHQYTINRAKHBPJVQGJIJQXTBLLBVNQQQTSAKPIXTORIREMDTGNDFTOZGUZICOMGINGXDXQXYQEWRNCYEDQCQZHKOIB
DNOXVOJOCZMMMAVEWUBXSRPTRNQYWWNGIPKSSRRSBJVKJTAFHQTLJXRWEAZIPYYHSOOTJNJWROQLKUUXBDYKEWKCGGVKFYUWEJWA
MIJFNAGSVCXQVEUKOKADMISAQIUNIRHMOVQUPREHRYLSVCTDMTDBEUOYEDJNAQGAMDPLLVAMNARRTYQQERKKBOMPGEEYBC...

output:

XIDMNZROISHWJXFKVFOMPBLMSNOBGJANSFUSGKDSGMGOIFCSFFMKRXJLQYULMBGVZYHMCIYDVHARLNXOHNCRFLUQXMQYMQBMZUGI
VXJKKIEEMEBNESRILIGJZXDTTPBGTLEFJMJIRUYIJWNXRTNIBFPKEMPYDRHWRMJMDRBGRFWXIOYGRKJVXIMZUCWBZTHSJHOJWIIP
GUWMZUKXPUVAMPLTZXTDHTRJKWJWUDGAHTRLUVBQOWXPZHWGVAORKJKTPZWOLWQSFSVQQKTQBRZUESQQBHIEEBUBSRGTQRHIGL...

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

99
KQAUNRTKSNBKSOZMISHVIOTCGFRXRTSERIDJIRBWSUBUSHDCYSRJRGFUAEDPPSSYICZTADUFWNQWOYJXSIWPKORVPXNNIATPFMI
TYVXVKQOAHAAZHKIBRXTQMPAGYJRILVGWJIWSAKLVUFDMWXTWPXNDSUMKKNAXDIOKHMOBYCFEXHWQDQHPRAYKDOPDJZZAJVNNAL
PHPSTAHBZPCVMEFZJYRIOEZFBYVEVUEXNFEQBONIRFGGKPJXOMHVVRWJWOQFCKLQWBRZUVPSUVNKMDGNFMMENZDWPCZZXNXSI...

output:

KQTPYAUVHCPCPXNRVSHVOOXGPTKTKQARHSKDXDRRDWHOSNABFPUDNTFLEFXSJBFZHBKAPYBNETSZYWKAWFTXPBQACASOZVKUZEK
MFXDKJWJFYDGYLNSEVKRYOAYTWVROFEDJZEJXNWKRVRRTIERMPSIRXQMIXFZRFUBRILBNGQJROPQBAXKCTCOKYRAOLTPECOXBTC
GZXBABWKOCZAOQBKENWFFRFBXOOCQZAXONHAWHXLJPZDLDBYAFKPZBLXVZQUJWTPNGRCDKYRJRWNIIUECLMBNLSUVIEMGJPGBVG
...

result:

ok 99 lines

Test #8:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

98
AWIITUWKFFFFJJAFYGXBSDMHLXUENBIGWUUXSQMWRIOOFYIECDJVUCRUUFWXDRQMJPUPJVJOIRVCURIVIAJPPWDSCYLZBNSRRL
OVLTIENSFNUSITTHGHASWIHFEQSDYSFFSASKUUJZSMKNKGBDXZGTHPVRNQWDGTYNXMDLZICESKPMOCSLSVLELDVKYWOQFPUNRH
RZGYHTYLPROGTRHSTZOJKRHQGJOQRHZUCGPJQBRUKHBMPUEIVMILPRUKKYFOUJWUYBCNNVHJHWRKAANOCOABIMZCJLGMFJAJDU
...

output:

AWORVIILZUVZGTTUIYHZXJAAHHEWKNTKQKWGMXZMRKYSFFFLNEWCSKTDNUODOLXPNFFURVHEUDXQMZYPRFQLIKQOOSJJIGTZKN
TCGXALVYNTYWRQKMDYFQCWVCLLIWAEHGXAMDVBGDFTTFXODNBYQCTFRTNAENUSLKKIMBHFWVGJJCGPBMPSECFDCIDQFIAASLWT
BMNDJLLRQKLQUMWJBZOKXODRSJCXAITJNLGFZJCHJULZQQUFAFUKBAVUPIMFTWLEPAISOLMLDXZLHGFXSALVXGOHZBQSRZRINR
KBP...

result:

ok 98 lines

Test #9:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

96
GTHPKKJKUAIXLVQNDZGHHPPURUOMMYWDZVHHNCPIIDOFYXREYSUKPDHPINGMVXWPOWAAJ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MWROBFAWCEZJ
JEDHKPJQVVCMEURZCADOVJTRIVQDXTUECSVIJWFOBABSVBFIZCRKUQHUKNUMJBUMWLWNKWRSLVXPHXGEQIOFIXGSVZ
FPNVQBHBYCPIHKIEPBTJUAJNLPX...

result:

ok 90 lines

Extra Test:

score: 0
Extra Test Passed