Submission #1295224

#TimeUsernameProblemLanguageResultExecution timeMemory
1295224eldaees131313Tracks in the Snow (BOI13_tracks)C++20
14.27 / 100
81 ms18232 KiB
////////////////////////////// Author:eldaee, coder_viper
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define int long long
#define str string
#define vec vector
#define dou double
#define ld long double
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define YES cout << "YES" << '\n'
#define Yes cout << "Yes" << '\n'
#define NO cout << "NO" << '\n'
#define No cout << "No" << '\n'
#define gcd __gcd
#define all(x) x.begin(),x.end()
#define eldaee ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

/*

*/

void solve() {
    int h, w;
    cin >> h >> w;
    vec<str> v(h);
    for (int i = 0; i < h; i++) {
        cin >> v[i];
    }
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (v[i][j] == 'R' || v[i][j] == 'F') {
                char c = v[i][j];
                bool l = false;
                bool u = false;
                if (j > 0) {
                    if (v[i][j - 1] == c) {
                        l = true;
                    }
                }
                if (i > 0) {
                    if (v[i - 1][j] == c) {
                        u = true;
                    }
                }
                if (l == 0 && u == 0) {
                    ans++;
                }
            }
        }
    }
    cout << ans << '\n';
}

signed main()
{
    eldaee

    solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...