Submission #1131292


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,vector<string> >P;
int n;

vector<string>& check(vector<string> &v,int x,int y){
  vector<string> &t=v;
  for(int i=0;i<n;i++)
    t[y][i]=v[i][x];
    return t;
}

int main(){
  vector<string> v;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    v.push_back(s);
  }
  queue<P> q;
  q.push(P(0,v));
  while(!q.empty()){
    P p=q.front();
    q.pop();
    if(p.first==8){cout<<-1<<endl;break;}
    bool f=1;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	if(p.second[i][j]=='.')f=0;
    if(f){cout<<p.first<<endl;break;}
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	q.push(P(p.first+1,check(p.second,j,i)));
  }
  return 0;
}

Submission Info

Submission Time
Task B - Row to Column
User kawabys
Language C++14 (GCC 5.4.1)
Score 0
Code Size 751 Byte
Status RE
Exec Time 2898 ms
Memory 1660700 KB

Judge Result

Set Name Sample Subtask All
Score / Max Score 0 / 0 0 / 300 0 / 1000
Status
AC × 3
WA × 1
TLE × 1
AC × 7
WA × 4
TLE × 9
AC × 8
WA × 4
TLE × 15
RE × 16
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
Subtask 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt, 2_13.txt, 2_14.txt, 2_15.txt, 2_16.txt, 2_17.txt, 2_18.txt, 2_19.txt, 2_20.txt, 2_21.txt, 2_22.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 256 KB
0_01.txt AC 22 ms 10624 KB
0_02.txt AC 1 ms 256 KB
0_03.txt WA 3 ms 1408 KB
0_04.txt TLE 2172 ms 1659264 KB
1_00.txt TLE 2172 ms 1660700 KB
1_01.txt AC 1 ms 256 KB
1_02.txt TLE 2172 ms 1646736 KB
1_03.txt TLE 2172 ms 1652136 KB
1_04.txt TLE 2171 ms 1654824 KB
1_05.txt WA 17 ms 9728 KB
1_06.txt TLE 2171 ms 1642896 KB
1_07.txt AC 17 ms 9728 KB
1_08.txt TLE 2172 ms 1659264 KB
1_09.txt AC 17 ms 9728 KB
1_10.txt TLE 2171 ms 1638872 KB
1_11.txt WA 17 ms 9728 KB
1_12.txt TLE 2172 ms 1657392 KB
1_13.txt AC 1 ms 256 KB
1_14.txt WA 17 ms 9728 KB
2_00.txt RE 1996 ms -485772 KB
2_01.txt AC 21 ms 2164 KB
2_02.txt RE 1885 ms -485508 KB
2_03.txt RE 2003 ms -485444 KB
2_04.txt RE 1884 ms -485396 KB
2_05.txt RE 1890 ms -485360 KB
2_06.txt TLE 2599 ms -485272 KB
2_07.txt TLE 2624 ms -485272 KB
2_08.txt TLE 2659 ms -485080 KB
2_09.txt TLE 2450 ms -485208 KB
2_10.txt RE 1985 ms -486288 KB
2_11.txt RE 1921 ms -486460 KB
2_12.txt RE 1976 ms -485872 KB
2_13.txt RE 2038 ms -485368 KB
2_14.txt RE 2013 ms -485164 KB
2_15.txt TLE 2588 ms -485312 KB
2_16.txt TLE 2898 ms -485464 KB
2_17.txt RE 2033 ms -485644 KB
2_18.txt RE 2039 ms -485468 KB
2_19.txt RE 2028 ms -485644 KB
2_20.txt RE 2033 ms -485460 KB
2_21.txt RE 1973 ms -485688 KB
2_22.txt RE 1919 ms -485688 KB