QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#336772 | #8278. Secret Poems | ucup-team180# | AC ✓ | 1ms | 3860kb | C++17 | 992b | 2024-02-24 21:10:02 | 2024-02-24 21:10:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};
int main(){
int N;
cin >> N;
vector<vector<char>> c(N, vector<char>(N));
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cin >> c[i][j];
}
}
vector<string> s(N * 2 - 1);
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
s[i + j] += c[i][j];
}
}
for (int i = 0; i < N * 2 - 1; i += 2){
reverse(s[i].begin(), s[i].end());
}
string S;
for (int i = 0; i < N * 2 - 1; i++){
S += s[i];
}
int x = 0, y = -1, p = 0;
vector<vector<char>> ans(N, vector<char>(N));
for (int i = N * 2; i >= 2; i--){
int d = (N * 2 - i) % 4;
for (int j = 0; j < i / 2; j++){
x += dx[d];
y += dy[d];
ans[x][y] = S[p];
p++;
}
}
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
cout << ans[i][j];
}
cout << endl;
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
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: 3628kb
input:
2 AB CD
output:
AB DC
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
4 ABCD EFGH IJKL MNOP
output:
ABEI KHLF NPOC MJGD
result:
ok 4 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3860kb
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: 3860kb
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: 3696kb
input:
100 XIZRFKBGIFYHQYTINRAKHBPJVQGJIJQXTBLLBVNQQQTSAKPIXTORIREMDTGNDFTOZGUZICOMGINGXDXQXYQEWRNCYEDQCQZHKOIB DNOXVOJOCZMMMAVEWUBXSRPTRNQYWWNGIPKSSRRSBJVKJTAFHQTLJXRWEAZIPYYHSOOTJNJWROQLKUUXBDYKEWKCGGVKFYUWEJWA MIJFNAGSVCXQVEUKOKADMISAQIUNIRHMOVQUPREHRYLSVCTDMTDBEUOYEDJNAQGAMDPLLVAMNARRTYQQERKKBOMPGEEYBC...
output:
XIDMNZROISHWJXFKVFOMPBLMSNOBGJANSFUSGKDSGMGOIFCSFFMKRXJLQYULMBGVZYHMCIYDVHARLNXOHNCRFLUQXMQYMQBMZUGI VXJKKIEEMEBNESRILIGJZXDTTPBGTLEFJMJIRUYIJWNXRTNIBFPKEMPYDRHWRMJMDRBGRFWXIOYGRKJVXIMZUCWBZTHSJHOJWIIP GUWMZUKXPUVAMPLTZXTDHTRJKWJWUDGAHTRLUVBQOWXPZHWGVAORKJKTPZWOLWQSFSVQQKTQBRZUESQQBHIEEBUBSRGTQRHIGL...
result:
ok 100 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
99 KQAUNRTKSNBKSOZMISHVIOTCGFRXRTSERIDJIRBWSUBUSHDCYSRJRGFUAEDPPSSYICZTADUFWNQWOYJXSIWPKORVPXNNIATPFMI TYVXVKQOAHAAZHKIBRXTQMPAGYJRILVGWJIWSAKLVUFDMWXTWPXNDSUMKKNAXDIOKHMOBYCFEXHWQDQHPRAYKDOPDJZZAJVNNAL PHPSTAHBZPCVMEFZJYRIOEZFBYVEVUEXNFEQBONIRFGGKPJXOMHVVRWJWOQFCKLQWBRZUVPSUVNKMDGNFMMENZDWPCZZXNXSI...
output:
KQTPYAUVHCPCPXNRVSHVOOXGPTKTKQARHSKDXDRRDWHOSNABFPUDNTFLEFXSJBFZHBKAPYBNETSZYWKAWFTXPBQACASOZVKUZEK MFXDKJWJFYDGYLNSEVKRYOAYTWVROFEDJZEJXNWKRVRRTIERMPSIRXQMIXFZRFUBRILBNGQJROPQBAXKCTCOKYRAOLTPECOXBTC GZXBABWKOCZAOQBKENWFFRFBXOOCQZAXONHAWHXLJPZDLDBYAFKPZBLXVZQUJWTPNGRCDKYRJRWNIIUECLMBNLSUVIEMGJPGBVG ...
result:
ok 99 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
98 AWIITUWKFFFFJJAFYGXBSDMHLXUENBIGWUUXSQMWRIOOFYIECDJVUCRUUFWX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JJUQAMHDMKIQ MCDLTVHGEKWZZVPPXJEPLOYKBWPYEPILVNNEMINITOFHFACKCKUNFXZFUUBQYPHOCKOCOIMBMLXNAAWMKEUBBVMAXCBVFALP OWATAXAFB...
result:
ok 96 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
90 QVRHBGLGFBQQJZYICUKIXNUZRZXJWRHQRDKOPEXGBQXGFTTQCNOPALCXPTYDZWTQTKCECRTKEWGYTWMXHIURMLUYDP YHPXNNJDKHMYRUKHLPKOMEWODYRMOJNEHDJMDHEZVKQXTYBWVKCOJWHEYKNQIQJYUIHCNUDGNOVTDOQZAHRGWZOAXP BWGPZHSHHSEBWWGRTUVQEUZWUKCBWMQYOBPHPQTZYAGBNPMDDOTEPTVAZYTRSROQWXFLHMCRZAYIPAOHFQSLLQUAAW PSKKELFITHSHHGKIVZEEBLRZ...
output:
QVYBHRHPWPWSGXBGNPKKXRAPKZNLGJHEDGMMJWZMHLSDFBKHFTRFNGBYVDHIZRIHHQQMSTZUDZHREEZOWPZISKWHEY EBOYLFKUXQQASLTXBLTZUYXJRKAXOREIUEZRWMRUBZGEMBCTVNSSNZRBSCEVJIXTIWIKXODQAIRADCMWROBFAWCEZJ JEDHKPJQVVCMEURZCADOVJTRIVQDXTUECSVIJWFOBABSVBFIZCRKUQHUKNUMJBUMWLWNKWRSLVXPHXGEQIOFIXGSVZ FPNVQBHBYCPIHKIEPBTJUAJNLPX...
result:
ok 90 lines
Extra Test:
score: 0
Extra Test Passed