CSES - Putka Open 2015 – 6/6 - Results
Submission details
Task:Shakki
Sender:
Submission time:2015-12-06 17:23:50 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
Test results
testverdicttimegroup
#10.19 s1details
#20.19 s1details
#30.10 s1details
#40.20 s1details
#50.06 s1details
#60.08 s1details
#70.18 s1details
#80.18 s1details
#90.19 s1details
#100.19 s1details
#110.14 s2details
#120.07 s2details
#130.19 s2details
#140.15 s2details
#150.14 s2details
#160.15 s2details
#170.18 s2details
#180.06 s2details
#190.19 s2details
#200.19 s2details
#210.15 s3details
#220.18 s3details
#230.08 s3details
#240.07 s3details
#250.07 s3details
#260.19 s3details
#270.20 s3details
#280.07 s3details
#290.18 s3details
#300.18 s3details
#310.14 s4details
#320.19 s4details
#330.19 s4details
#340.09 s4details
#350.19 s4details
#360.06 s4details
#370.09 s4details
#380.19 s4details
#390.07 s4details
#400.09 s4details

Compiler report

input/code.cpp: In function 'void print_board(std::vector<std::vector<char> >&)':
input/code.cpp:85:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int64_t i=0;i<board.size();i++) {
                    ^
input/code.cpp:86:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t j=0;j<board.size();j++) {
                      ^
input/code.cpp: In function 'int main()':
input/code.cpp:723:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int64_t i=0;i<moves.size();i++) {
                    ^

Code

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#include<utility>

using namespace std;

void rotate(vector<vector<char>> &b, int64_t x, int64_t y, int d) {
  if(d == 1) {
    char c=b[x][y];
    b[x][y] = b[x][y+1];
    b[x][y+1] = b[x+1][y+1];
    b[x+1][y+1] = b[x+1][y];
    b[x+1][y]=c;
  } else {
    char c=b[x][y];
    b[x][y] = b[x+1][y];
    b[x+1][y] = b[x+1][y+1];
    b[x+1][y+1] = b[x][y+1];
    b[x][y+1] = c;
  }
}


int64_t hsh(const vector<vector<char>> &b) {
  int64_t h=1;
  for(int64_t i=0;i<4;i++) {
    for(int64_t j=0;j<4;j++) {
      if(b[i][j] == 'M') {
        h=2*h+1;
      } else {
        h=2*h;
      }
    }
  }
  return h;
}

bool fine(const vector<vector<char>> &b) {
  for(int64_t i=0;i<3;i++) {
    for(int64_t j=0;j<3;j++) {
      if(b[i][j] == b[i+1][j] || b[i][j] == b[i][j+1]) {
        return false;
      }
    }
    if(b[i][3] == b[i+1][3]) return false;
  }
  for(int64_t j=0;j<3;j++) {
    if(b[3][j] == b[3][j+1]) return false;
  }
  return true;
}

vector<pair<int64_t,int64_t>> bfs(vector<vector<char>> &b, map<int64_t,pair<pair<int64_t,int64_t>,int64_t>> &found, int64_t hshstart) {
  if(fine(b)) {
    int64_t tmp=hsh(b);
    vector<pair<int64_t,int64_t>> moves;
    while(tmp != hshstart) {
      moves.push_back(found[tmp].first);
      tmp=found[tmp].second;
    }
    return moves;
  }
  int64_t oldhsh=hsh(b);
  for(int64_t i=0;i<3;i++) {
    for(int64_t j=0;j<3;j++) {
      rotate(b, i, j, 1);
      if(found.find(hsh(b)) == found.end()) {
        found[hsh(b)]=make_pair(make_pair(i, j), oldhsh);
        vector<pair<int64_t,int64_t>> res=bfs(b, found, hshstart);
        if(res.size() > 0) return res;
      }
      rotate(b, i, j, -1);
    }
  }
  return vector<pair<int64_t,int64_t>>();
}

void print_board(vector<vector<char>> &board) {
  for(int64_t i=0;i<board.size();i++) {
    for(int64_t j=0;j<board.size();j++) {
      cout << board[j][i];
    }
    cout << '\n';
  }
}

int main(void) {
  vector<vector<char>> board(8,vector<char>(8));
  for(int64_t i=0;i<8;i++) {
    for(int64_t j=0;j<8;j++) {
      char c;
      cin >> c;
      board[j][i]=c;
    }
  }

  vector<pair<int64_t,int64_t>> moves;

  int64_t A=0,B=0,C=0,D=0;
  for(int64_t x=0;x<4;x++) for(int64_t y=0;y<4;y++) if(board[x][y] == 'M') A++;
  for(int64_t x=4;x<8;x++) for(int64_t y=0;y<4;y++) if(board[x][y] == 'M') B++;
  for(int64_t x=0;x<4;x++) for(int64_t y=4;y<8;y++) if(board[x][y] == 'M') C++;
  for(int64_t x=4;x<8;x++) for(int64_t y=4;y<8;y++) if(board[x][y] == 'M') D++;
  while(A > 8) {
    if(B < 16) {
      int64_t x=4,y=0;
      for(;x<8;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'V') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(y == 0) {
        if(x == 4) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,x,y,1);
            moves.push_back(make_pair(x,y));
          }
          y++;
        } else {
          rotate(board,x-1,y,1);
          moves.push_back(make_pair(x-1,y));
          y++;
        }
      }
      while(x > 4) {
        rotate(board,x-1,y-1,1);
        moves.push_back(make_pair(x-1,y-1));
        x--;
      }
      int64_t xx=0,yy=0;
      for(;x<4;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'M') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(yy == 3) {
        if(xx == 3) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,xx-1,yy-1,1);
            moves.push_back(make_pair(xx,yy));
          }
          yy--;
        } else {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
      }
      while(yy > y-1) {
        rotate(board,xx,yy-1,1);
        moves.push_back(make_pair(xx,yy-1));
        yy--;
      }
      while(xx < 3) {
        rotate(board,xx, yy, 1);
        moves.push_back(make_pair(xx,yy));
        xx++;
      }
      rotate(board,xx, yy, 1);
      moves.push_back(make_pair(xx,yy));
      A--;
      B++;
    } else if(C < 16) {
      int64_t x=0,y=4;
      for(;x<4;x++) {
        bool out=false;
        for(;y<8;y++) {
          if(board[x][y] == 'V') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(x == 3) {
        if(y == 4) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,x-1,y,1);
            moves.push_back(make_pair(x-1,y));
          }
          x--;
        } else {
          rotate(board,x-1,y-1,1);
          moves.push_back(make_pair(x-1,y-1));
          x--;
        }
      }
      while(y > 4) {
        rotate(board,x,y-1,1);
        moves.push_back(make_pair(x,y-1));
        y--;
      }
      int64_t xx=0,yy=0;
      for(;x<4;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'M') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(yy == 3) {
        rotate(board,xx,yy-1,1);
        moves.push_back(make_pair(xx,yy-1));
        yy--;
      }
      while(xx < x+1) {
        rotate(board,xx,yy,1);
        moves.push_back(make_pair(xx,yy));
        xx++;
      }
      while(yy < 3) {
        rotate(board,xx-1,yy,1);
        moves.push_back(make_pair(xx-1,yy));
        yy++;
      }
      rotate(board,xx-1,yy,1);
      moves.push_back(make_pair(xx-1,yy));
      A--;
      C++;
    }
  }

  while(A < 8) {
    if(B > 0) {
      int64_t x=4,y=0;
      for(;x<8;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'M') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(y == 0) {
        if(x == 4) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,x,y,1);
            moves.push_back(make_pair(x,y));
          }
          y++;
        } else {
          rotate(board,x-1,y,1);
          moves.push_back(make_pair(x-1,y));
          y++;
        }
      }
      while(x > 4) {
        rotate(board,x-1,y-1,1);
        moves.push_back(make_pair(x-1,y-1));
        x--;
      }
      int64_t xx=0,yy=0;
      for(;x<4;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'V') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(yy == 3) {
        if(xx == 3) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,xx-1,yy-1,1);
            moves.push_back(make_pair(xx,yy));
          }
          yy--;
        } else {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
      }
      while(yy > y-1) {
        rotate(board,xx,yy-1,1);
        moves.push_back(make_pair(xx,yy-1));
        yy--;
      }
      while(xx < 3) {
        rotate(board,xx, yy, 1);
        moves.push_back(make_pair(xx,yy));
        xx++;
      }
      rotate(board,xx, yy, 1);
      moves.push_back(make_pair(xx,yy));
      A--;
      B++;
    } else if(C > 0) {
      int64_t x=0,y=4;
      for(;x<4;x++) {
        bool out=false;
        for(;y<8;y++) {
          if(board[x][y] == 'M') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(x == 3) {
        if(y == 4) {
          for(int64_t i=0;i<3;i++) {
            rotate(board,x-1,y,1);
            moves.push_back(make_pair(x-1,y));
          }
          x--;
        } else {
          rotate(board,x-1,y-1,1);
          moves.push_back(make_pair(x-1,y-1));
          x--;
        }
      }
      while(y > 4) {
        rotate(board,x,y-1,1);
        moves.push_back(make_pair(x,y-1));
        y--;
      }
      int64_t xx=0,yy=0;
      for(;x<4;x++) {
        bool out=false;
        for(;y<4;y++) {
          if(board[x][y] == 'V') {
            out=true;
            break;
          }
        }
        if(out) break;
      }
      if(yy == 3) {
        rotate(board,xx,yy-1,1);
        moves.push_back(make_pair(xx,yy-1));
        yy--;
      }
      while(xx < x+1) {
        rotate(board,xx,yy,1);
        moves.push_back(make_pair(xx,yy));
        xx++;
      }
      while(yy < 3) {
        rotate(board,xx-1,yy,1);
        moves.push_back(make_pair(xx-1,yy));
        yy++;
      }
      rotate(board,xx-1,yy,1);
      moves.push_back(make_pair(xx-1,yy));
      A--;
      C++;
    }
  }

  if(D > 8) {
    if(B < 8) {
      /* B from D*/
      while(B < 8) {
        int64_t x=4,y=4;
        for(;x<8;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'M') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(x == 7) {
          if(y == 4) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,x-1,y,1);
              moves.push_back(make_pair(x-1,y));
            }
            x--;
          } else {
            rotate(board,x-1,y-1,1);
            moves.push_back(make_pair(x-1,y-1));
            x--;
          }
        }
        while(y > 4) {
          rotate(board,x,y-1,1);
          moves.push_back(make_pair(x,y-1));
          y--;
        }
        int64_t xx=4,yy=0;
        for(;x<8;x++) {
          bool out=false;
          for(;y<4;y++) {
            if(board[x][y] == 'V') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(yy == 3) {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
        while(xx < x+1) {
          rotate(board,xx,yy,1);
          moves.push_back(make_pair(xx,yy));
          xx++;
        }
        while(yy < 3) {
          rotate(board,xx-1,yy,1);
          moves.push_back(make_pair(xx-1,yy));
          yy++;
        }
        rotate(board,xx-1,yy,1);
        moves.push_back(make_pair(xx-1,yy));
        B++;
        D--;
      }
    } else {
      /* C from D*/
      while(C < 8) {
        int64_t x=4,y=4;
        for(;x<8;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'M') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(y == 4) {
          if(x == 4) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,x,y,1);
              moves.push_back(make_pair(x,y));
            }
            y++;
          } else {
            rotate(board,x-1,y,1);
            moves.push_back(make_pair(x-1,y));
            y++;
          }
        }
        while(x > 4) {
          rotate(board,x-1,y-1,1);
          moves.push_back(make_pair(x-1,y-1));
          x--;
        }
        int64_t xx=0,yy=4;
        for(;x<4;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'V') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(yy == 7) {
          if(xx == 3) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,xx-1,yy-1,1);
              moves.push_back(make_pair(xx,yy));
            }
            yy--;
          } else {
            rotate(board,xx,yy-1,1);
            moves.push_back(make_pair(xx,yy-1));
            yy--;
          }
        }
        while(yy > y-1) {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
        while(xx < 3) {
          rotate(board,xx, yy, 1);
          moves.push_back(make_pair(xx,yy));
          xx++;
        }
        rotate(board,xx, yy, 1);
        moves.push_back(make_pair(xx,yy));
        D--;
        C++;
      }
    }
  }
  if(D < 8) {
    if(B > 8) {
      /* B from D*/
      while(B < 8) {
        int64_t x=4,y=4;
        for(;x<8;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'V') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(x == 7) {
          if(y == 4) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,x-1,y,1);
              moves.push_back(make_pair(x-1,y));
            }
            x--;
          } else {
            rotate(board,x-1,y-1,1);
            moves.push_back(make_pair(x-1,y-1));
            x--;
          }
        }
        while(y > 4) {
          rotate(board,x,y-1,1);
          moves.push_back(make_pair(x,y-1));
          y--;
        }
        int64_t xx=4,yy=0;
        for(;x<8;x++) {
          bool out=false;
          for(;y<4;y++) {
            if(board[x][y] == 'M') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(yy == 3) {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
        while(xx < x+1) {
          rotate(board,xx,yy,1);
          moves.push_back(make_pair(xx,yy));
          xx++;
        }
        while(yy < 3) {
          rotate(board,xx-1,yy,1);
          moves.push_back(make_pair(xx-1,yy));
          yy++;
        }
        rotate(board,xx-1,yy,1);
        moves.push_back(make_pair(xx-1,yy));
        B--;
        D++;
      }
    } else {
      while(C < 8) {
        int64_t x=4,y=4;
        for(;x<8;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'V') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(y == 4) {
          if(x == 4) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,x,y,1);
              moves.push_back(make_pair(x,y));
            }
            y++;
          } else {
            rotate(board,x-1,y,1);
            moves.push_back(make_pair(x-1,y));
            y++;
          }
        }
        while(x > 4) {
          rotate(board,x-1,y-1,1);
          moves.push_back(make_pair(x-1,y-1));
          x--;
        }
        int64_t xx=0,yy=4;
        for(;x<4;x++) {
          bool out=false;
          for(;y<8;y++) {
            if(board[x][y] == 'M') {
              out=true;
              break;
            }
          }
          if(out) break;
        }
        if(yy == 7) {
          if(xx == 3) {
            for(int64_t i=0;i<3;i++) {
              rotate(board,xx-1,yy-1,1);
              moves.push_back(make_pair(xx,yy));
            }
            yy--;
          } else {
            rotate(board,xx,yy-1,1);
            moves.push_back(make_pair(xx,yy-1));
            yy--;
          }
        }
        while(yy > y-1) {
          rotate(board,xx,yy-1,1);
          moves.push_back(make_pair(xx,yy-1));
          yy--;
        }
        while(xx < 3) {
          rotate(board,xx, yy, 1);
          moves.push_back(make_pair(xx,yy));
          xx++;
        }
        rotate(board,xx, yy, 1);
        moves.push_back(make_pair(xx,yy));
        D++;
        C--;
      }
    }
  }

  vector<vector<char>> bA(4,vector<char>(4));
  vector<vector<char>> bB(4,vector<char>(4));
  vector<vector<char>> bC(4,vector<char>(4));
  vector<vector<char>> bD(4,vector<char>(4));
  for(int64_t i=0;i<4;i++) {
    for(int64_t j=0;j<4;j++) {
      bA[i][j]=board[i][j];
    }
  }
  for(int64_t i=4;i<8;i++) {
    for(int64_t j=0;j<4;j++) {
      bB[i-4][j]=board[i][j];
    }
  }
  for(int64_t i=0;i<4;i++) {
    for(int64_t j=4;j<8;j++) {
      bC[i][j-4]=board[i][j];
    }
  }
  for(int64_t i=4;i<8;i++) {
    for(int64_t j=4;j<8;j++) {
      bD[i-4][j-4]=board[i][j];
    }
  }

  /*vector<vector<char>> bar(4,vector<char>(4));
  for(int64_t i=0;i<4;i++) {
    for(int64_t j=0;j<4;j++) {
      if((i+j)%2) {
        bar[i][j]='M';
      } else {
        bar[i][j]='V';
      }
    }
  }
  print_board(bar);
  hsh1=hsh(bar);
  for(int64_t i=0;i<4;i++) {
    for(int64_t j=0;j<4;j++) {
      if((i+j)%2) {
        bar[i][j]='V';
      } else {
        bar[i][j]='M';
      }
    }
  }
  print_board(bar);
  hsh2=hsh(bar);*/

  map<int64_t,pair<pair<int64_t,int64_t>,int64_t>> found;

  vector<pair<int64_t,int64_t>> foo=bfs(bA, found, hsh(bA));
  for(int64_t i=foo.size()-1;i>=0;i--) {
    moves.push_back(foo[i]);
  }

  found.clear();
  foo=bfs(bB, found, hsh(bB));
  for(int64_t i=foo.size()-1;i>=0;i--) {
    moves.push_back(make_pair(foo[i].first+4, foo[i].second));
  }

  found.clear();
  foo=bfs(bC, found, hsh(bC));
  for(int64_t i=foo.size()-1;i>=0;i--) {
    moves.push_back(make_pair(foo[i].first, foo[i].second+4));
  }

  found.clear();
  foo=bfs(bD, found, hsh(bD));
  for(int64_t i=foo.size()-1;i>=0;i--) {
    moves.push_back(make_pair(foo[i].first+4, foo[i].second+4));
  }

  cout << moves.size() << '\n';
  for(int64_t i=0;i<moves.size();i++) {
    cout << moves[i].first << " " << moves[i].second << "\n";
  }

  return 0;
}

