QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#171490 | #7184. Transport Pluses | ucup-team1266# | WA | 1ms | 3668kb | C++20 | 1.2kb | 2023-09-09 17:04:31 | 2023-09-09 17:04:31 |
Judging History
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)