QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#684455#3836. So I'll Max Out My Constructive Algorithm Skillsjay248WA 7ms3768kbC++141.2kb2024-10-28 13:39:342024-10-28 13:39:35

Judging History

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

  • [2024-10-28 13:39:35]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3768kb
  • [2024-10-28 13:39:34]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std;

int main(){
    int t;
    int n;
    int cnt;
    vector<int> v;
    int a[70][70];
    int b[70][70];
    cin>>t;
    while(t-- > 0){
        cnt=0;
        cin>>n;
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                cin>>a[i][j];
            }
        }

        for(int i=0; i<n; i++){
            if(i%2==0){
                for(int j=0; j<n; j++){
                    b[i][j] = a[i][j];
                }
            }
            else {
                for(int j=0; j<n; j++){
                    b[i][j] = a[i][n-j-1];
                }
            }
        }

        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                v.push_back(b[i][j]);
            }
        }
        
        for(int i=1; i<v.size(); i++){
            if(v[i-1] > v[i]) cnt++;
        }


        if(cnt > (n*n-1)/2) {
            for(int i=0; i<v.size()-1; i++){
                cout<<v[i]<<' ';
            }
            cout<<v[v.size()-1]<<'\n';
        }

        else{
            for(int i=v.size()-1; i>0; i--){
                cout<<v[i]<<' ';
            }
            cout<<v[0]<<'\n';
        }
    }
}

詳細信息

Test #1:

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

input:

1
2
4 3
2 1

output:

4 3 1 2

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3600kb

input:

100
9
30 75 35 51 25 19 76 65 62
11 56 63 60 77 48 28 26 74
16 44 46 41 17 8 66 61 42
29 7 43 38 40 31 27 10 39
52 23 58 80 50 20 33 69 47
79 1 5 49 22 37 71 18 70
54 72 4 64 55 34 12 6 15
14 53 45 13 32 59 73 57 81
36 3 78 24 2 68 9 67 21
7
11 28 2 19 9 41 24
17 34 5 10 42 18 47
33 35 22 8 49 1 29
...

output:

30 75 35 51 25 19 76 65 62 74 26 28 48 77 60 63 56 11 16 44 46 41 17 8 66 61 42 39 10 27 31 40 38 43 7 29 52 23 58 80 50 20 33 69 47 70 18 71 37 22 49 5 1 79 54 72 4 64 55 34 12 6 15 81 57 73 59 32 13 45 53 14 36 3 78 24 2 68 9 67 21
30 75 35 51 25 19 76 65 62 74 26 28 48 77 60 63 56 11 16 44 46 41 ...

result:

wrong answer Integer 75 violates the range [1, 49]