Test details

Test 1

Group: 1

Verdict:

input
VMMVVMVV
MMVVMVVV
MMVVMMMM
MVVVMVVM
MVVVVMVM
...

correct output
100000

user output
(empty)

Test 2

Group: 1

Verdict:

input
MVMVVMMV
VVMMVVVV
VMMVMMVM
MVVVVMVM
MVMVMMVM
...

correct output
100000

user output
(empty)

Test 3

Group: 1

Verdict:

input
VMMMVMVV
MMMVMVMV
VMMVMVVM
VVVMVMMV
MVMVMVMV
...

correct output
100000

user output
14
4 0
4 0
4 0
0 0
...

Test 4

Group: 1

Verdict:

input
VVVMVMVV
VMMVMVMM
MVVMMVMV
VMVMMVMM
MMVVMMVM
...

correct output
100000

user output
(empty)

Test 5

Group: 1

Verdict:

input
MVMVVMMM
VVMMVVMV
MVVMVVMM
VMVMVMMV
MMVMVVVM
...

correct output
100000

user output
1736
0 1
0 0
0 0
0 0
...

Test 6

Group: 1

Verdict:

input
VMMVMVVM
VVMMVVMM
MMMVMVVM
VMMVMMVM
MVMVMMMV
...

correct output
100000

