답안 #860194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860194 2023-10-12T05:48:28 Z ReLice Nautilus (BOI19_nautilus) C++14
0 / 100
21 ms 153692 KB
#include <bits/stdc++.h>
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define sz size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define bc back()
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
void start(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const long long inf=1e18+7;
const ll mod=998244353;
const ll N=130*2;;
const ld eps=1e-9;
char ch[505][505];
vector <bitset<250005>> dp(5005);
void solve(){
    ll i,j;
    ll b,c=1;
    ll n,m,k;
    cin>>n>>m>>k;
    for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			cin>>ch[i][j];
			dp[0][c]=true;
			c++;
		}
	}
	str s;
	cin>>s;
	for(i=1;i<=s.sz;i++){
		if(s[i-1]=='N') dp[i]=dp[i-1]&(dp[i-1]<<m);
		if(s[i-1]=='S') dp[i]=dp[i-1]&(dp[i-1]>>m);
		if(s[i-1]=='W') dp[i]=dp[i-1]&(dp[i-1]<<1);
		if(s[i-1]=='E') dp[i]=dp[i-1]&(dp[i-1]>>1);
		if(s[i-1]=='?') dp[i]=(dp[i-1]&(dp[i-1]<<m))|(dp[i-1]&(dp[i-1]>>m))|(dp[i-1]&(dp[i-1]<<1))|(dp[i-1]&(dp[i-1]>>1));
	}
	cout<<dp[i].count()<<endl;
}

signed main(){
    start();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll t=1;
    //cin>>t;
    while(t--) solve();
}
/*

 
 
 
*/

Compilation message

nautilus.cpp: In function 'void solve()':
nautilus.cpp:50:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  for(i=1;i<=s.sz;i++){
      |           ^
nautilus.cpp:38:8: warning: unused variable 'b' [-Wunused-variable]
   38 |     ll b,c=1;
      |        ^
nautilus.cpp: In function 'void fre(std::string)':
nautilus.cpp:24:27: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:24:64: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 153692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 153692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 153692 KB Output isn't correct
2 Halted 0 ms 0 KB -