QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#368193 | #8278. Secret Poems | BUET_POTATOES# | AC ✓ | 1ms | 3680kb | C++20 | 2.0kb | 2024-03-26 21:47:42 | 2024-03-26 21:47:42 |
Judging History
answer
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt")
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define DBG(a) cerr<< "line "<<__LINE__ <<" : "<< #a <<" --> "<<(a)<<endl
#define eps 1e-8
//#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
//typedef long long LL;
typedef long double Tf;
typedef pair<int,int>pii;
const ll mod = 998244353;
////const ll mod = 1e9+7;
////long double pi = acosl(-1);
//const ll infl = 1e18+100;
const int inf = 1e9+100;
const int nmax = 2e5+5;
//const int MAXLG = log2(nmax)+1;
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< ll, nullptr_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;
void solve(int ces){
int n;
cin>>n;
vector<string>grid(n);
vector<string>diag(2*n-1);
for(auto &s : grid) cin>>s;
for(int i=0; i<n; i++) for(int j=0; j<n; j++){
diag[i+j].push_back(grid[i][j]);
}
string fulString;
for(int i=0; i<2*n-1; i++){
if(i%2==0) reverse(diag[i].begin(), diag[i].end());
fulString += diag[i];
}
int cur=0;
vector< string >ans(n, string(n, 'a') );
for(int i=0; i<(n+1)/2; i++){
// int len = n-2*i;
for(int j=i; j<n-i; j++){
ans[i][j] = fulString[cur++];
}
if(cur==n*n) break;
for(int k=i+1; k<n-i-1; k++){
ans[ k ][ n-1-i ] = fulString[cur++];
}
for(int j=n-1-i; j>=i; j--){
ans[ n-1-i ][ j ] = fulString[cur++];
}
for(int k=n-i-1-1; k>=i+1; k--){
ans[ k ][ i ] = fulString[cur++];
}
}
for(auto s : ans){
cout<<s<<"\n";
}
}
/*
*/
int main(){
ios::sync_with_stdio(false); cin.tie(0);
int tc=1;
// cin>>tc;
for(int ces=1; ces<=tc; ces++){
solve(ces);
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3552kb
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: 3572kb
input:
2 AB CD
output:
AB DC
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
4 ABCD EFGH IJKL MNOP
output:
ABEI KHLF NPOC MJGD
result:
ok 4 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
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: 3624kb
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: 3572kb
input:
100 XIZRFKBGIFYHQYTINRAKHBPJVQGJIJQXTBLLBVNQQQTSAKPIXTORIREMDTGNDFTOZGUZICOMGINGXDXQXYQEWRNCYEDQCQZHKOIB DNOXVOJOCZMMMAVEWUBXSRPTRNQYWWNGIPKSSRRSBJVKJTAFHQTLJXRWEAZIPYYHSOOTJNJWROQLKUUXBDYKEWKCGGVKFYUWEJWA MIJFNAGSVCXQVEUKOKADMISAQIUNIRHMOVQUPREHRYLSVCTDMTDBEUOYEDJNAQGAMDPLLVAMNARRTYQQERKKBOMPGEEYBC...
output:
XIDMNZROISHWJXFKVFOMPBLMSNOBGJANSFUSGKDSGMGOIFCSFFMKRXJLQYULMBGVZYHMCIYDVHARLNXOHNCRFLUQXMQYMQBMZUGI VXJKKIEEMEBNESRILIGJZXDTTPBGTLEFJMJIRUYIJWNXRTNIBFPKEMPYDRHWRMJMDRBGRFWXIOYGRKJVXIMZUCWBZTHSJHOJWIIP GUWMZUKXPUVAMPLTZXTDHTRJKWJWUDGAHTRLUVBQOWXPZHWGVAORKJKTPZWOLWQSFSVQQKTQBRZUESQQBHIEEBUBSRGTQRHIGL...
result:
ok 100 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
99 KQAUNRTKSNBKSOZMISHVIOTCGFRXRTSERIDJIRBWSUBUSHDCYSRJRGFUAEDPPSSYICZTADUFWNQWOYJXSIWPKORVPXNNIATPFMI TYVXVKQOAHAAZHKIBRXTQMPAGYJRILVGWJIWSAKLVUFDMWXTWPXNDSUMKKNAXDIOKHMOBYCFEXHWQDQHPRAYKDOPDJZZAJVNNAL PHPSTAHBZPCVMEFZJYRIOEZFBYVEVUEXNFEQBONIRFGGKPJXOMHVVRWJWOQFCKLQWBRZUVPSUVNKMDGNFMMENZDWPCZZXNXSI...
output:
KQTPYAUVHCPCPXNRVSHVOOXGPTKTKQARHSKDXDRRDWHOSNABFPUDNTFLEFXSJBFZHBKAPYBNETSZYWKAWFTXPBQACASOZVKUZEK MFXDKJWJFYDGYLNSEVKRYOAYTWVROFEDJZEJXNWKRVRRTIERMPSIRXQMIXFZRFUBRILBNGQJROPQBAXKCTCOKYRAOLTPECOXBTC GZXBABWKOCZAOQBKENWFFRFBXOOCQZAXONHAWHXLJPZDLDBYAFKPZBLXVZQUJWTPNGRCDKYRJRWNIIUECLMBNLSUVIEMGJPGBVG ...
result:
ok 99 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
98 AWIITUWKFFFFJJAFYGXBSDMHLXUENBIGWUUXSQMWRIOOFYIECDJVUCRUUFWXDRQMJPUPJVJOIRVCURIVIAJPPWDSCYLZBNSRRL OVLTIENSFNUSITTHGHASWIHFEQSDYSFFSASKUUJZSMKNKGBDXZGTHPVRNQWDGTYNXMDLZICESKPMOCSLSVLELDVKYWOQFPUNRH RZGYHTYLPROGTRHSTZOJKRHQGJOQRHZUCGPJQBRUKHBMPUEIVMILPRUKKYFOUJWUYBCNNVHJHWRKAANOCOABIMZCJLGMFJAJDU ...
output:
AWORVIILZUVZGTTUIYHZXJAAHHEWKNTKQKWGMXZMRKYSFFFLNEWCSKTDNUODOLXPNFFURVHEUDXQMZYPRFQLIKQOOSJJIGTZKN TCGXALVYNTYWRQKMDYFQCWVCLLIWAEHGXAMDVBGDFTTFXODNBYQCTFRTNAENUSLKKIMBHFWVGJJCGPBMPSECFDCIDQFIAASLWT BMNDJLLRQKLQUMWJBZOKXODRSJCXAITJNLGFZJCHJULZQQUFAFUKBAVUPIMFTWLEPAISOLMLDXZLHGFXSALVXGOHZBQSRZRINR KBP...
result:
ok 98 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
96 GTHPKKJKUAIXLVQNDZGHHPPURUOMMYWDZVHHNCPIIDOFYXREYSUKPDHPINGMVXWPOWAAJJKIUKIVCIKDZDHUTZDNETZEZJFU HBORTXEIITFJNMZFIQMNVPRXAEMGGHCFKGEAUELEICWYIFUCMKEJHVURPDMQUOWPRDCHQEAKOUHLCEHJSMMTDGLVJRNXQPTO TLKETIQMYASQZUMUFBUYONKMGEEBMIBKGEGTYVDWTGAFFQAFQJDUKIVDHOSTKCDCKZMGKRMRBFUVFMREQWBFLVHQLUFLMTYV GHQSRN...
output:
GTHTBHPOLGXHKRKKTEQKNKOZSTXJKEIRQLSIYWKJWNQIUAIMBRMHDWBPABSPOQFYTIXFAFTUFYNEWMTQGPOSXOLPSJLVNQWL MEGBWAZQHNVNOTUJCDSRXCPHGPWNYKZDCCKKQTWVYUMQWVSRIGGDGEGMYGBDYHPGZXVLBDEESUJNCJTUZMKGJJUQAMHDMKIQ MCDLTVHGEKWZZVPPXJEPLOYKBWPYEPILVNNEMINITOFHFACKCKUNFXZFUUBQYPHOCKOCOIMBMLXNAAWMKEUBBVMAXCBVFALP OWATAXAFB...
result:
ok 96 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
90 QVRHBGLGFBQQJZYICUKIXNUZRZXJWRHQRDKOPEXGBQXGFTTQCNOPALCXPTYDZWTQTKCECRTKEWGYTWMXHIURMLUYDP YHPXNNJDKHMYRUKHLPKOMEWODYRMOJNEHDJMDHEZVKQXTYBWVKCOJWHEYKNQIQJYUIHCNUDGNOVTDOQZAHRGWZOAXP BWGPZHSHHSEBWWGRTUVQEUZWUKCBWMQYOBPHPQTZYAGBNPMDDOTEPTVAZYTRSROQWXFLHMCRZAYIPAOHFQSLLQUAAW PSKKELFITHSHHGKIVZEEBLRZ...
output:
QVYBHRHPWPWSGXBGNPKKXRAPKZNLGJHEDGMMJWZMHLSDFBKHFTRFNGBYVDHIZRIHHQQMSTZUDZHREEZOWPZISKWHEY EBOYLFKUXQQASLTXBLTZUYXJRKAXOREIUEZRWMRUBZGEMBCTVNSSNZRBSCEVJIXTIWIKXODQAIRADCMWROBFAWCEZJ JEDHKPJQVVCMEURZCADOVJTRIVQDXTUECSVIJWFOBABSVBFIZCRKUQHUKNUMJBUMWLWNKWRSLVXPHXGEQIOFIXGSVZ FPNVQBHBYCPIHKIEPBTJUAJNLPX...
result:
ok 90 lines
Extra Test:
score: 0
Extra Test Passed