user output
3010
0 0
1 0
2 0
3 0
...

Test 7

Group: 1

Verdict:

input
MVVVVMMM
MMMMMMMM
VVVVVMMV
MMVVMVVM
VMVVVVMV
...

correct output
100000

user output
(empty)

Test 8

Group: 1

Verdict:

input
VMMVMVMM
MMMVVMMM
MVVVVVVV
VVVVMMMV
MVVVMVVM
...

correct output
100000

user output
(empty)

Test 9

Group: 1

Verdict:

input
VVVVVMMM
MMVVVVVV
MVVVMMMM
VVMVVVVM
VMMVMVMM
...

correct output
100000

user output
(empty)

Test 10

Group: 1

Verdict:

input
VMMVMMMM
VVMVVVVV
VMMVMVMV
VMMVMVMM
VVVMMMMM
...

correct output
100000

user output
(empty)

Test 11

Group: 2

Verdict:

input
VMVMVVMM
MMVMVVMM
VMVVVMMV
VVVMVMVM
VVMMVVMM
...

correct output
25000

user output
(empty)

Test 12

Group: 2

Verdict:

input
MVMVVMVV
VMMVVMVM
VMVVVMMM
VMMMMVVM
MMVVVMMM
...

correct output
25000

user output
8057
0 4
1 4
2 4
3 4
...

