답안 #987808

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
987808 2024-05-23T15:47:44 Z 0pt1mus23 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
214 ms 20272 KB
#pragma GCC optimize("O3", "inline")
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define ins insert
#define pb push_back
#define int long long
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl;return;
#define reach cerr << "reached >.<!" << endl;
/*
    m : 11059739 -> l ~23
    p : 4567896467
*/
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7, sze = 1e6 + 50, inf = LLONG_MAX, prime = 2333;

//\\
dp / binary search / greedy / sprase table / segment tree 
//
int rowo[sze];
int coli[sze];
void gkd(){
    int n,m;
    cin>>n>>m;
    vector<vector<char>> arr(n+1,vector<char>(m+1));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>arr[i][j];
        }
    }



    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){

            if(arr[i][j]=='O'){
                rowo[i]++;
            }
            else if(arr[i][j]=='I'){
                coli[j]++;
            }

        }
    }
    int ans=0;

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(arr[i][j]=='I'){
                coli[j]--;
            }
        }

        for(int j=1;j<=m;j++){
            if(arr[i][j]=='J'){
                // cout<<i<<" "<<j<<" "<<rowo[i]*coli[j]<<endl;
                ans+= rowo[i] * coli[j];
            }
            else if(arr[i][j]=='O'){
                rowo[i]--;
            }
        }
    }
    drop(ans);
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int tt = 1; //cin>>tt;
    while (tt--)gkd();
}

Compilation message

joi2019_ho_t1.cpp:19:1: warning: multi-line comment [-Wcomment]
   19 | //\\
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2520 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2392 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2520 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2392 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 6 ms 2908 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 3 ms 2652 KB Output is correct
17 Correct 1 ms 2512 KB Output is correct
18 Correct 7 ms 2908 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3160 KB Output is correct
21 Correct 7 ms 2904 KB Output is correct
22 Correct 4 ms 2904 KB Output is correct
23 Correct 5 ms 2908 KB Output is correct
24 Correct 7 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 5 ms 2916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2520 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2392 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 6 ms 2908 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 3 ms 2652 KB Output is correct
17 Correct 1 ms 2512 KB Output is correct
18 Correct 7 ms 2908 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3160 KB Output is correct
21 Correct 7 ms 2904 KB Output is correct
22 Correct 4 ms 2904 KB Output is correct
23 Correct 5 ms 2908 KB Output is correct
24 Correct 7 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 5 ms 2916 KB Output is correct
27 Correct 214 ms 19104 KB Output is correct
28 Correct 3 ms 2520 KB Output is correct
29 Correct 11 ms 3764 KB Output is correct
30 Correct 2 ms 2392 KB Output is correct
31 Correct 157 ms 14836 KB Output is correct
32 Correct 114 ms 20112 KB Output is correct
33 Correct 98 ms 20112 KB Output is correct
34 Correct 173 ms 16716 KB Output is correct
35 Correct 114 ms 20036 KB Output is correct
36 Correct 98 ms 20052 KB Output is correct
37 Correct 199 ms 20272 KB Output is correct
38 Correct 76 ms 14676 KB Output is correct
39 Correct 71 ms 14548 KB Output is correct