답안 #1071027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071027 2024-08-23T01:43:17 Z sitablechair Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
201 ms 88556 KB
#include <bits/stdc++.h>

#define ll long long
#define ldb long double
#define endl '\n'
#define For(i,l,r) for(int i=l;i<=r;i++)
#define ForD(i,r,l) for(int i=r;i>=l;i--)
#define REP(i,l,r) For(i,l,r-1)
#define PER(i,r,l) ForD(i,r-1,l)
#define ff first
#define ss second
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define All(x,n) x+1,x+1+n
#define Alll(x,n) x,x+n
#define sz(x) (signed)x.size()
#define unq(x) x.resize(unique(all(x))-x.begin())
#define mpa make_pair

#ifdef NCGM
#include"debug.h"
#else 
#define debug(...) "fr";
#endif

using namespace std;

const int N=3003;

int pfX[N][N],pfY[N][N];
int n,m;
ll ans=0;
char c[N][N];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> m;
    For(i,1,n) 
        For(j,1,m) cin >> c[i][j];
    For(i,1,n) {
        For(j,1,m) {
            pfY[i][j]=pfY[i][j-1];
            if (c[i][j]=='O') pfY[i][j]++;
        }
    }
    For(j,1,m) {
        For(i,1,n) {
            pfX[i][j]=pfX[i-1][j];
            if (c[i][j]=='I') pfX[i][j]++;
        }
    }
    For(i,1,n)
        For(j,1,m) if (c[i][j]=='J') {
            ll num1=pfX[n][j]-pfX[i-1][j],num2=pfY[i][m]-pfY[i][j-1];
            ans+=num1*num2;
        }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 4956 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 4956 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 4956 KB Output is correct
14 Correct 6 ms 13404 KB Output is correct
15 Correct 1 ms 10332 KB Output is correct
16 Correct 3 ms 8028 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 7 ms 13916 KB Output is correct
19 Correct 5 ms 13660 KB Output is correct
20 Correct 6 ms 13736 KB Output is correct
21 Correct 7 ms 13916 KB Output is correct
22 Correct 6 ms 13660 KB Output is correct
23 Correct 5 ms 13660 KB Output is correct
24 Correct 7 ms 13912 KB Output is correct
25 Correct 6 ms 13660 KB Output is correct
26 Correct 5 ms 13660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 4956 KB Output is correct
8 Correct 1 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 4956 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 4956 KB Output is correct
14 Correct 6 ms 13404 KB Output is correct
15 Correct 1 ms 10332 KB Output is correct
16 Correct 3 ms 8028 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 7 ms 13916 KB Output is correct
19 Correct 5 ms 13660 KB Output is correct
20 Correct 6 ms 13736 KB Output is correct
21 Correct 7 ms 13916 KB Output is correct
22 Correct 6 ms 13660 KB Output is correct
23 Correct 5 ms 13660 KB Output is correct
24 Correct 7 ms 13912 KB Output is correct
25 Correct 6 ms 13660 KB Output is correct
26 Correct 5 ms 13660 KB Output is correct
27 Correct 165 ms 87892 KB Output is correct
28 Correct 8 ms 46680 KB Output is correct
29 Correct 10 ms 10588 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 121 ms 75504 KB Output is correct
32 Correct 127 ms 88556 KB Output is correct
33 Correct 121 ms 88404 KB Output is correct
34 Correct 142 ms 84716 KB Output is correct
35 Correct 127 ms 88400 KB Output is correct
36 Correct 114 ms 88404 KB Output is correct
37 Correct 201 ms 88400 KB Output is correct
38 Correct 87 ms 75512 KB Output is correct
39 Correct 83 ms 75604 KB Output is correct