Submission #205304

# Submission time Handle Problem Language Result Execution time Memory
205304 2020-02-28T13:32:24 Z MohamedAhmed04 Nautilus (BOI19_nautilus) C++14
100 / 100
182 ms 1032 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 510 ;

char arr[MAX][MAX] ;
int n , m , k ;

bitset<MAX>prv[MAX] , now[MAX] , mask[MAX] ;

string s ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m>>k ;
	for(int i = 0 ; i < n ; ++i)
	{
		for(int j = 0 ; j < m ; ++j)
		{
			cin>>arr[i][j] ;
			if(arr[i][j] == '.')
				now[i][j] = 1 ;
			else
				mask[i][j] = 1 ;
		}
		mask[i][m] = 1 ;
	}
	cin>>s ;
	for(int j = 0 ; j < k ; ++j)
	{
		for(int i = 0 ; i < n ; ++i)
			prv[i] = now[i] , now[i].reset() ;
		if(s[j] == 'N' || s[j] == '?')
		{
			for(int i = 0 ; i < n-1 ; ++i)
				now[i] |= prv[i+1] ;
		}
		if(s[j] == 'S' || s[j] == '?')
		{
			for(int i = 1 ; i < n ; ++i)
				now[i] |= prv[i-1] ;
		}
		if(s[j] == 'W' || s[j] == '?')
		{
			for(int i = 0 ; i < n ; ++i)
				now[i] |= (prv[i] >> 1) ;
		}
		if(s[j] == 'E' || s[j] == '?')
		{
			for(int i = 0 ; i < n ; ++i)
				now[i] |= (prv[i] << 1) ;
		}
		for(int i = 0 ; i < n ; ++i)
		{
			now[i] |= mask[i] ;
			now[i] ^= mask[i] ;
		}
	}
	int ans = 0 ;
	for(int i = 0 ; i < n ; ++i)
		ans += now[i].count() ;
	return cout<<ans<<"\n" , 0 ;
}		
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 296 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 380 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 6 ms 508 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 504 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 296 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 6 ms 504 KB Output is correct
9 Correct 6 ms 380 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 6 ms 508 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 504 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 508 KB Output is correct
22 Correct 112 ms 1016 KB Output is correct
23 Correct 115 ms 1016 KB Output is correct
24 Correct 109 ms 888 KB Output is correct
25 Correct 110 ms 996 KB Output is correct
26 Correct 108 ms 888 KB Output is correct
27 Correct 147 ms 1016 KB Output is correct
28 Correct 150 ms 888 KB Output is correct
29 Correct 150 ms 892 KB Output is correct
30 Correct 149 ms 992 KB Output is correct
31 Correct 160 ms 1032 KB Output is correct
32 Correct 178 ms 888 KB Output is correct
33 Correct 182 ms 888 KB Output is correct
34 Correct 182 ms 896 KB Output is correct
35 Correct 182 ms 888 KB Output is correct
36 Correct 177 ms 888 KB Output is correct