UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#211402#3803. 激光rua02203ms9136kbC++112.6kb2024-08-11 11:03:362024-08-11 13:04:13

answer

#include <bits/stdc++.h>
#define inf INT_MAX
#define NN INT_MIN
typedef long long ll;
using namespace std;
int a[1005][1005], ans[1005][1005];
int n, m, k;
int main()
{
#ifdef WHX_AK_IOI
   freopen("data.in", "r", stdin);
// freopen("dataout.txt","w",stdout);
#endif
   ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
   cin >> n >> m;
   for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
      {
         char c;
         cin >> c;
         if (c == '/')
         {
            cout << "gxhakioi" << endl;
            return 0;
         }
         if (c == 'X')
            a[i][j] = 1;
      }
   // cin >> k;
   // if (k != 0)
   // {
   //    cout << "gxhakioi" << endl;
   //    return 0;
   // }
   for (int j = 1; j <= m; j++)
   {
      int pre = 0;
      for (int i = 1; i <= n; i++)
      {
         if (a[i][j] == 1)
         {
            ans[i][j] = -1;
            pre = 0;
            continue;
         }
         ans[i][j] = pre + 1;
         pre = ans[i][j];
      }
   }
   for (int i = 1; i <= n; i++)
   {
      for (int j = 1; j <= m; j++)
         cout << ans[i][j] << ' ';
      cout << endl;
   }

   memset(ans, 0, sizeof ans);
   for (int j = 1; j <= m; j++)
   {
      int pre = 0;
      for (int i = n; i >= 1; i--)
      {
         if (a[i][j] == 1)
         {
            ans[i][j] = -1;
            pre = 0;
            continue;
         }
         ans[i][j] = pre + 1;
         pre = ans[i][j];
      }
   }
   for (int i = 1; i <= n; i++)
   {
      for (int j = 1; j <= m; j++)
         cout << ans[i][j] << ' ';
      cout << endl;
   }

   memset(ans, 0, sizeof ans);
   for (int i = 1; i <= n; i++)
   {
      int pre = 0;
      for (int j = m; j >= 1; j--)
      {
         if (a[i][j] == 1)
         {
            ans[i][j] = -1;
            pre = 0;
            continue;
         }
         ans[i][j] = pre + 1;
         pre = ans[i][j];
      }
   }
   for (int i = 1; i <= n; i++)
   {
      for (int j = 1; j <= m; j++)
         cout << ans[i][j] << ' ';
      cout << endl;
   }

   memset(ans, 0, sizeof ans);
   for (int i = 1; i <= n; i++)
   {
      int pre = 0;
      for (int j = 1; j <= m; j++)
      {
         if (a[i][j] == 1)
         {
            ans[i][j] = -1;
            pre = 0;
            continue;
         }
         ans[i][j] = pre + 1;
         pre = ans[i][j];
      }
   }
   for (int i = 1; i <= n; i++)
   {
      for (int j = 1; j <= m; j++)
         cout << ans[i][j] << ' ';
      cout << endl;
   }
   // system("pause");
   return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5204kb

input:

50 50
.......................#.........#................
..............................................

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 24th words differ - expected: '-1', found: '1'

Test #2:

score: 0
Wrong Answer
time: 67ms
memory: 5204kb

input:

500 500
...............................................................................................

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 230th words differ - expected: '-1', found: '1'

Test #3:

score: 0
Wrong Answer
time: 295ms
memory: 5212kb

input:

1000 1000
#.....#..#...............#..#.##......#......#...........#....#....#.#.......#..........##...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 1st words differ - expected: '-1', found: '1'

Test #4:

score: 0
Wrong Answer
time: 219ms
memory: 5208kb

input:

990 831
...............................................................................................

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 884th words differ - expected: '-1', found: '2'

Test #5:

score: 0
Wrong Answer
time: 278ms
memory: 5208kb

input:

1000 1000
.............................................................................................

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer 2000001st words differ - expected: '1', found: '1000'

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

3 3
/X\
X.X
.X/
1 2 2 3
2 1 3 2

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1244kb

input:

7 7
/X.X.X\
X\.\./X
.......
X\././X
.......
X\./.\X
\X.X.X/
1 2 7 2
1 4 7 4
1 6 7 6
2 1 2 7
4 1 4 7
...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 1244kb

input:

9 10
#./....\..
..../.X..#
/.X..../..
./.\./....
..X../..#.
\/.\...\..
..X...\/..
.X....X..\
....X.....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

50 50
.././.\.\\.\\.\/\\.//..\\..//\./////..\//..//\\...
\.....\..../\\/..\/././\.//.\\\.\\/\\\..\//...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

60 60
X..XXX.../...XXX././X..\..X....XX.X.X./X....XXX....\XXX.X.X.
XX..XX.//..XX\.X...X.X...X.....X....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #11:

score: 0
Wrong Answer
time: 3ms
memory: 5444kb

input:

60 60
X..XXXX..X...XXX.X.XX..X..XXXXXXX.X.X.XXX.X.XXXX.X.XXXX.XXX.
XX..XX.XX..XXX.X...X.X.XXX..X..X....

output:

-1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 1 -1...

result:

wrong answer 64th words differ - expected: '99', found: '1'

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

60 60
/..........................................................\
./..................................

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

60 55
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
X\.........XX....X.X...XX../\../...X.....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #14:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

60 60
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
X...\\XXX//../X/////...\..\.\/X.X...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #15:

score: 0
Wrong Answer
time: 1ms
memory: 1256kb

input:

60 60
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
X/..\\/..//.././////...\..\.\/......

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #16:

score: 0
Wrong Answer
time: 247ms
memory: 9132kb

input:

1000 899
........X...X..X...X.X.....X.....X...............X.XX.X.X............X..X.X.X..X..............

output:

1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

wrong answer 469th words differ - expected: '-1', found: '1'

Test #17:

score: 0
Wrong Answer
time: 272ms
memory: 9132kb

input:

1000 1000
X.....XXXX.X...X.........X..X.XX...X.XX......X........X..X....X....X.X.......X.......X..XX...

output:

-1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 1 1 1 1 ...

result:

wrong answer 385th words differ - expected: '-1', found: '1'

Test #18:

score: 0
Wrong Answer
time: 287ms
memory: 9136kb

input:

1000 1000
XXX...XXXXXXXXXXXXXX.XXXXXXXXXXXXXXX.XXX.X.XXXXXX.XX..X.XXXXXXXXXXXXXXXXXXXXXX.XXXXX.XXXXX...

output:

-1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

wrong answer 1011th words differ - expected: '2203', found: '1'

Test #19:

score: 0
Wrong Answer
time: 261ms
memory: 9136kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

wrong answer 1002nd words differ - expected: '420525', found: '1'

Test #20:

score: 0
Wrong Answer
time: 272ms
memory: 9132kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

result:

wrong answer 1002nd words differ - expected: '1000', found: '1'

Test #21:

score: 0
Wrong Answer
time: 0ms
memory: 1252kb

input:

1000 1000
...../\..../.\......//././/./\\./../..\/.......\\.\.....\\\\//.\.../.\....\...\../././../\...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #22:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

1000 1000
......\...................../................................................................

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #23:

score: 0
Wrong Answer
time: 0ms
memory: 1252kb

input:

1000 1000
/............................................................................................

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #24:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

700 1000
/.............................................................................................

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #25:

score: 0
Wrong Answer
time: 0ms
memory: 1248kb

input:

1000 1000
#.....#\/................\..#\#\\/...../.....#..\........#.\..#\...\.\........\/../../...\...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #26:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

1000 1000
.........X.\........\.......#..X............/#....\........./.............X.......X..........

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #27:

score: 0
Wrong Answer
time: 0ms
memory: 1252kb

input:

1000 1000
...../\\./.X.......X/..../../\.../.X..\X..........\...\..\.X/XX..../.X.....\...X...../XX.....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #28:

score: 0
Wrong Answer
time: 0ms
memory: 1292kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #29:

score: 0
Wrong Answer
time: 1ms
memory: 1256kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #30:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #31:

score: 0
Wrong Answer
time: 0ms
memory: 1260kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #32:

score: 0
Wrong Answer
time: 0ms
memory: 1256kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'

Test #33:

score: 0
Wrong Answer
time: 0ms
memory: 1252kb

input:

1000 1000
\.XXX/\X..X\XXXX.XXXXX.X.X.X/X.\XX.XX.\XXX.XXXXX\X\.XX.XX\XX/X.X.XXXXXXXXXXX.X\XXXXXXXXX/....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #34:

score: 0
Wrong Answer
time: 0ms
memory: 1272kb

input:

1000 1000
X..XXXXX.XXXXXXX.XXXXX.X.X.XXXXXXX.XX.XXXX.XXX.XXXXX.X.XXXXXXX.X.XXXXXXX..XX.XXXXXXXXXXX.....

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '-1', found: 'gxhakioi'

Test #35:

score: 0
Wrong Answer
time: 0ms
memory: 1296kb

input:

1000 1000
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

gxhakioi

result:

wrong answer 1st words differ - expected: '1', found: 'gxhakioi'