Submission #276273

# Submission time Handle Problem Language Result Execution time Memory
276273 2020-08-20T11:50:35 Z JuliusMieliauskas Awesome Arrowland Adventure (eJOI19_adventure) C++14
22 / 100
1 ms 416 KB
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<long long>
#define MOD 1000000007
#define endl '\n'

typedef long long ll;

void print(vi v){
    cout<<"Contents of vector:\n";
    for(auto x : v) cout<<x<<" ";
    cout<<endl<<endl;
}

const int MAXN = 200009;
ll ar[MAXN];

ll fen[MAXN] = {0};

void upd(int p, int x) {
    for (int i = p; i < MAXN; i += i&(-i))  fen[i] += x;
}
ll get(int p) {
    // gauna sumą elementų nuo 1-ojo iki p-tojo
    ll ret = 0;
    for (int i = p; i > 0; i -= i&(-i))
        ret += fen[i];
    return ret;
}
ll get(int l, int r) {
    return get(r) - get(l-1);
}

void solve(){
    int m, n; cin>>m>>n;
    char ar[m][n];
    for(int i = 0; i<m; i++) for(int j = 0; j<n; j++) cin>>ar[i][j];

    if(m == 1){
        ll ans = 0;
        for(int i = 0; i<n-1; i++){
            if(ar[0][i] == 'N') ans++;
            if(ar[0][i] == 'S') ans += 3;
            if(ar[0][i] == 'W') ans += 2;
            if(ar[0][i] == 'X'){
                ans = -1;
                break;
            }
        }

        cout<<ans<<endl;

    }



}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    //ifstream cin(""); ofstream cout("");///cia failai

    //int T; cin>>T;
    int T = 1;

    for(int it = 1; it<=T; it++){
        solve();

    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Incorrect 1 ms 416 KB Output isn't correct
22 Halted 0 ms 0 KB -