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