Test 13

Group: 2

Verdict:

input
MVVMMVVV
MMVVMVMM
VVVMVMVV
VMVMMMMM
MVVMMVMV
...

correct output
25000

user output
(empty)

Test 14

Group: 2

Verdict:

input
VVMMMVMV
VMVVVMVV
VVMVVVMM
MVVMVMVM
MMVVMMMM
...

correct output
25000

user output
(empty)

Test 15

Group: 2

Verdict:

input
MVVVMVVV
MMMMVMMM
MVMMMVVM
MMVVVMVM
VMVVVMMV
...

correct output
25000

user output
(empty)

Test 16

Group: 2

Verdict:

input
VMMVMVVM
VMMVVVVV
MVMVMMVM
VMMVVVMV
VVMVMMVM
...

correct output
25000

user output
(empty)

Test 17

Group: 2

Verdict:

input
MVVMMVVM
MVVVMMMV
MVVMMVVM
VMMVMVMV
VMMVMMMM
...

correct output
25000

user output
(empty)

Test 18

Group: 2

Verdict:

input
MVMMVVMM
VVMMMMVV
VMVVVVVM
MVMMMVMV
VMVVVMVM
...

correct output
25000

user output
18706
4 0
4 0
4 0
0 0
...

Test 19

Group: 2

