Submission details
Task:Hypyt
Sender:MojoLake
Submission time:2025-10-19 10:59:01 +0300
Language:C++ (C++20)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED30
#2ACCEPTED70
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2details
#2ACCEPTED0.00 s1, 2details
#3ACCEPTED0.01 s2details
#4ACCEPTED0.03 s2details
#5ACCEPTED0.04 s2details

Code

#include <bits/stdc++.h>

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

using namespace std;
using ll = long long;

const int inf = 1e9;
const ll LLInf = 1e18;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> pos;

    bool flag = 0;
    for (int lo = 0, hi = n - 1; lo <= hi; ++lo, --hi) {
        for (int le = 0, ri = m - 1; le < m; ++le, --ri) {
            if (lo == hi && ri <= le) {
                if (le == ri) pos.emplace_back(lo, ri);
                break;
            }
            if (flag) {
                pos.emplace_back(lo, ri);
                pos.emplace_back(hi, le);
            } else {
                pos.emplace_back(lo, le);
                pos.emplace_back(hi, ri);
            }
        }
        flag = !flag;
    }

    vector<pair<int, int>> ans;
    for (int i = 1; i < sz(pos); ++i) {
        ans.emplace_back(pos[i].first - pos[i - 1].first, pos[i].second - pos[i - 1].second);
    }

    for (auto [y, x] : ans) {
        cout << y << " " << x << "\n";
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int t; cin >> t;
    while (t--) solve();
}

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
25
1 1
1 2
1 3
1 4
...

correct output
0 1
0 2
0 -1
0 3
0 -2
...

user output
0 1
0 2
0 -1
0 3
0 -2
...

Test 2

Group: 1, 2

Verdict: ACCEPTED

input
100
5 5
5 5
5 5
5 5
...

correct output
4 4
-4 -3
4 2
-4 -1
4 0
...

user output
4 4
-4 -3
4 2
-4 -1
4 0
...

Test 3

Group: 2

Verdict: ACCEPTED

input
100
1 25
20 40
5 34
50 34
...

correct output
0 24
0 -23
0 22
0 -21
0 20
...

user output
0 24
0 -23
0 22
0 -21
0 20
...

Test 4

Group: 2

Verdict: ACCEPTED

input
100
46 47
41 39
46 36
46 30
...

correct output
45 46
-45 -45
45 44
-45 -43
45 42
...

user output
45 46
-45 -45
45 44
-45 -43
45 42
...

Test 5

Group: 2

Verdict: ACCEPTED

input
100
50 50
50 50
50 50
50 50
...

correct output
49 49
-49 -48
49 47
-49 -46
49 45
...

user output
49 49
-49 -48
49 47
-49 -46
49 45
...