Task: | Unirytmi |
Sender: | stpn129 |
Submission time: | 2023-01-21 15:47:40 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
#4 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4 | details |
#2 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4 | details |
#3 | TIME LIMIT EXCEEDED | -- | 2, 4 | details |
#4 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4 | details |
#5 | WRONG ANSWER | 0.00 s | 3, 4 | details |
#6 | TIME LIMIT EXCEEDED | -- | 2, 3, 4 | details |
#7 | RUNTIME ERROR | 0.40 s | 4 | details |
#8 | RUNTIME ERROR | 0.40 s | 4 | details |
#9 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4 | details |
#10 | TIME LIMIT EXCEEDED | -- | 2, 4 | details |
#11 | WRONG ANSWER | 0.00 s | 3, 4 | details |
#12 | WRONG ANSWER | 0.01 s | 1, 2, 3, 4 | details |
#13 | TIME LIMIT EXCEEDED | -- | 1, 2, 3, 4 | details |
#14 | WRONG ANSWER | 0.00 s | 2, 4 | details |
#15 | TIME LIMIT EXCEEDED | -- | 2, 3, 4 | details |
#16 | WRONG ANSWER | 0.00 s | 4 | details |
#17 | WRONG ANSWER | 0.00 s | 2, 4 | details |
#18 | WRONG ANSWER | 0.00 s | 2, 4 | details |
Code
#include<bits/stdc++.h> using namespace std; void init_code(){ ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } bool cmp (pair<int, int> a, pair<int, int> b) { return a.second < b.second; } const int mod = 1e9 + 7; vector<pair<int, int>> moves = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; int cycle = 0; void dfs(pair<int, int> v, pair<int, int> p, vector<vector<int>>& res, vector<vector<int>>& used, int n, int m) { //cout << v.first << ' ' << v.second << ' ' << used[v.first][v.second] <<'\n'; if (used[v.first][v.second] == 1) { cycle = 1; return; } used[v.first][v.second] = 1; for (auto mv : moves) { int x = v.first + mv.first, y = v.second + mv.second; if (x >= 0 && x < n && y >= 0 && y < m && res[x][y] == 0 && !(x == p.first && y == p.second)) { dfs({x, y}, v, res, used, n, m); } } } void solve() { int n, m; cin >> n >> m; vector<vector<int>> res (n, vector<int> (m)); vector<vector<int>> used (n, vector<int> (m)); int mn = 1 << (n * m); for (int i = 0; i < mn; ++i) { cycle = 0; fill(res.begin(), res.end(), vector<int> (m, 0)); fill(used.begin(), used.end(), vector<int> (m, 0)); int x = i, cnt = 0; while (x > 0) { int t = x % 2; if (t) { int xcoord = cnt / m; int ycoord = cnt % m; res[xcoord][ycoord] = 1; } x >>= 1; cnt++; } int sx = 0, sy = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (res[i][j] == 0) { sx = i; sy = j; break; } } } //cout << sx << ' ' << sy << '\n'; if (res[sx][sy] == 1) { continue; } else { dfs({sx, sy}, {-1, -1}, res, used, n, m); //cout << cycle; int check = !cycle; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (res[i][j] == 0 && used[i][j] == 0) { check = 0; } if (res[i][j] == 1) { for (auto mv : moves) { int x = i + mv.first, y = j + mv.second; if (x >= 0 && x < n && y >= 0 && y < m && res[x][y] == 1) { check = 0; } } } if (check == 0) { break; } } } if (check == 1) { for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (res[i][j] == 0) cout << '.'; else cout << '#'; } cout << '\n'; } cout << '\n'; return; } } } } signed main() { init_code(); int t = 1; //cin >> t; while(t--){ solve(); } return 0; } /* cubbli-guest@dx5-cs-b221-09:~$ cd Code cubbli-guest@dx5-cs-b221-09:~/Code$ ls code code.cpp input.txt output.txt cubbli-guest@dx5-cs-b221-09:~/Code$ g++ code.cpp -o code cubbli-guest@dx5-cs-b221-09:~/Code$ ./code Segmentation fault (core dumped) cubbli-guest@dx5-cs-b221-09:~/Code$ */
Test details
Test 1
Group: 1, 2, 3, 4
Verdict: WRONG ANSWER
input |
---|
3 5 7 5 5 8 12 |
correct output |
---|
2 |
user output |
---|
..#.. .#.#. ..... |
Test 2
Group: 1, 2, 3, 4
Verdict: WRONG ANSWER
input |
---|
3 5 7 5 6 21 22 |
correct output |
---|
2 |
user output |
---|
..#.. .#.#. ..... |
Test 3
Group: 2, 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 127 134 713 491 3778 4129 4563 6372 7347 7... |
correct output |
---|
281 |
user output |
---|
(empty) |
Test 4
Group: 1, 2, 3, 4
Verdict: WRONG ANSWER
input |
---|
15 11 13 11 2 14 17 22 23 25 27 31 32 69 7... |
correct output |
---|
11 |
user output |
---|
(empty) |
Test 5
Group: 3, 4
Verdict: WRONG ANSWER
input |
---|
200 1 2 100 94623 612821 706074 2477208 33... |
correct output |
---|
196 |
user output |
---|
. . . . . ... Truncated |
Test 6
Group: 2, 3, 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 27 30 100 8 183 310 517 819 927 1276 146... |
correct output |
---|
87 |
user output |
---|
(empty) |
Test 7
Group: 4
Verdict: RUNTIME ERROR
input |
---|
1000 71428 72356 221426 109849 411498 1480476 1734215 ... |
correct output |
---|
369 |
user output |
---|
(empty) |
Test 8
Group: 4
Verdict: RUNTIME ERROR
input |
---|
1000 71428 71429 220426 557231 743380 905998 1053927 1... |
correct output |
---|
266 |
user output |
---|
(empty) |
Test 9
Group: 1, 2, 3, 4
Verdict: WRONG ANSWER
input |
---|
74 1 3 3 1 2 4 6 7 8 9 11 13 14 15 16 1... |
correct output |
---|
29 |
user output |
---|
. . . . . ... Truncated |
Test 10
Group: 2, 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 478 479 1426 800 1062 2097 3132 4106 6698 7... |
correct output |
---|
275 |
user output |
---|
(empty) |
Test 11
Group: 3, 4
Verdict: WRONG ANSWER
input |
---|
200 4 5 93 84806 597999 828025 1057335 16... |
correct output |
---|
198 |
user output |
---|
(empty) |
Test 12
Group: 1, 2, 3, 4
Verdict: WRONG ANSWER
input |
---|
9 2 2 1 1 2 3 4 5 6 7 8 9 |
correct output |
---|
3 |
user output |
---|
.. #. .. #. .. ... |
Test 13
Group: 1, 2, 3, 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
30 5 7 5 2 3 4 5 6 10 11 16 19 20 21 23... |
correct output |
---|
19 |
user output |
---|
(empty) |
Test 14
Group: 2, 4
Verdict: WRONG ANSWER
input |
---|
1000 1 1000000 1 176 273 1016 1529 1642 2291 30... |
correct output |
---|
1000 |
user output |
---|
. . . . . ... Truncated |
Test 15
Group: 2, 3, 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 3 7 69 334 429 1639 1775 1840 1971 21... |
correct output |
---|
110 |
user output |
---|
(empty) |
Test 16
Group: 4
Verdict: WRONG ANSWER
input |
---|
1000 1 2 250000 500004 1000007 1500010 2000013... |
correct output |
---|
1000 |
user output |
---|
. . . . . ... Truncated |
Test 17
Group: 2, 4
Verdict: WRONG ANSWER
input |
---|
1000 1 2 497 998 1995 2992 3989 4986 5983 6... |
correct output |
---|
1000 |
user output |
---|
. . . . . ... Truncated |
Test 18
Group: 2, 4
Verdict: WRONG ANSWER
input |
---|
1000 1 704731 20372 1901 3947 4720 5745 6005 6413 ... |
correct output |
---|
989 |
user output |
---|
. . . . . ... Truncated |