QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#171490#7184. Transport Plusesucup-team1266#WA 1ms3668kbC++201.2kb2023-09-09 17:04:312023-09-09 17:04:31

Judging History

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

  • [2023-09-09 17:04:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2023-09-09 17:04:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int MAX = 1e5 + 10, inf = 2e9, mod = 998244353;

vector<pair<int, int>> ans;
int N, M;
void solve(){
	cin >> N >> M;
	int n = N, m = M, x = 1, y = 1;
	while (1){
		if (n == 0 or m == 0 or x > N or y > M) break;
		if (n < m){
			if (n == 1){
				for (int i = y; i <= y + m - 1; ++ i) ans.push_back({x, i});
				break;
			}
			for (int i = x; i <= x + n - 1; ++ i) ans.push_back({i, y});
			y += n, m -= n;
		}
		else if (n > m){
			if (m == 1){
				for (int i = x; i <= x + n - 1; ++ i) ans.push_back({i, y});
				break;
			}
			for (int i = y; i <= y + m - 1; ++ i) ans.push_back({x, i});
			x += m, n -= m;
		}
		else{
			for (int i = x; i <= x + m - 1; ++ i) ans.push_back({i, y});
			if (n > 2)
			for (int i = x + 1; i <= x + m - 2; ++ i) ans.push_back({i, y + n - 1});
			break;
		}
	}
	cout << ans.size() << endl;
	//cout << n << ' ' << m << endl;
	for (auto p: ans) cout << p.first << ' ' << p.second << endl;
}
signed main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //cout << fixed << setprecision(10);
    //while (cin >> n)
    //int _;cin >> _;while (_ --)
		solve();
    return 0;
}

详细

Test #1:

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

input:

1 2
1 1
5 3
6 2

output:

2
1 1
1 2

result:

wrong answer step 1: source (1.000000, 1.000000) not on plus (6.000000, 2.000000)