Submission #717828

#TimeUsernameProblemLanguageResultExecution timeMemory
717828vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
67 ms388 KiB
#include <bits/stdc++.h> using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x:v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cerr << endl; } template<typename Head, typename ... Tail> void dbg_out(Head H, Tail ... T) { cerr << ' ' << H; dbg_out(T...); } #ifdef LOCAL #define dbg(...) cerr << '(' << #__VA_ARGS__ << '):', dbg_out(__VA_ARGS__) #else #define dbg(...) #endif #define ll long long #define pii pair<int, int> #define mii map<int, int> #define vii vector<int, int> #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define all(x) (x).begin() , (x).end() int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n, m, res = 0; cin >> n >> m; ll a[m] = {0}; for (ll i = 0; i < n; i++) { string s; cin >> s; ll k = 0; for (ll j = m - 1; j >= 0; j--) { if (s[j] == 'O') k++; else if (s[j] == 'J') a[j] += k; else res += a[j]; } } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...