QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#538904#7178. BishopsMax_FWLWA 0ms3632kbC++141.0kb2024-08-31 13:32:282024-08-31 13:32:28

Judging History

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

  • [2024-08-31 13:32:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-08-31 13:32:28]
  • 提交

answer

#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
using namespace std;

typedef pair<int, int> pii;
int n, m, fl = 0;
vector<pii> ans;

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n >> m;
	
	if (n > m){
		swap(n, m);
		fl = 1;
	}
	
	if (n == 1){
		for (int i = 1; i <= n; i++)
			ans.push_back(mp(1, i));
	}if (n == m){
		for (int i = 1; i <= n; i++)
			ans.push_back(mp(i, 1));
		
		for (int i = 2; i < n; i++)
			ans.push_back(mp(i, m));
	}else{
		for (int i = 1; i <= n; i++){
			ans.push_back(mp(i, 1));
			ans.push_back(mp(i, m));
		}
		
		if (n & 1){
			for (int i = (n >> 1) + 2; i <= m - (n >> 1) - 1; i++)
				ans.push_back(mp(i, (n + 1) >> 1));
		}else{
			for (int i = (n >> 1) + 2; i <= m - (n >> 1) - 1; i += 2){
				ans.push_back(mp(i, n >> 1));
				ans.push_back(mp(i, (n >> 1) + 1));
			}
		}
	}
	
	cout << ans.size() << endl;
	for (auto pos : ans)
		cout << (fl ? pos.se : pos.fi) << " " << (fl ? pos.fi : pos.se) << endl;
	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3632kb

input:

2 5

output:

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

result:

wrong answer Integer parameter [name=x] equals to 3, violates the range [1, 2]