답안 #928921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928921 2024-02-17T08:12:46 Z Faisal_Saqib Nautilus (BOI19_nautilus) C++17
100 / 100
211 ms 157736 KB
#include <iostream>
#include <bitset>
using namespace std;
char g[501][501],dir;
int n,m,M;
bitset<501> row[501][5002];
int main()
{
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  cin>>n>>m>>M;
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m;j++)
    {
      cin>>g[i][j];
      row[i][0][j]=(g[i][j]=='.');
    }
  }
  for(int j=0;j<M;j++)
  {
    cin>>dir;
    bool p=0;
    if(dir=='?')
        p=1;
    if(dir=='N' or p)
    {
       for(int i=1;i<n;i++)
          row[i-1][j+1]|=(row[i][j]&row[i-1][0]);
    }
    if(dir=='E' or p)
    {
       for(int i=0;i<n;i++)
          row[i][j+1]|=((row[i][j]<<1)&row[i][0]);
    }
    if(dir=='S' or p)
    {
       for(int i=0;i<(n-1);i++)
          row[i+1][j+1]|=(row[i+1][0]&row[i][j]);
    }
    if(dir=='W' or p)
    {
       for(int i=0;i<n;i++)
          row[i][j+1]|=((row[i][j]>>1)&row[i][0]);
    }
  }
  int ans=0;
  for(int x=0;x<n;x++)
    ans+=row[x][M].count();
  cout<<ans<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1444 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 1 ms 1368 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1444 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 1 ms 1368 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1368 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 2 ms 1372 KB Output is correct
15 Correct 1 ms 1504 KB Output is correct
16 Correct 2 ms 1368 KB Output is correct
17 Correct 2 ms 1372 KB Output is correct
18 Correct 2 ms 1372 KB Output is correct
19 Correct 2 ms 1372 KB Output is correct
20 Correct 2 ms 1372 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Correct 1 ms 1444 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 1 ms 1368 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1372 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1628 KB Output is correct
11 Correct 1 ms 1368 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 2 ms 1372 KB Output is correct
15 Correct 1 ms 1504 KB Output is correct
16 Correct 2 ms 1368 KB Output is correct
17 Correct 2 ms 1372 KB Output is correct
18 Correct 2 ms 1372 KB Output is correct
19 Correct 2 ms 1372 KB Output is correct
20 Correct 2 ms 1372 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Correct 141 ms 157548 KB Output is correct
23 Correct 135 ms 157404 KB Output is correct
24 Correct 141 ms 157660 KB Output is correct
25 Correct 132 ms 157516 KB Output is correct
26 Correct 132 ms 157524 KB Output is correct
27 Correct 166 ms 157420 KB Output is correct
28 Correct 168 ms 157524 KB Output is correct
29 Correct 185 ms 157420 KB Output is correct
30 Correct 170 ms 157440 KB Output is correct
31 Correct 171 ms 157384 KB Output is correct
32 Correct 202 ms 157496 KB Output is correct
33 Correct 211 ms 157736 KB Output is correct
34 Correct 200 ms 157336 KB Output is correct
35 Correct 195 ms 157392 KB Output is correct
36 Correct 203 ms 157644 KB Output is correct