Submission #198767

# Submission time Handle Problem Language Result Execution time Memory
198767 2020-01-27T14:44:05 Z DEDA Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
486 ms 80096 KB
/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a, b) for (long long i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
// assert(x==y); gives run time when false
using namespace std;
int main(){
    CIN;
    int n,m;
    cin >> n >> m;
    vector<vector<char>> v(n,vector<char>(m));
    vii O(n,vi(m,0)),I(n,vi(m,0));
    rep(i,0,n){
        rep(j,0,m){
            cin >> v[i][j];
            if(v[i][j]=='O'){
                O[i][j]++;
            }
            if(v[i][j]=='I'){
                I[i][j]++;
            }
        }
    }
    rep(i,0,n){
        per(j,m-2,-1){
            O[i][j]+=O[i][j+1];
        }
    }
    rep(j,0,m){
        per(i,n-2,-1){
            I[i][j]+=I[i+1][j];
        }
    }
    ll sum = 0;
    rep(i,0,n){
        rep(j,0,m){
            if(v[i][j]=='J'){
                sum+=O[i][j]*I[i][j];
            }
        }
    }
    cout << sum;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 552 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 552 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 14 ms 2040 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 9 ms 1528 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 16 ms 2552 KB Output is correct
19 Correct 14 ms 2552 KB Output is correct
20 Correct 12 ms 2552 KB Output is correct
21 Correct 17 ms 2552 KB Output is correct
22 Correct 14 ms 2552 KB Output is correct
23 Correct 12 ms 2552 KB Output is correct
24 Correct 21 ms 2552 KB Output is correct
25 Correct 15 ms 2552 KB Output is correct
26 Correct 12 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 552 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 14 ms 2040 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 9 ms 1528 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 16 ms 2552 KB Output is correct
19 Correct 14 ms 2552 KB Output is correct
20 Correct 12 ms 2552 KB Output is correct
21 Correct 17 ms 2552 KB Output is correct
22 Correct 14 ms 2552 KB Output is correct
23 Correct 12 ms 2552 KB Output is correct
24 Correct 21 ms 2552 KB Output is correct
25 Correct 15 ms 2552 KB Output is correct
26 Correct 12 ms 2552 KB Output is correct
27 Correct 458 ms 75640 KB Output is correct
28 Correct 6 ms 888 KB Output is correct
29 Correct 26 ms 6008 KB Output is correct
30 Correct 6 ms 504 KB Output is correct
31 Correct 342 ms 55724 KB Output is correct
32 Correct 418 ms 79480 KB Output is correct
33 Correct 365 ms 79736 KB Output is correct
34 Correct 415 ms 64572 KB Output is correct
35 Correct 416 ms 79480 KB Output is correct
36 Correct 360 ms 79612 KB Output is correct
37 Correct 486 ms 80096 KB Output is correct
38 Correct 279 ms 55160 KB Output is correct
39 Correct 249 ms 55512 KB Output is correct