QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#94751#6189. Full Clue Problemteam404#WA 2ms3288kbC++143.2kb2023-04-07 17:42:322023-04-07 17:42:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-07 17:42:36]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3288kb
  • [2023-04-07 17:42:32]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[2][25][25];
int b[25][25];
int f[2][20];
signed main()
{
    int n;
    cin >> n;
    for (int i = 0; i <= n + 1; i++)
    {
        for (int j = 0; j <= n + 1; j++)
        {
            a[0][i][j] = a[1][i][j] = 0;
        }
    }
    int m = n - 1;
    if(n == 2){
        cout << "2 3\n3 2\n\n";
        cout << "1 1\n1 0\n\n";
        cout << "0 1\n1 1\n\n";
    }
    else if(n == 3){
        cout << "2 2 2\n2 0 2\n2 2 2\n\n";
        cout << "1 1 0\n1 1 1\n0 1 1\n\n";
        cout << "0 1 1\n1 1 1\n1 1 0\n\n";
    }
    else{
        int k1, k2;
        if(m%2 == 1){
            for (int i = 1; i <= (m + 1) / 2; i++)
                f[0][i] = 3;
            f[0][1] = 2;
            for (int i = 1; i <= (m + 1) / 2;i++)
                f[1][i] = 3;
            f[1][(m + 1) / 2] = 2;
            k1 = (m + 1) / 2;
            k2 = (m + 1) / 2;
        }
        else{
            for (int i = 1; i <= m / 2 + 1; i++)
                f[0][i] = 3;
            f[0][1] = 2;
            f[0][m / 2 + 1] = 2;
            for (int i = 1; i <= m / 2; i++)
                f[1][i] = 3;
            k1 = m / 2 + 1;
            k2 = m / 2;
        }
        int now = 1;
        for (int i = 1; i <= k1; i++){
            for (int j = 0; j < f[0][i]; j++){
                for (int k = 0; k < f[0][i]; k++){
                    a[0][now + j][now + k] = 1;
                }
            }
            now += f[0][i] - 1;
        }
        if(f[0][1] == 3)
            a[0][1][1] = 0;
        if(f[0][k1] == 3)
            a[0][n][n] = 0;
        now = 1;
        for (int i = 1; i <= k2; i++)
        {
            for (int j = 0; j < f[1][i]; j++)
            {
                for (int k = 0; k < f[1][i]; k++)
                {
                    a[1][now + j][now + k] = 1;
                }
            }
            now += f[1][i] - 1;
        }
        if (f[1][1] == 3)
            a[1][1][1] = 0;
        if (f[1][k1] == 3)
            a[1][n][n] = 0;
        for (int i = 1; i <= n; i++){
            for (int j = 1; j <= n; j++){
                f[i][j] = 0;
                if (a[0][i][j] != a[0][i - 1][j])
                    f[i][j]++;
                if (a[0][i][j] != a[0][i + 1][j])
                    f[i][j]++;
                if (a[0][i][j] != a[0][i][j - 1])
                    f[i][j]++;
                if (a[0][i][j] != a[0][i][j + 1])
                    f[i][j]++;
            }
        }
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                cout << f[i][j] << ' ';
            }
            cout << endl;
        }
        cout << endl;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                cout << a[0][i][j] << ' ';
            }
            cout << endl;
        }
        cout << endl;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                cout << a[1][i][j] << ' ';
            }
            cout << endl;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3288kb

input:

5

output:

2 2 2 1 0 
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 

1 1 0 0 0 
1 1 1 1 0 
0 1 1 1 0 
0 1 1 1 1 
0 0 0 1 1 

0 1 1 0 0 
1 1 1 0 0 
1 1 1 1 1 
0 0 1 1 1 
0 0 1 1 1 

result:

wrong answer (1, 0) doesn't satisfy with clues