Submission #889784

# Submission time Handle Problem Language Result Execution time Memory
889784 2023-12-20T07:11:11 Z vjudge1 Nautilus (BOI19_nautilus) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e18;
string s;
int r,c,m,ans;
char a[505][505];
int chec(int x,int y){
	int ii = m - 1;
	while(m>0){
		if(s[ii]=='W'){
			y--;
		}else if(s[ii]=='N'){
			x++;
		}else if(s[ii]=='E'){
			y++;
		}else x--;
		if(a[x][y]!='.') return 0; 
		ii--;
	}
	return 1;	
}
    main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	cin>>r>>c>>m;
	for(int i = 1;i<=r;i++){
		for(int j = 1;j<=c;j++){
			cin>>a[i][j];
		}
	}
	cin>>s;
	for(int i = 1;i<=r;i++){
		for(int j = 1;j<=c;j++){
			if(a[i][j]=='#') continue;
			if(chec(i,j)) ans++;
		}
	}
	cout<<ans;
	return 0;
}
/*
//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).

//sum of squares n*(n+1)*(2n+1)/6
//sum of cubes [n*(n+1)/2]^2
//sum of squares for odds n*(4*n*n-1)/3
//sum of cubes for odds n*n*(2*n*n-1)

//a/b%mod = a*(b^(m-2)%mod)
//(a>>x)&1 == 0
//a^b = (a+b)-2(a&b)

//srand(time(0))-always changing




for(set<int>::iterator it=s.begin(); it!=s.end(); it++){
cout<<*it<<" ";
cout<<it->first<<" "<<it->second;
}


map
cin>>s>>ss;
s.insert(make_pair(s,ss));

sort
	.
	.
   . .
    .
bool cmp(pii a,pii b){
	if (a.F == b.F){
		return a.S < b.S;
	}
//	if (a.F > b.F) return 1;
//	else return 0;
	return a.F > b.F;
}

map<ll, ll> factors;

		    for (int i = 2; i <= sqrt(n); i++) {
		        while (n % i == 0) {
		            factors[i]++;
		            n /= i;
		        }
		    }

		    if (n != 1) {
		        factors[n]++;
		    }

		    for(auto now : factors){
		    	cout<<now.F<<"^"<<now.S<<" ";

			}



			ll binpow(ll a, ll b){
	a %= mod;
	if(b == 0){
		return 1;
	}
	if(b % 2 == 1){
		return binpow (a, b - 1) % mod * a;
	}
	if(b % 2 == 0){
		ll t = binpow (a, b / 2) % mod;
		return t * t % mod;
	}
}
  sisteme 101010
  for(char c : s)
  x = x*k + (c-48);
	*/

Compilation message

nautilus.cpp:29:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 |     main(){
      |     ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -