답안 #198766

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198766 2020-01-27T14:42:44 Z DEDA Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 75592 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(){
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 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 256 KB Output is correct
5 Correct 6 ms 424 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 380 KB Output is correct
10 Correct 6 ms 380 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 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 256 KB Output is correct
5 Correct 6 ms 424 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 380 KB Output is correct
10 Correct 6 ms 380 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 26 ms 2040 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 18 ms 1528 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 33 ms 2552 KB Output is correct
19 Correct 30 ms 2424 KB Output is correct
20 Correct 29 ms 2552 KB Output is correct
21 Correct 33 ms 2552 KB Output is correct
22 Correct 32 ms 2424 KB Output is correct
23 Correct 29 ms 2552 KB Output is correct
24 Correct 33 ms 2552 KB Output is correct
25 Correct 30 ms 2424 KB Output is correct
26 Correct 31 ms 2552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 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 256 KB Output is correct
5 Correct 6 ms 424 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 6 ms 380 KB Output is correct
10 Correct 6 ms 380 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 26 ms 2040 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 18 ms 1528 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 33 ms 2552 KB Output is correct
19 Correct 30 ms 2424 KB Output is correct
20 Correct 29 ms 2552 KB Output is correct
21 Correct 33 ms 2552 KB Output is correct
22 Correct 32 ms 2424 KB Output is correct
23 Correct 29 ms 2552 KB Output is correct
24 Correct 33 ms 2552 KB Output is correct
25 Correct 30 ms 2424 KB Output is correct
26 Correct 31 ms 2552 KB Output is correct
27 Execution timed out 1018 ms 75592 KB Time limit exceeded
28 Halted 0 ms 0 KB -