Submission #1211703

#TimeUsernameProblemLanguageResultExecution timeMemory
1211703mehraliiAwesome Arrowland Adventure (eJOI19_adventure)C++20
22 / 100
0 ms328 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define ll long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define eb emplace_back #define F fist #define S second constexpr int MAXN = 1e5; const int LOG = __lg(MAXN)+1; constexpr int INF = 1e9; constexpr int MOD = 1e9+7; constexpr double EPS = 1e-8; /* EJOI 2019, Day 2, problem A, 22p. */ int f(char c){ if (c == 'E'){ return 0; } else if (c == 'N'){ return 1; } else if (c == 'W'){ return 2; } else { return 3; } } void solve(){ int n, m; cin >> m >> n; vector<string> grid(m); for(auto& x: grid){ cin >> x; } int res = 0; for(int i = 0; i + 1 < n; i++){ if (grid[0][i] == 'X'){ cout << "-1\n"; return; } res += f(grid[0][i]); } cout << res << '\n'; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; for(int i = 1; i <= t; i++){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...