Verdict:

input
MVVVVVVV
VMMVMVVM
VMVMMMMV
MVMVMMMM
MMVVVMMM
...

correct output
25000

user output
(empty)

Test 20

Group: 2

Verdict:

input
MVVVMMMM
MMVMMVMV
MVVVVVMM
VVMMMVVM
VVVMVMVV
...

correct output
25000

user output
(empty)

Test 21

Group: 3

Verdict:

input
VMVVMVMM
MMMMVMMV
VVVMVVVV
MVMVMVVM
VMMVMMMM
...

correct output
5000

user output
(empty)

Test 22

Group: 3

Verdict:

input
VVVVVVMM
MMMVMMVV
VVVVVVMV
MMMVMVVV
MVVMMMMV
...

correct output
5000

user output
(empty)

Test 23

Group: 3

Verdict:

input
MMVMVMVV
MMVVMVVM
VMMVVMVM
MMMMMMVV
MVVVVMVM
...

correct output
5000

user output
17289
4 0
4 0
4 0
0 0
...

Test 24

Group: 3

Verdict:

input
MVMVVMVM
VVMVVMVM
MMMMVMVV
MVVMMVVV
MMMMMVVV
...

correct output
5000

user output
1908
4 0
4 0
4 0
0 0
...

Test 25

