Task: | Shakki |
Sender: | |
Submission time: | 2015-12-04 20:48:13 +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.05 s | 1 | details |
#3 | WRONG ANSWER | 0.06 s | 1 | details |
#4 | WRONG ANSWER | 0.05 s | 1 | details |
#5 | WRONG ANSWER | 0.05 s | 1 | details |
#6 | WRONG ANSWER | 0.05 s | 1 | details |
#7 | WRONG ANSWER | 0.06 s | 1 | details |
#8 | WRONG ANSWER | 0.05 s | 1 | details |
#9 | WRONG ANSWER | 0.06 s | 1 | details |
#10 | WRONG ANSWER | 0.05 s | 1 | details |
#11 | WRONG ANSWER | 0.06 s | 2 | details |
#12 | WRONG ANSWER | 0.05 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.05 s | 2 | details |
#19 | WRONG ANSWER | 0.06 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.06 s | 3 | details |
#26 | WRONG ANSWER | 0.05 s | 3 | details |
#27 | WRONG ANSWER | 0.05 s | 3 | details |
#28 | WRONG ANSWER | 0.06 s | 3 | details |
#29 | WRONG ANSWER | 0.04 s | 3 | details |
#30 | WRONG ANSWER | 0.05 s | 3 | details |
#31 | WRONG ANSWER | 0.06 s | 4 | details |
#32 | WRONG ANSWER | 0.05 s | 4 | details |
#33 | WRONG ANSWER | 0.05 s | 4 | details |
#34 | WRONG ANSWER | 0.06 s | 4 | details |
#35 | WRONG ANSWER | 0.06 s | 4 | details |
#36 | WRONG ANSWER | 0.05 s | 4 | details |
#37 | WRONG ANSWER | 0.06 s | 4 | details |
#38 | WRONG ANSWER | 0.06 s | 4 | details |
#39 | WRONG ANSWER | 0.05 s | 4 | details |
#40 | WRONG ANSWER | 0.05 s | 4 | details |
Code
#include <bits/stdc++.h> #define F first #define S second using namespace std; typedef long long ll; typedef long double ld; string s[10]; string ss[10]; vector<pair<int, int> > v; void pr(){ for (int i=0;i<8;i++){ cout<<s[i]<<endl; } cout<<endl; } void turn(int y, int x){ assert(y>=0); assert(x>=0); assert(y<7); assert(x<7); v.push_back({x+1, y+1}); char t=s[y][x]; s[y][x]=s[y+1][x]; s[y+1][x]=s[y+1][x+1]; s[y+1][x+1]=s[y][x+1]; s[y][x+1]=t; } int checkh(int y){ int c=0; for (int i=0;i<=y;i++){ for (int j=0;j<8;j++){ if (s[i][j]=='M') c++; else c--; } } return c; } int checkv(int x){ int c=0; for (int i=0;i<=x;i++){ for (int j=0;j<8;j++){ if (s[j][i]=='M') c++; else c--; } } return c; } int asd(){ for (int i=0;i<7;i++){ for (int ii=0;ii<7;ii++){ if (s[i][ii]=='V'&&s[i][ii+1]=='V'&&s[i+1][ii]=='M'&&s[i+1][ii+1]=='M'){ if (checkh(i)<=-4){ turn(i, ii); turn(i, ii); return 1; } } if (s[i][ii]=='M'&&s[i][ii+1]=='M'&&s[i+1][ii]=='V'&&s[i+1][ii+1]=='V'){ if (checkh(i)>=4){ turn(i, ii); turn(i, ii); return 1; } } } } for (int i=0;i<7;i++){ for (int ii=0;ii<7;ii++){ if (s[i][ii]=='V'&&s[i][ii+1]=='M'&&s[i+1][ii]=='V'&&s[i+1][ii+1]=='M'){ if (checkv(ii)<=-4){ turn(i, ii); turn(i, ii); return 1; } } if (s[i][ii]=='M'&&s[i][ii+1]=='V'&&s[i+1][ii]=='M'&&s[i+1][ii+1]=='V'){ if (checkv(ii)>=4){ turn(i, ii); turn(i, ii); return 1; } } } } return 0; for (int i=0;i<7;i++){ for (int ii=0;ii<7;ii++){ // VV // VM int ts=-1; if (s[i][ii]=='V'&&s[i][ii+1]=='V'&&s[i+1][ii]=='V'&&s[i+1][ii+1]=='M'){ ts=0; } // VV // MV if (s[i][ii]=='V'&&s[i][ii+1]=='V'&&s[i+1][ii]=='M'&&s[i+1][ii+1]=='V'){ ts=1; } // MV // VV if (s[i][ii]=='M'&&s[i][ii+1]=='V'&&s[i+1][ii]=='V'&&s[i+1][ii+1]=='V'){ ts=2; } // VM // VV if (s[i][ii]=='V'&&s[i][ii+1]=='M'&&s[i+1][ii]=='V'&&s[i+1][ii+1]=='V'){ ts=3; } if (ts>-1){ int ns=-1; if (checkv(ii)<=-2) ns=1; if (checkh(i)<=-2) ns=2; if (checkv(ii)>=2) ns=3; if (checkh(i)>=2) ns=0; if (ns>-1){ int t=(ns-ts+4)%4; if (t>0){ for (int j=0;j<t;j++){ turn(i, ii); } return 1; } } } // VV // VM ts=-1; if (s[i][ii]!='V'&&s[i][ii+1]!='V'&&s[i+1][ii]!='V'&&s[i+1][ii+1]!='M'){ ts=0; } // VV // MV if (s[i][ii]!='V'&&s[i][ii+1]!='V'&&s[i+1][ii]!='M'&&s[i+1][ii+1]!='V'){ ts=1; } // MV // VV if (s[i][ii]!='M'&&s[i][ii+1]!='V'&&s[i+1][ii]!='V'&&s[i+1][ii+1]!='V'){ ts=2; } // VM // VV if (s[i][ii]!='V'&&s[i][ii+1]!='M'&&s[i+1][ii]!='V'&&s[i+1][ii+1]!='V'){ ts=3; } if (ts>-1){ int ns=-1; if (checkv(ii)>=2) ns=1; if (checkh(i)>=2) ns=2; if (checkv(ii)<=-2) ns=3; if (checkh(i)<=-2) ns=0; if (ns>-1){ int t=(ns-ts+4)%4; if (t>0){ for (int j=0;j<t;j++){ turn(i, ii); } return 1; } } } } } return 0; } void up(char c, int y){ for (int i=y;i<7;i++){ for (int ii=0;ii<7;ii++){ if (s[i][ii]==c&&s[i][ii+1]==c) continue; if (s[i][ii]!=c&&s[i][ii+1]!=c){ if (s[i+1][ii]==c){ turn(i, ii); return; } if (s[i+1][ii+1]==c){ turn(i, ii); turn(i, ii); return; } } if (s[i][ii]==c){ if (s[i+1][ii]==c){ turn(i, ii); return; } } if (s[i][ii+1]==c){ if (s[i+1][ii]==c&&s[i+1][ii+1]==c){ turn(i, ii); turn(i, ii); return; } if (s[i+1][ii+1]==c){ turn(i, ii); turn(i, ii); turn(i, ii); return; } } } } } void left(char c, int y, int x){ for (int ii=x;ii<7;ii++){ if (s[y][ii]==c&&s[y+1][ii]==c) continue; if (s[y][ii]!=c&&s[y+1][ii]!=c){ if (s[y+1][ii+1]==c){ turn(y, ii); return; } if (s[y+1][ii]==c){ turn(y, ii); turn(y, ii); return; } } if (s[y+1][ii]==c){ if (s[y+1][ii+1]==c){ turn(y, ii); return; } } if (s[y][ii]==c){ if (s[y][ii+1]==c&&s[y+1][ii+1]==c){ turn(y, ii); turn(y, ii); return; } if (s[y][ii+1]==c){ turn(y, ii); turn(y, ii); turn(y, ii); return; } } } } void gen(int t){ for (int i=0;i<t;i++){ int a=rand()%7; int b=rand()%7; turn(a, b); } v.clear(); } void trs(){ v.clear(); for (int i=0;i<8;i++){ s[i]=ss[i]; } gen(100); for (int i=0;i<7;i++){ while (1){ int c=0; for (int ii=0;ii<8;ii++){ if (s[i][ii]=='V') c++; else c--; } if (c==0) break; if (c>0){ up('M', i); } else{ up('V', i); } } } for (int i=0;i<8;i+=2){ for (int ii=0;ii<7;ii++){ while (1){ if (s[i][ii]=='V'&&s[i+1][ii]=='V'){ left('M', i, ii); } else if(s[i][ii]=='M'&&s[i+1][ii]=='M'){ left('V', i, ii); } else{ break; } //cout<<i<<" "<<ii<<endl; //pr(); } } } //pr(); for (int i=0;i<8;i+=2){ for (int ii=0;ii<6;ii++){ while (1){ if (s[i][ii]==s[i][ii+1]&&s[i][ii+1]==s[i][ii+2]){ turn(i, ii+1); turn(i, ii+1); } else{ break; } //cout<<i<<" "<<ii<<endl; //pr(); } } } //pr(); for (int i=0;i<8;i+=2){ for (int ii=0;ii<6;ii++){ while (1){ if (s[i][ii]==s[i][ii+1]){ for (int j=ii+1;j<7;j+=2){ if (s[i][j]==s[i][j+1]){ turn(i, j); turn(i, j); } else{ turn(i, j); } } } else{ break; } //cout<<i<<" "<<ii<<endl; //pr(); } } } for (int i=0;i<7;i++){ for (int ii=0;ii<7;ii++){ if (s[i][ii]==s[i][ii+1]) return; if (s[i][ii]==s[i+1][ii]) return; } } for (int i=0;i<8;i+=2){ for (int ii=0;ii<8;ii+=2){ if (s[i][ii]!='M') turn(i, ii); } } cout<<v.size()<<endl; for (auto vv:v){ cout<<vv.F<<" "<<vv.S<<endl; } exit(0); } int main(){ srand(time(0)); ios_base::sync_with_stdio(0); cin.tie(0); for (int i=0;i<8;i++){ cin>>ss[i]; s[i]=ss[i]; } //gen(1000); while (1){ trs(); } }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVVMVV MMVVMVVV MMVVMMMM MVVVMVVM MVVVVMVM ... |
correct output |
---|
100000 |
user output |
---|
71 2 3 1 4 1 4 3 4 ... |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVMVVMMV VVMMVVVV VMMVMMVM MVVVVMVM MVMVMMVM ... |
correct output |
---|
100000 |
user output |
---|
55 3 2 3 2 1 3 3 3 ... |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMMVMVV MMMVMVMV VMMVMVVM VVVMVMMV MVMVMVMV ... |
correct output |
---|
100000 |
user output |
---|
99 1 2 2 4 2 3 2 4 ... |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
VVVMVMVV VMMVMVMM MVVMMVMV VMVMMVMM MMVVMMVM ... |
correct output |
---|
100000 |
user output |
---|
58 1 1 1 2 1 3 1 3 ... |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVMVVMMM VVMMVVMV MVVMVVMM VMVMVMMV MMVMVVVM ... |
correct output |
---|
100000 |
user output |
---|
98 1 2 3 2 3 2 4 2 ... |
Test 6
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMVVM VVMMVVMM MMMVMVVM VMMVMMVM MVMVMMMV ... |
correct output |
---|
100000 |
user output |
---|
95 1 2 3 4 3 4 3 5 ... |
Test 7
Group: 1
Verdict: WRONG ANSWER
input |
---|
MVVVVMMM MMMMMMMM VVVVVMMV MMVVMVVM VMVVVVMV ... |
correct output |
---|
100000 |
user output |
---|
106 2 1 2 1 1 2 1 2 ... |
Test 8
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMVMM MMMVVMMM MVVVVVVV VVVVMMMV MVVVMVVM ... |
correct output |
---|
100000 |
user output |
---|
69 1 1 3 3 3 3 1 5 ... |
Test 9
Group: 1
Verdict: WRONG ANSWER
input |
---|
VVVVVMMM MMVVVVVV MVVVMMMM VVMVVVVM VMMVMVMM ... |
correct output |
---|
100000 |
user output |
---|
92 2 1 1 2 1 2 3 2 ... |
Test 10
Group: 1
Verdict: WRONG ANSWER
input |
---|
VMMVMMMM VVMVVVVV VMMVMVMV VMMVMVMM VVVMMMMM ... |
correct output |
---|
100000 |
user output |
---|
66 1 1 3 1 3 4 1 6 ... |
Test 11
Group: 2
Verdict: WRONG ANSWER
input |
---|
VMVMVVMM MMVMVVMM VMVVVMMV VVVMVMVM VVMMVVMM ... |
correct output |
---|
25000 |
user output |
---|
66 1 2 1 3 1 4 1 5 ... |
Test 12
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVMVVMVV VMMVVMVM VMVVVMMM VMMMMVVM MMVVVMMM ... |
correct output |
---|
25000 |
user output |
---|
66 3 4 3 4 1 6 1 6 ... |
Test 13
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVMMVVV MMVVMVMM VVVMVMVV VMVMMMMM MVVMMVMV ... |
correct output |
---|
25000 |
user output |
---|
87 2 1 2 1 2 1 4 1 ... |
Test 14
Group: 2
Verdict: WRONG ANSWER
input |
---|
VVMMMVMV VMVVVMVV VVMVVVMM MVVMVMVM MMVVMMMM ... |
correct output |
---|
25000 |
user output |
---|
81 1 1 4 1 1 2 1 2 ... |
Test 15
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVMVVV MMMMVMMM MVMMMVVM MMVVVMVM VMVVVMMV ... |
correct output |
---|
25000 |
user output |
---|
63 1 1 1 1 1 2 5 3 ... |
Test 16
Group: 2
Verdict: WRONG ANSWER
input |
---|
VMMVMVVM VMMVVVVV MVMVMMVM VMMVVVMV VVMVMMVM ... |
correct output |
---|
25000 |
user output |
---|
75 1 2 1 3 2 4 2 4 ... |
Test 17
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVMMVVM MVVVMMMV MVVMMVVM VMMVMVMV VMMVMMMM ... |
correct output |
---|
25000 |
user output |
---|
82 1 1 1 1 1 2 2 2 ... |
Test 18
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVMMVVMM VVMMMMVV VMVVVVVM MVMMMVMV VMVVVMVM ... |
correct output |
---|
25000 |
user output |
---|
78 2 2 2 2 1 3 1 5 ... |
Test 19
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVVVVV VMMVMVVM VMVMMMMV MVMVMMMM MMVVVMMM ... |
correct output |
---|
25000 |
user output |
---|
103 2 3 2 3 1 2 1 2 ... |
Test 20
Group: 2
Verdict: WRONG ANSWER
input |
---|
MVVVMMMM MMVMMVMV MVVVVVMM VVMMMVVM VVVMVMVV ... |
correct output |
---|
25000 |
user output |
---|
91 1 1 1 1 4 2 5 2 ... |
Test 21
Group: 3
Verdict: WRONG ANSWER
input |
---|
VMVVMVMM MMMMVMMV VVVMVVVV MVMVMVVM VMMVMMMM ... |
correct output |
---|
5000 |
user output |
---|
101 1 1 1 1 3 1 3 1 ... |
Test 22
Group: 3
Verdict: WRONG ANSWER
input |
---|
VVVVVVMM MMMVMMVV VVVVVVMV MMMVMVVV MVVMMMMV ... |
correct output |
---|
5000 |
user output |
---|
91 1 1 4 2 1 3 2 3 ... |
Test 23
Group: 3
Verdict: WRONG ANSWER
input |
---|
MMVMVMVV MMVVMVVM VMMVVMVM MMMMMMVV MVVVVMVM ... |
correct output |
---|
5000 |
user output |
---|
94 1 1 1 1 1 2 1 2 ... |
Test 24
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVMVVMVM VVMVVMVM MMMMVMVV MVVMMVVV MMMMMVVV ... |
correct output |
---|
5000 |
user output |
---|
80 2 1 5 2 1 3 1 7 ... |
Test 25
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVVVMVVM MMMMVVMV VMMVMMVV VVMVMVMV MVMMMVMM ... |
correct output |
---|
5000 |
user output |
---|
75 1 1 1 1 4 1 1 2 ... |
Test 26
Group: 3
Verdict: WRONG ANSWER
input |
---|
VMVMVVVM MMMVVVMM MMVVVVVM VVVVMMVV VMMVVMMV ... |
correct output |
---|
5000 |
user output |
---|
90 1 1 2 1 2 1 2 1 ... |
Test 27
Group: 3
Verdict: WRONG ANSWER
input |
---|
MMVMMVVM MVVVMVMV MVVVMVVM VMVMMMVV VMMVVVVV ... |
correct output |
---|
5000 |
user output |
---|
58 3 4 1 5 4 5 1 6 ... |
Test 28
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVMMVMMV VMVMMMVV MMMMVVMV VVVVMMMM MMMVMMVV ... |
correct output |
---|
5000 |
user output |
---|
91 2 1 4 1 4 1 1 2 ... |
Test 29
Group: 3
Verdict: WRONG ANSWER
input |
---|
VVVVMVMV MMMVVMVM MVVVMVMV VVVMVVMM VMMMMMVV ... |
correct output |
---|
5000 |
user output |
---|
82 3 1 2 2 1 3 1 3 ... |
Test 30
Group: 3
Verdict: WRONG ANSWER
input |
---|
MVVVMVVV MMVVMMMM MVVVVVVV MVMVMMMV VMMMVMMM ... |
correct output |
---|
5000 |
user output |
---|
75 1 3 1 4 2 4 2 4 ... |
Test 31
Group: 4
Verdict: WRONG ANSWER
input |
---|
MVMMVMMV VVVMMVVV VMMVVMMV VVMMMVVM VVVMMMVV ... |
correct output |
---|
250 |
user output |
---|
78 1 2 1 5 1 5 1 6 ... |
Test 32
Group: 4
Verdict: WRONG ANSWER
input |
---|
VVMMVVVM VMVVMMVV VMMMMMMV VVMVMVVV VMMVMVMM ... |
correct output |
---|
250 |
user output |
---|
77 3 2 1 3 1 5 1 5 ... |
Test 33
Group: 4
Verdict: WRONG ANSWER
input |
---|
MMVVMVMV VVVMVMMM VVVVMVMM MVVMVVMV VMMVMVVM ... |
correct output |
---|
250 |
user output |
---|
84 2 1 3 2 3 2 3 2 ... |
Test 34
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMVMVVMV MVVMMMMM MMVVMMMM VMVMVVVM VMMMVVVM ... |
correct output |
---|
250 |
user output |
---|
109 1 1 1 1 4 1 4 1 ... |
Test 35
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMVMVMMM VMMVVVMM MMVMVMMM MVMMVVVV VMMVMMMV ... |
correct output |
---|
250 |
user output |
---|
127 5 1 5 1 6 1 6 1 ... |
Test 36
Group: 4
Verdict: WRONG ANSWER
input |
---|
MVMVMVMM MVMVMMMV MMVVVVMM MVMVVVVV VMMMVVMM ... |
correct output |
---|
250 |
user output |
---|
68 1 1 1 1 1 2 1 2 ... |
Test 37
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMMMVMM VVMMMVMV VMVVVVVV MVMMMVVM VMVMMVVM ... |
correct output |
---|
250 |
user output |
---|
84 1 1 4 2 4 2 4 2 ... |
Test 38
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMVMVMV VVMVMVMM MMMVMVMM MVVVVMMM MMVVVMVV ... |
correct output |
---|
250 |
user output |
---|
116 1 1 1 1 1 1 2 2 ... |
Test 39
Group: 4
Verdict: WRONG ANSWER
input |
---|
MMMMMVMV MVVMMMMV VMVVVVMM VMVVVMMV MVMMMVMM ... |
correct output |
---|
250 |
user output |
---|
71 1 3 2 4 4 4 4 4 ... |
Test 40
Group: 4
Verdict: WRONG ANSWER
input |
---|
VMMMMMMV VMMVVVVV MVMMVMMV MVVVVMMV MVVVVMMM ... |
correct output |
---|
250 |
user output |
---|
81 2 4 4 4 1 5 1 5 ... |