Task: | Hypyt |
Sender: | ArktinenKarpalo |
Submission time: | 2025-10-18 12:02:42 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 30 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 30 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.09 s | 2 | details |
#4 | WRONG ANSWER | 0.24 s | 2 | details |
#5 | WRONG ANSWER | 0.41 s | 2 | details |
Code
#include <bits/stdc++.h> using namespace std; typedef vector<bitset<55>> VK; typedef vector<bitset<101>> VS; typedef vector<pair<int, int>> VA; bool oob(int x, int y, int n, int m) { return x < 0 || y < 0 || x >= n || y >= m; } bool hau(int x, int y, int n, int m, VS &siirtyma, VK &kautu, VA &A, int ps, int rem) { if (rem == 0) return true; vector<pair<int, int>> W; int mx = ps - 1; for (auto i : {x - mx, x - mx - 1, x + mx, x + mx + 1, x - mx - 2, x + mx + 2}) { if (i < 0 || i >= n) continue; int ofx = abs(i - x); for (int j = 0; j < m; j++) { int ofy = abs(j - y); if (kautu[i][j]) continue; if (siirtyma[i - x + 50][j - y + 50]) continue; int lk = max(ofx, ofy); if (lk > mx) { W.clear(); mx = lk; } if (lk == mx && W.size() < 2) W.push_back({i, j}); } } for (int i = 0; i < n; i++) { int ofx = abs(i - x); for (auto j : {y - mx, y - mx - 1, y + mx, y + mx + 1, y + mx + 2, y - mx - 2}) { if (j < 0 || j >= m) continue; int ofy = abs(j - y); if (kautu[i][j]) continue; if (siirtyma[i - x + 50][j - y + 50]) continue; int lk = max(ofx, ofy); if (lk > mx) { W.clear(); mx = lk; } if (lk == mx && W.size() < 2) W.push_back({i, j}); } } ps = mx; for (auto &u : W) { int i = u.first; int j = u.second; siirtyma[i - x + 50][j - y + 50] = 1; kautu[i][j] = 1; if (hau(i, j, n, m, siirtyma, kautu, A, ps, rem - 1)) { A.push_back({i - x, j - y}); return true; } kautu[i][j] = 0; siirtyma[i - x + 50][j - y + 50] = 0; } cout << "notok2" << endl; return false; } void solve(int n, int m) { VS siirtyma(101); VK kautu(55); VA a; kautu[0][0] = 1; if (!hau(0, 0, n, m, siirtyma, kautu, a, max(n, m), n * m - 1)) { cout << "QAQ" << endl; exit(1); } reverse(a.begin(), a.end()); for (auto u : a) cout << u.first << " " << u.second << "\n"; } int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; solve(n, m); } }
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 0 -3 4 0 -4 3 4 -4 -3 ... |
Test 3
Group: 2
Verdict: WRONG ANSWER
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: WRONG ANSWER
input |
---|
100 46 47 41 39 46 36 46 30 ... |
correct output |
---|
45 46 -45 -45 45 44 -45 -43 45 42 ... |
user output |
---|
notok2 notok2 notok2 0 46 45 -46 ... |
Test 5
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 50 50 50 50 50 50 50 50 ... |
correct output |
---|
49 49 -49 -48 49 47 -49 -46 49 45 ... |
user output |
---|
notok2 49 0 -48 49 0 -49 48 49 ... |