QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#679193#6819. Largest Unique Winswzl19371WA 0ms3968kbC++141.7kb2024-10-26 17:05:542024-10-26 17:05:55

Judging History

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

  • [2024-10-26 17:05:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3968kb
  • [2024-10-26 17:05:54]
  • 提交

answer


#include <bits/stdc++.h>

#define rep(i, o, p) for(int i =o; i <= p; i ++)
#define endl '\n'
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;

    cin >> n >> m;
        double x = 1, y = 0, z = 1.0 / m;
    if(n == 2) {
        rep(i, 1, n){
            rep(j, 1, m) {
                printf("%.10lf ", (m == j) ? x : y);
            }
            printf("\n");
        }
        return 0;
    }
    if(m == 2) {
        rep(i, 1, n) {
            if(i <= 2) printf("%.10lf %.10lf\n", x, y);
            else        printf("%.10lf %.10lf\n", y, x);
        }
        return 0;
    }
    if(n >= m){
        if(n - m == 1) {
            rep(i, 1, n){
                rep(j, 1, m)
                if(i >= n - 1) printf("%.10lf ", j == m ? x : y);
                else printf("%.10lf ", j == (m - 1) ? x : y);
                printf("\n");
            }
        }
        else {
         rep(i, 1, n){
            // if(i > m){
            //     if(i == n) rep(j, 1, m)   printf("%.10lf ", j == 1 ? x : y);
            //     else  rep(j, 1, m)   printf("%.10lf ", j == m ? x : y);
            // }
            // else{
                for(int j = m ; j >= 1; j --)
                {
                    int d = (i % m == 0) ? m : (i % m);
                    printf("%.10lf ", (d == j) ? x : y);
                }
            
            printf("\n");
        }
        }
   
    }
    else {
        rep(i, 1, n){
            int t = m - n;
            rep(j, 1, t) printf("%.10lf ", y);
            rep(j, 1, n) printf("%.10lf ", (i == j) ? x : y);
            printf("\n");
        }
       
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2

output:

0.0000000000 1.0000000000 
0.0000000000 1.0000000000 

result:

ok ok  0.0000 0.0000

Test #2:

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

input:

3 3

output:

0.0000000000 0.0000000000 1.0000000000 
0.0000000000 1.0000000000 0.0000000000 
1.0000000000 0.0000000000 0.0000000000 

result:

ok ok  1.0000 -1.0000 -1.0000

Test #3:

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

input:

3 2

output:

1.0000000000 0.0000000000
1.0000000000 0.0000000000
0.0000000000 1.0000000000

result:

ok ok  -1.0000 -1.0000 1.0000

Test #4:

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

input:

12 12

output:

0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000 
0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000 ...

result:

ok ok  1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3888kb

input:

12 11

output:

0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000 0.0000000000 
0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 1.0000000000 0.0000000000 
0.0000000000...

result:

wrong answer 1's strategy is not optimal, current = 0.0000000000, better (1) = 1.0000000000