QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#336888#8278. Secret Poemsucup-team1134#AC ✓1ms3808kbC++231.6kb2024-02-24 23:17:182024-02-24 23:17:19

Judging History

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

  • [2024-02-24 23:17:19]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3808kb
  • [2024-02-24 23:17:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<string> S(N);
    for(int i=0;i<N;i++) cin>>S[i];
    
    string U;
    for(int t=0;t<=N-1+N-1;t++){
        if(t&1){
            for(int i=0;i<N;i++){
                int j=t-i;
                if(j<0||j>=N) continue;
                U+=S[i][j];
            }
        }else{
            for(int i=N-1;i>=0;i--){
                int j=t-i;
                if(j<0||j>=N) continue;
                U+=S[i][j];
            }
        }
    }
    
    vector<vector<int>> ans(N,vector<int>(N));
    
    int t=0;
    for(int q=0;q<N/2;q++){
        for(int j=q;j<N-1-q;j++){
            ans[q][j]=t++;
        }
        for(int i=q;i<N-1-q;i++){
            ans[i][N-1-q]=t++;
        }
        for(int j=N-1-q;j>q;j--){
            ans[N-1-q][j]=t++;
        }
        for(int i=N-1-q;i>q;i--){
            ans[i][q]=t++;
        }
    }
    if(N&1){
        ans[N/2][N/2]=N*N-1;
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cout<<U[ans[i][j]];
        }
        cout<<"\n";
    }
    
}


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

詳細信息

Test #1:

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

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: 3516kb

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: 0ms
memory: 3584kb

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: 3592kb

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: 3604kb

input:

100
XIZRFKBGIFYHQYTINRAKHBPJVQGJIJQXTBLLBVNQQQTSAKPIXTORIREMDTGNDFTOZGUZICOMGINGXDXQXYQEWRNCYEDQCQZHKOIB
DNOXVOJOCZMMMAVEWUBXSRPTRNQYWWNGIPKSSRRSBJVKJTAFHQTLJXRWEAZIPYYHSOOTJNJWROQLKUUXBDYKEWKCGGVKFYUWEJWA
MIJFNAGSVCXQVEUKOKADMISAQIUNIRHMOVQUPREHRYLSVCTDMTDBEUOYEDJNAQGAMDPLLVAMNARRTYQQERKKBOMPGEEYBC...

output:

XIDMNZROISHWJXFKVFOMPBLMSNOBGJANSFUSGKDSGMGOIFCSFFMKRXJLQYULMBGVZYHMCIYDVHARLNXOHNCRFLUQXMQYMQBMZUGI
VXJKKIEEMEBNESRILIGJZXDTTPBGTLEFJMJIRUYIJWNXRTNIBFPKEMPYDRHWRMJMDRBGRFWXIOYGRKJVXIMZUCWBZTHSJHOJWIIP
GUWMZUKXPUVAMPLTZXTDHTRJKWJWUDGAHTRLUVBQOWXPZHWGVAORKJKTPZWOLWQSFSVQQKTQBRZUESQQBHIEEBUBSRGTQRHIGL...

result:

ok 100 lines

Test #7:

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

input:

99
KQAUNRTKSNBKSOZMISHVIOTCGFRXRTSERIDJIRBWSUBUSHDCYSRJRGFUAEDPPSSYICZTADUFWNQWOYJXSIWPKORVPXNNIATPFMI
TYVXVKQOAHAAZHKIBRXTQMPAGYJRILVGWJIWSAKLVUFDMWXTWPXNDSUMKKNAXDIOKHMOBYCFEXHWQDQHPRAYKDOPDJZZAJVNNAL
PHPSTAHBZPCVMEFZJYRIOEZFBYVEVUEXNFEQBONIRFGGKPJXOMHVVRWJWOQFCKLQWBRZUVPSUVNKMDGNFMMENZDWPCZZXNXSI...

output:

KQTPYAUVHCPCPXNRVSHVOOXGPTKTKQARHSKDXDRRDWHOSNABFPUDNTFLEFXSJBFZHBKAPYBNETSZYWKAWFTXPBQACASOZVKUZEK
MFXDKJWJFYDGYLNSEVKRYOAYTWVROFEDJZEJXNWKRVRRTIERMPSIRXQMIXFZRFUBRILBNGQJROPQBAXKCTCOKYRAOLTPECOXBTC
GZXBABWKOCZAOQBKENWFFRFBXOOCQZAXONHAWHXLJPZDLDBYAFKPZBLXVZQUJWTPNGRCDKYRJRWNIIUECLMBNLSUVIEMGJPGBVG
...

result:

ok 99 lines

Test #8:

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

input:

98
AWIITUWKFFFFJJAFYGXBSDMHLXUENBIGWUUXSQMWRIOOFYIECDJVUCRUUFWXDRQMJPUPJVJOIRVCURIVIAJPPWDSCYLZBNSRRL
OVLTIENSFNUSITTHGHASWIHFEQSDYSFFSASKUUJZSMKNKGBDXZGTHPVRNQWDGTYNXMDLZICESKPMOCSLSVLELDVKYWOQFPUNRH
RZGYHTYLPROGTRHSTZOJKRHQGJOQRHZUCGPJQBRUKHBMPUEIVMILPRUKKYFOUJWUYBCNNVHJHWRKAANOCOABIMZCJLGMFJAJDU
...

output:

AWORVIILZUVZGTTUIYHZXJAAHHEWKNTKQKWGMXZMRKYSFFFLNEWCSKTDNUODOLXPNFFURVHEUDXQMZYPRFQLIKQOOSJJIGTZKN
TCGXALVYNTYWRQKMDYFQCWVCLLIWAEHGXAMDVBGDFTTFXODNBYQCTFRTNAENUSLKKIMBHFWVGJJCGPBMPSECFDCIDQFIAASLWT
BMNDJLLRQKLQUMWJBZOKXODRSJCXAITJNLGFZJCHJULZQQUFAFUKBAVUPIMFTWLEPAISOLMLDXZLHGFXSALVXGOHZBQSRZRINR
KBP...

result:

ok 98 lines

Test #9:

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

input:

96
GTHPKKJKUAIXLVQNDZGHHPPURUOMMYWDZVHHNCPIIDOFYXREYSUKPDHPINGMVXWPOWAAJJKIUKIVCIK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J
JEDHKPJQVVCMEURZCADOVJTRIVQDXTUECSVIJWFOBABSVBFIZCRKUQHUKNUMJBUMWLWNKWRSLVXPHXGEQIOFIXGSVZ
FPNVQBHBYCPIHKIEPBTJUAJNLPX...

result:

ok 90 lines

Extra Test:

score: 0
Extra Test Passed