QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#220624#6309. Aqreucup-team1883#WA 1ms5976kbC++141.5kb2023-10-20 16:40:092023-10-20 16:40:09

Judging History

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

  • [2023-10-20 16:40:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5976kb
  • [2023-10-20 16:40:09]
  • 提交

answer

#include <iostream>

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

const int patt[4][4] = {
  {1, 1, 1, 0},
  {1, 1, 0, 1},
  {0, 1, 1, 1},
  {1, 0, 1, 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: 5976kb

input:

3
2 2
3 4
3 8

output:

4
11
11
9
1101
1110
1011
18
11011101
11101110
10111011

result:

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