QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#131359#6743. water235YiaWA 1ms3600kbC++141.2kb2023-07-27 00:16:512023-07-27 00:16:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-27 00:16:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2023-07-27 00:16:51]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N,M;
    cin>>N>>M;
    if(N==M){
        cout<<N<<"\n";
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(i==j) cout<<"1 ";
                else cout<<"0 ";
            }
            cout<<"\n";
        }
    }
    if(N>M){
        int cha=N-M;
        int num=M+cha/2;
        if(cha%2) num++;
        cout<<num<<"\n";
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(i==j) cout<<"1 ";
                else if(i>=M&&i-M%2==0&&j==0 || cha%2&&i==N-1&&j==0) cout<<"1 ";
                else cout<<"0 ";
            }
            cout<<"\n";
        }
    }
    if(N<M){
        int cha=M-N;
        int num=N+cha/2;
        if(cha%2) num++;
        cout<<num<<"\n";
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(i==j) cout<<"1 ";
                else if(j>=N&&j-N%2==0&&i==0 || cha%2&&j==M-1&&i==0) cout<<"1 ";
                else cout<<"0 ";
            }
            cout<<"\n";
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3532kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

1 4

output:

3
1 1 0 1 

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
1 0 
0 1 

result:

ok The answer is correct.

Test #5:

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

input:

2 4

output:

3
1 0 0 0 
0 1 0 0 

result:

wrong answer Invalid output