답안 #139591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139591 2019-08-01T06:42:56 Z mechfrog88 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
634 ms 151416 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin >> n >> m;
    vector <string> grid(n);
    for (int z=0;z<n;z++){
        cin >> grid[z];
    }
    vector <vector<ll>> hori(n,vector<ll>(m,0));
    vector <vector<ll>> vert(n,vector<ll>(m,0));
    for (int z=0;z<n;z++){
        for (int x=m-1;x>-1;x--){
            if (grid[z][x] == 'O'){
                hori[z][x]++;
            }
            if (x != m-1) hori[z][x] += hori[z][x+1];
        }
    }
    for (int z=0;z<m;z++){
        for (int x=n-1;x>-1;x--){
            if (grid[x][z] == 'I'){
                vert[x][z]++;
            }
            if (x != n-1) vert[x][z] += vert[x+1][z];
        }
    }
    ll ans = 0;
    for (int z=0;z<n;z++){
        for (int x=0;x<m;x++){
            if (grid[z][x] == 'J'){
                ans += vert[z][x]*hori[z][x];
            }
        }
    }
    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 3 ms 508 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 3 ms 508 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 10 ms 3832 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 6 ms 2680 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 14 ms 4856 KB Output is correct
19 Correct 11 ms 4600 KB Output is correct
20 Correct 9 ms 4728 KB Output is correct
21 Correct 12 ms 4856 KB Output is correct
22 Correct 9 ms 4600 KB Output is correct
23 Correct 9 ms 4728 KB Output is correct
24 Correct 13 ms 4860 KB Output is correct
25 Correct 9 ms 4684 KB Output is correct
26 Correct 9 ms 4856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 3 ms 508 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 10 ms 3832 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 6 ms 2680 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 14 ms 4856 KB Output is correct
19 Correct 11 ms 4600 KB Output is correct
20 Correct 9 ms 4728 KB Output is correct
21 Correct 12 ms 4856 KB Output is correct
22 Correct 9 ms 4600 KB Output is correct
23 Correct 9 ms 4728 KB Output is correct
24 Correct 13 ms 4860 KB Output is correct
25 Correct 9 ms 4684 KB Output is correct
26 Correct 9 ms 4856 KB Output is correct
27 Correct 540 ms 143100 KB Output is correct
28 Correct 3 ms 1016 KB Output is correct
29 Correct 23 ms 11648 KB Output is correct
30 Correct 3 ms 760 KB Output is correct
31 Correct 378 ms 105464 KB Output is correct
32 Correct 452 ms 150540 KB Output is correct
33 Correct 450 ms 151032 KB Output is correct
34 Correct 634 ms 122232 KB Output is correct
35 Correct 478 ms 150648 KB Output is correct
36 Correct 454 ms 151032 KB Output is correct
37 Correct 575 ms 151416 KB Output is correct
38 Correct 298 ms 104440 KB Output is correct
39 Correct 299 ms 105080 KB Output is correct