QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#250112#7178. Bishopskilo_tobo_tarjen#WA 0ms3612kbC++14919b2023-11-12 21:28:222023-11-12 21:28:23

Judging History

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

  • [2023-11-12 21:28:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2023-11-12 21:28:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const char el = '\n';
typedef long long ll;
bool flp;
void submit(int x, int y) {
  if (flp)
    cout << y << ' ' << x << el;
  else
    cout << x << ' ' << y << el;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);
  int n, m;
  cin >> n >> m;
  if (n == m) {
    cout << n + m - 2 << el;
    for (int i = 1; i < n; i++) submit(1, i);
    for (int i = 1; i < n; i++) submit(n, i + 1);
    return 0;
  }
  cout << n + m - 1 - (n % 2 == 0 && m % 2 == 0) << el;
  if (n < m) {
    flp = true;
    swap(n, m);
  }
  for (int i = 1; i <= m; i++) submit(1, i);
  for (int i = 1; i <= m; i++) submit(n, i);
  int k = (m + 1) / 2;
  if (m & 1) {
    for (int i = k + 1; i <= n - k; i++) submit(i, k);
    return 0;
  }
  for (int i = k + 2; i < n - k; i += 2) submit(i, k), submit(i, k + 1);
  return 0;
}

詳細信息

Test #1:

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

input:

2 5

output:

6
1 1
2 1
1 5
2 5
1 3
2 3

result:

ok n: 2, m: 5, bishops: 6

Test #2:

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

input:

5 5

output:

8
1 1
1 2
1 3
1 4
5 2
5 3
5 4
5 5

result:

wrong answer Dif diagonals are not distinct