Group: 3

Verdict:

input
MVVVMVVM
MMMMVVMV
VMMVMMVV
VVMVMVMV
MVMMMVMM
...

correct output
5000

user output
5753
0 1
0 0
0 1
0 0
...

Test 26

Group: 3

Verdict:

input
VMVMVVVM
MMMVVVMM
MMVVVVVM
VVVVMMVV
VMMVVMMV
...

correct output
5000

user output
(empty)

Test 27

Group: 3

Verdict:

input
MMVMMVVM
MVVVMVMV
MVVVMVVM
VMVMMMVV
VMMVVVVV
...

correct output
5000

user output
(empty)

Test 28

Group: 3

Verdict:

input
MVMMVMMV
VMVMMMVV
MMMMVVMV
VVVVMMMM
MMMVMMVV
...

correct output
5000

user output
6660
4 0
4 0
4 0
0 0
...

Test 29

Group: 3

Verdict:

input
VVVVMVMV
MMMVVMVM
MVVVMVMV
VVVMVVMM
VMMMMMVV
...

correct output
5000

user output
(empty)

Test 30

Group: 3

Verdict:

input
MVVVMVVV
MMVVMMMM
MVVVVVVV
MVMVMMMV
VMMMVMMM
...

correct output
5000

user output
(empty)

Test 31

Group: 4

Verdict:

input
MVMMVMMV
VVVMMVVV
VMMVVMMV
VVMMMVVM
VVVMMMVV
...

correct output
250

user output
(empty)

Test 32

Group: 4

Verdict:

input
VVMMVVVM
VMVVMMVV
VMMMMMMV
VVMVMVVV
VMMVMVMM
...

correct output
250

user output
(empty)

Test 33

Group: 4

Verdict:

input
MMVVMVMV
VVVMVMMM
VVVVMVMM
MVVMVVMV
VMMVMVVM
...

correct output
250

user output
(empty)

Test 34

Group: 4

Verdict:

input
VMVMVVMV
MVVMMMMM
MMVVMMMM
VMVMVVVM
VMMMVVVM
...

correct output
250

user output
10859
0 1
0 0
0 0
0 0
...

Test 35

Group: 4

Verdict:

input
VMVMVMMM
VMMVVVMM
MMVMVMMM
MVMMVVVV
VMMVMMMV
...

correct output
250

user output
(empty)

Test 36

Group: 4

Verdict:

input
MVMVMVMM
MVMVMMMV
MMVVVVMM
MVMVVVVV
VMMMVVMM
...

correct output
250

user output
25324
0 1
0 0
0 0
0 0
...

Test 37

Group: 4

Verdict:

input
VMMMMVMM
VVMMMVMV
VMVVVVVV
MVMMMVVM
VMVMMVVM
...

correct output
250

user output
7819
0 0
1 0
2 0
3 0
...

Test 38

Group: 4

Verdict:

input
VMMVMVMV
VVMVMVMM
MMMVMVMM
MVVVVMMM
MMVVVMVV
...

correct output
250

user output
(empty)

Test 39

Group: 4

Verdict:

input
MMMMMVMV
MVVMMMMV
VMVVVVMM
VMVVVMMV
MVMMMVMM
...

correct output
250

user output
10779
4 4
4 4
4 4
0 4
...

Test 40

Group: 4

Verdict:

input
VMMMMMMV
VMMVVVVV
MVMMVMMV
MVVVVMMV
MVVVVMMM
...

correct output
250

user output
8
0 0
1 0
2 0
3 0
...