QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#336886#8278. Secret Poemsucup-team1134#WA 0ms3580kbC++231.6kb2024-02-24 23:15:442024-02-24 23:15:45

Judging History

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

  • [2024-02-24 23:15:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-02-24 23:15:44]
  • 提交

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++;
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cout<<U[ans[i][j]];
        }
        cout<<"\n";
    }
    
}


详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

5
THSAD
IIVOP
SEOOH
RGETI
YMINK

output:

THISI
POEMS
DNTIA
OIHTV
OGYRE

result:

wrong answer 3rd lines differ - expected: 'DNKIA', found: 'DNTIA'