Task: | Shakki |
Sender: | |
Submission time: | 2015-12-06 15:10:54 +0200 |
Language: | C++ |
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.06 s | 1 | details |
#2 | WRONG ANSWER | 0.06 s | 1 | details |
#3 | WRONG ANSWER | 0.05 s | 1 | details |
#4 | WRONG ANSWER | 0.07 s | 1 | details |
#5 | WRONG ANSWER | 0.06 s | 1 | details |
#6 | WRONG ANSWER | 0.06 s | 1 | details |
#7 | WRONG ANSWER | 0.05 s | 1 | details |
#8 | WRONG ANSWER | 0.05 s | 1 | details |
#9 | WRONG ANSWER | 0.05 s | 1 | details |
#10 | WRONG ANSWER | 0.05 s | 1 | details |
#11 | WRONG ANSWER | 0.06 s | 2 | details |
#12 | WRONG ANSWER | 0.09 s | 2 | details |
#13 | WRONG ANSWER | 0.05 s | 2 | details |
#14 | WRONG ANSWER | 0.06 s | 2 | details |
#15 | WRONG ANSWER | 0.05 s | 2 | details |
#16 | WRONG ANSWER | 0.06 s | 2 | details |
#17 | WRONG ANSWER | 0.05 s | 2 | details |
#18 | WRONG ANSWER | 0.06 s | 2 | details |
#19 | WRONG ANSWER | 0.05 s | 2 | details |
#20 | WRONG ANSWER | 0.06 s | 2 | details |
#21 | WRONG ANSWER | 0.05 s | 3 | details |
#22 | WRONG ANSWER | 0.05 s | 3 | details |
#23 | WRONG ANSWER | 0.05 s | 3 | details |
#24 | WRONG ANSWER | 0.05 s | 3 | details |
#25 | WRONG ANSWER | 0.05 s | 3 | details |
#26 | WRONG ANSWER | 0.06 s | 3 | details |
#27 | WRONG ANSWER | 0.06 s | 3 | details |
#28 | WRONG ANSWER | 0.05 s | 3 | details |
#29 | WRONG ANSWER | 0.05 s | 3 | details |
#30 | WRONG ANSWER | 0.06 s | 3 | details |
#31 | WRONG ANSWER | 0.05 s | 4 | details |
#32 | WRONG ANSWER | 0.06 s | 4 | details |
#33 | WRONG ANSWER | 0.05 s | 4 | details |
#34 | WRONG ANSWER | 0.05 s | 4 | details |
#35 | WRONG ANSWER | 0.05 s | 4 | details |
#36 | WRONG ANSWER | 0.05 s | 4 | details |
#37 | WRONG ANSWER | 0.06 s | 4 | details |
#38 | WRONG ANSWER | 0.08 s | 4 | details |
#39 | WRONG ANSWER | 0.06 s | 4 | details |
#40 | WRONG ANSWER | 0.05 s | 4 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:155:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < moves.size() / 2; ++i) ^
Code
#include <vector> #include <iostream> #include <cstdio> #include <unistd.h> using namespace std; int main() { int b[8][8]; vector<int> moves; /*auto print_board = [&]() { for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { cout << b[i][j]; } cout << "\n"; } };*/ auto rot = [&] (int i, int j) { char c = b[i][j]; b[i][j] = b[i+1][j]; b[i+1][j] = b[i+1][j+1]; b[i+1][j+1] = b[i][j+1]; b[i][j+1] = c; moves.push_back(i); moves.push_back(j); //cout << "rot(" << i << "," << j << ")\n"; //print_board(); //cout << "\n"; //sleep(1); }; auto get = [&] (int c, int i, int j) { int i0 = i; int j0 = j; ++i; --j; while (true) { while (j >= 0) { if (b[i][j] == c) { if (i > i0) { rot(i-1, j); --i; } while (j == 0 || j < j0) { rot(i, j); ++j; } if (i == 0) { rot(i, j-1); ++i; } while (j > j0 + 1) { rot(i-1, j-1); --j; } while (i < i0) { rot(i, j-1); ++i; } return; } --j; } --i; j = 7; } }; auto get2 = [&] (int c, int i, int j) { int i0 = i; int j0 = j; ++i; --j; while (true) { while (j >= 0) { if (b[i][j] == c) { if (i > i0) { rot(i-1, j); --i; } while (j == 0 || j < j0) { rot(i, j); ++j; } if (i == 0) { rot(i, j-1); ++i; } while (j > j0 + 1) { rot(i-1, j-1); --j; } while (i < i0) { rot(i, j-1); ++i; } return; } --j; } --i; j = j0 - 1; } }; for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { char c; cin >> c; b[i][j] = (c == 'M' ? 0 : 1); } } //print_board(); //cout << "\n"; for (int i = 6; i > 0; --i) { for (int j = 6; j >= 0; j -= 2) { //cout << "i = " << i << ", j = " << j << "\n"; if (b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]) get(0, i, j); if (!b[i][j] && !b[i+1][j] && !b[i][j+1] && !b[i+1][j+1]) get(1, i, j); while (b[i+1][j] != (i + j) % 2 || b[i+1][j+1] == (i + j) % 2) rot(i, j); } } int i = 0; for (int j = 6; j >= 0; --j) { //cout << "i = " << i << ", j = " << j << "\n"; if (b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]) get2(0, i, j); if (!b[i][j] && !b[i+1][j] && !b[i][j+1] && !b[i+1][j+1]) get2(1, i, j); while (b[i][j+1] != (i + j) % 2 || b[i+1][j+1] == (i + j) % 2) rot(i, j); } if (b[1][0] == 1) { rot(1, 0); rot(1, 0); rot(1, 0); rot(0, 0); rot(0, 0); rot(1, 0); rot(0, 0); } cout << moves.size() / 2 << "\n"; for (int i = 0; i < moves.size() / 2; ++i) cout << moves[i*2] + 1 << " " << moves[i*2 + 1] + 1 << "\n"; //print_board(); //cout << "\n"; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVVMVV MMVVMVVV MMVVMMMM MVVVMVVM MVVVVMVM ... |
correct output |
---|
100000 |
user output |
---|
57 7 5 7 5 7 5 7 1 ... |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVMVVMMV VVMMVVVV VMMVMMVM MVVVVMVM MVMVMMVM ... |
correct output |
---|
100000 |
user output |
---|
61 7 7 7 7 7 3 7 3 ... |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMMVMVV MMMVMVMV VMMVMVVM VVVMVMMV MVMVMVMV ... |
correct output |
---|
100000 |
user output |
---|
74 7 2 7 2 7 1 7 1 ... |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
VVVMVMVV VMMVMVMM MVVMMVMV VMVMMVMM MMVVMMVM ... |
correct output |
---|
100000 |
user output |
---|
62 7 7 7 7 7 7 7 4 ... |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVMVVMMM VVMMVVMV MVVMVVMM VMVMVMMV MMVMVVVM ... |
correct output |
---|
100000 |
user output |
---|
74 7 6 7 6 7 7 7 7 ... |
Test 6
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMVVM VVMMVVMM MMMVMVVM VMMVMMVM MVMVMMMV ... |
correct output |
---|
100000 |
user output |
---|
58 7 7 6 7 6 7 6 2 ... |
Test 7
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVVVVMMM MMMMMMMM VVVVVMMV MMVVMVVM VMVVVVMV ... |
correct output |
---|
100000 |
user output |
---|
79 7 7 7 7 7 7 7 5 ... |
Test 8
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMVMM MMMVVMMM MVVVVVVV VVVVMMMV MVVVMVVM ... |
correct output |
---|
100000 |
user output |
---|
76 7 7 6 5 6 4 6 3 ... |
Test 9
Group: 1
Verdict: WRONG ANSWER
input |
---|
VVVVVMMM MMVVVVVV MVVVMMMM VVMVVVVM VMMVMVMM ... |
correct output |
---|
100000 |
user output |
---|
96 7 7 7 7 7 5 7 5 ... |
Test 10
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMMMM VVMVVVVV VMMVMVMV VMMVMVMM VVVMMMMM ... |
correct output |
---|
100000 |
user output |
---|
75 7 7 7 5 7 3 6 7 ... |
Test 11
Group: 2
Verdict: WRONG ANSWER
input |
---|
VMVMVVMM MMVMVVMM VMVVVMMV VVVMVMVM VVMMVVMM ... |
correct output |
---|
25000 |
user output |
---|
72 7 7 7 3 7 3 7 1 ... |
Test 12
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVMVVMVV VMMVVMVM VMVVVMMM VMMMMVVM MMVVVMMM ... |
correct output |
---|
25000 |
user output |
---|
53 7 7 7 4 7 4 7 5 ... |
Test 13
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVMMVVV MMVVMVMM VVVMVMVV VMVMMMMM MVVMMVMV ... |
correct output |
---|
25000 |
user output |
---|
59 7 7 7 5 7 5 7 5 ... |
Test 14
Group: 2
Verdict: WRONG ANSWER
input |
---|
VVMMMVMV VMVVVMVV VVMVVVMM MVVMVMVM MMVVMMMM ... |
correct output |
---|
25000 |
user output |
---|
78 7 4 7 4 7 1 6 7 ... |
Test 15
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVMVVV MMMMVMMM MVMMMVVM MMVVVMVM VMVVVMMV ... |
correct output |
---|
25000 |
user output |
---|
64 7 5 7 5 7 6 7 7 ... |
Test 16
Group: 2
Verdict: WRONG ANSWER
input |
---|
VMMVMVVM VMMVVVVV MVMVMMVM VMMVVVMV VVMVMMVM ... |
correct output |
---|
25000 |
user output |
---|
60 7 7 7 5 7 1 7 1 ... |
Test 17
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVMMVVM MVVVMMMV MVVMMVVM VMMVMVMV VMMVMMMM ... |
correct output |
---|
25000 |
user output |
---|
62 7 5 7 3 7 3 7 1 ... |
Test 18
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVMMVVMM VVMMMMVV VMVVVVVM MVMMMVMV VMVVVMVM ... |
correct output |
---|
25000 |
user output |
---|
42 6 7 6 6 6 5 6 4 ... |
Test 19
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVVVVV VMMVMVVM VMVMMMMV MVMVMMMM MMVVVMMM ... |
correct output |
---|
25000 |
user output |
---|
70 7 7 7 7 7 7 7 5 ... |
Test 20
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVMMMM MMVMMVMV MVVVVVMM VVMMMVVM VVVMVMVV ... |
correct output |
---|
25000 |
user output |
---|
64 7 5 7 5 7 5 7 2 ... |
Test 21
Group: 3
Verdict: WRONG ANSWER
input |
---|
VMVVMVMM MMMMVMMV VVVMVVVV MVMVMVVM VMMVMMMM ... |
correct output |
---|
5000 |
user output |
---|
36 7 7 7 7 7 5 7 5 ... |
Test 22
Group: 3
Verdict: WRONG ANSWER
input |
---|
VVVVVVMM MMMVMMVV VVVVVVMV MMMVMVVV MVVMMMMV ... |
correct output |
---|
5000 |
user output |
---|
75 7 3 7 3 6 3 6 2 ... |
Test 23
Group: 3
Verdict: WRONG ANSWER
input |
---|
MMVMVMVV MMVVMVVM VMMVVMVM MMMMMMVV MVVVVMVM ... |
correct output |
---|
5000 |
user output |
---|
76 7 7 7 7 7 5 7 5 ... |
Test 24
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVMVVMVM VVMVVMVM MMMMVMVV MVVMMVVV MMMMMVVV ... |
correct output |
---|
5000 |
user output |
---|
93 7 7 7 7 7 7 7 5 ... |
Test 25
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVVVMVVM MMMMVVMV VMMVMMVV VVMVMVMV MVMMMVMM ... |
correct output |
---|
5000 |
user output |
---|
53 7 7 7 7 7 3 6 7 ... |
Test 26
Group: 3
Verdict: WRONG ANSWER
input |
---|
VMVMVVVM MMMVVVMM MMVVVVVM VVVVMMVV VMMVVMMV ... |
correct output |
---|
5000 |
user output |
---|
71 7 7 7 7 7 7 7 5 ... |
Test 27
Group: 3
Verdict: WRONG ANSWER
input |
---|
MMVMMVVM MVVVMVMV MVVVMVVM VMVMMMVV VMMVVVVV ... |
correct output |
---|
5000 |
user output |
---|
78 7 5 7 5 7 5 7 3 ... |
Test 28
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVMMVMMV VMVMMMVV MMMMVVMV VVVVMMMM MMMVMMVV ... |
correct output |
---|
5000 |
user output |
---|
71 7 7 7 7 6 5 6 4 ... |
Test 29
Group: 3
Verdict: WRONG ANSWER
input |
---|
VVVVMVMV MMMVVMVM MVVVMVMV VVVMVVMM VMMMMMVV ... |
correct output |
---|
5000 |
user output |
---|
55 7 7 7 7 7 5 7 5 ... |
Test 30
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVVVMVVV MMVVMMMM MVVVVVVV MVMVMMMV VMMMVMMM ... |
correct output |
---|
5000 |
user output |
---|
77 7 7 7 7 7 5 7 5 ... |
Test 31
Group: 4
Verdict: WRONG ANSWER
input |
---|
MVMMVMMV VVVMMVVV VMMVVMMV VVMMMVVM VVVMMMVV ... |
correct output |
---|
250 |
user output |
---|
58 7 6 7 6 7 7 7 7 ... |
Test 32
Group: 4
Verdict: WRONG ANSWER
input |
---|
VVMMVVVM VMVVMMVV VMMMMMMV VVMVMVVV VMMVMVMM ... |
correct output |
---|
250 |
user output |
---|
64 7 3 7 3 7 1 7 1 ... |
Test 33
Group: 4
Verdict: WRONG ANSWER
input |
---|
MMVVMVMV VVVMVMMM VVVVMVMM MVVMVVMV VMMVMVVM ... |
correct output |
---|
250 |
user output |
---|
66 7 7 7 7 7 7 6 6 ... |
Test 34
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMVMVVMV MVVMMMMM MMVVMMMM VMVMVVVM VMMMVVVM ... |
correct output |
---|
250 |
user output |
---|
65 7 5 7 3 7 3 7 3 ... |
Test 35
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMVMVMMM VMMVVVMM MMVMVMMM MVMMVVVV VMMVMMMV ... |
correct output |
---|
250 |
user output |
---|
86 7 5 7 3 6 7 6 7 ... |
Test 36
Group: 4
Verdict: WRONG ANSWER
input |
---|
MVMVMVMM MVMVMMMV MMVVVVMM MVMVVVVV VMMMVVMM ... |
correct output |
---|
250 |
user output |
---|
62 6 7 6 7 6 7 6 5 ... |
Test 37
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMMMVMM VVMMMVMV VMVVVVVV MVMMMVVM VMVMMVVM ... |
correct output |
---|
250 |
user output |
---|
77 7 5 7 5 7 3 7 3 ... |
Test 38
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMVMVMV VVMVMVMM MMMVMVMM MVVVVMMM MMVVVMVV ... |
correct output |
---|
250 |
user output |
---|
56 7 5 7 5 7 3 7 3 ... |
Test 39
Group: 4
Verdict: WRONG ANSWER
input |
---|
MMMMMVMV MVVMMMMV VMVVVVMM VMVVVMMV MVMMMVMM ... |
correct output |
---|
250 |
user output |
---|
65 7 3 7 3 7 1 7 1 ... |
Test 40
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMMMMMV VMMVVVVV MVMMVMMV MVVVVMMV MVVVVMMM ... |
correct output |
---|
250 |
user output |
---|
64 7 5 7 5 7 5 7 3 ... |