This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cmath>
#include <tuple>
using namespace std;
/*long long int power(long long int n, int k)
{
long long int vys = 1;
for (int i = 0; i < k; i++)
{
vys = (vys * (n - i)) / (i + 1);
}
return vys;
}*/
int main()
{
/*for (int i = 0; i < 10; i++)
{
std::cout << "Hello Flash!\n";
}*/
int n, m;
cin >> n >> m;
vector<vector<char>>v(m, vector<char>(n));
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
cin >> v[i][j];
}
}
if (m == 1)
{
int move = 0;
for (int i = 0; i < n-1; i++)
{
if (v[0][i] == 'X')
{
cout << -1 << endl;
return 0;
}
if (v[0][i] == 'S')
{
move += 1;
}
if (v[0][i] == 'N')
{
move += 1;
}
if (v[0][i] == 'W')
{
move += 2;
}
}
cout << move << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |