Submission #1082865

# Submission time Handle Problem Language Result Execution time Memory
1082865 2024-09-02T01:32:43 Z timoni Awesome Arrowland Adventure (eJOI19_adventure) C++17
0 / 100
1 ms 348 KB
//don't copy pls)
/*TAAK ZDES NADO RECURSIU PISAT*/

//I'm not in the danger i am the DANGER
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define sigma signed
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,m,a[501][501],nei[5];
int hm(char c , char y){
	if(c == 'X' || y == 'X' || (c == y)){
		return 0;
	}
	if(c == 'N'){
		if(y == 'E'){
			return 1;
		}
		if(y == 'S'){
			return 2;
		}
		return 3;
	}
	if(c == 'W'){
		if(y == 'N'){
			return 1;
		}
		if(y == 'E'){
			return 2;
		}
		return 3;
	}
	if(c == 'S'){
		if(y == 'w'){
			return 1;
		}
		if(y == 'N'){
			return 2;
		}
		return 3;
	}
	if(c == 'E'){
		if(y == 'S'){
			return 1;
		}
		if(y == 'W'){
			return 2;
		}
		return 3;
	}
	return 0;
}
char c[501][501];
void Gold(){
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			cin >> c[i][j];
		}
	}
	if(m == 1){
		int cnt = 0;
		for(int i = 1 ; i < n ; i++){
			if(c[i][1] == 'X'){
				cout << "-1";
				return;
			}
			char cc = 'S';
			cnt += hm(c[i][1] , cc);
			// cout << cnt << ' ';
		}
		cout << (n - 1);
		return;
	}
}
sigma main(){
	//freopen("txt.in","r",stdin);
	//freopen("txt.out","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	srand(time(0));
	int TT = 1;
	// cin >> TT;
	for(int i = 1 ; i <= TT ; i++){
		//cout << "Case " << i << ": ";
		Gold();
	}
}
# 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 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 -