QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#220613#6309. Aqreucup-team1883#WA 1ms5868kbC++141.5kb2023-10-20 16:29:502023-10-20 16:29:50

Judging History

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

  • [2023-10-20 16:29:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5868kb
  • [2023-10-20 16:29:50]
  • 提交

answer

#include <iostream>

const int N = 1005;
const int pat[4][4] = {
  {1, 0, 1, 1},
  {1, 1, 0, 1},
  {1, 1, 1, 0},
  {0, 1, 1, 1}
};

const int patt[4][4] = {
  {1, 1, 1, 0},
  {0, 1, 1, 1},
  {1, 0, 1, 1},
  {1, 1, 0, 1}
};

int ans[N][N], now[N][N];

int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, m;
    scanf("%d %d", &n, &m);
    int mx = 0;
    if (n < 4 && m < 4) {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          ans[i][j] = 1;
        }
      }
      mx = n * m;
    }
    {
      int sum = 0;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          now[i][j] = pat[i % 4][j % 4];
          sum += now[i][j];
        }
      }
      if (sum > mx) {
        for (int i = 0; i < n; ++i) {
          for (int j = 0; j < m; ++j) {
            ans[i][j] = now[i][j];
          }
        }
        mx = sum;
      }
    }
    {
      int sum = 0;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          now[i][j] = patt[i % 4][j % 4];
          sum += now[i][j];
        }
      }
      if (sum > mx) {
        for (int i = 0; i < n; ++i) {
          for (int j = 0; j < m; ++j) {
            ans[i][j] = now[i][j];
          }
        }
        mx = sum;
      }
    }
    printf("%d\n", mx);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        printf("%d", ans[i][j]);
      }
      puts("");
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5868kb

input:

3
2 2
3 4
3 8

output:

4
11
11
9
1011
1101
1110
18
10111011
11011101
11101110

result:

wrong answer 1s are not connected. (test case 2)