답안 #331523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331523 2020-11-28T18:51:38 Z limabeans Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
148 ms 89452 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 3001;



int n, m;
string g[maxn];
int O[maxn][maxn];
int I[maxn][maxn];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    cin>>n>>m;
    for (int i=0; i<n; i++) {
	cin>>g[i];
    }

    for (int i=0; i<n; i++) {
	for (int j=m-1; j>=0; j--) {
	    O[i][j]=(g[i][j]=='O')+O[i][j+1];
	}
    }

    for (int i=n-1; i>=0; i--) {
	for (int j=0; j<m; j++) {
	    I[i][j]=(g[i][j]=='I')+I[i+1][j];
	}
    }

    ll res = 0;

    for (int i=0; i<n; i++) {
	for (int j=0; j<m; j++) {
	    if (g[i][j]=='J') {
		res += 1ll*O[i][j+1]*I[i+1][j];
	    }
	}
    }

    cout<<res<<endl;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1388 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1388 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 6 ms 6380 KB Output is correct
15 Correct 3 ms 3820 KB Output is correct
16 Correct 4 ms 3820 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 7 ms 6892 KB Output is correct
19 Correct 6 ms 6764 KB Output is correct
20 Correct 6 ms 6764 KB Output is correct
21 Correct 7 ms 6892 KB Output is correct
22 Correct 6 ms 6764 KB Output is correct
23 Correct 6 ms 6764 KB Output is correct
24 Correct 7 ms 6892 KB Output is correct
25 Correct 7 ms 6764 KB Output is correct
26 Correct 6 ms 6784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 1388 KB Output is correct
6 Correct 1 ms 1260 KB Output is correct
7 Correct 1 ms 1260 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1260 KB Output is correct
10 Correct 1 ms 1260 KB Output is correct
11 Correct 2 ms 1388 KB Output is correct
12 Correct 1 ms 1260 KB Output is correct
13 Correct 1 ms 1260 KB Output is correct
14 Correct 6 ms 6380 KB Output is correct
15 Correct 3 ms 3820 KB Output is correct
16 Correct 4 ms 3820 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 7 ms 6892 KB Output is correct
19 Correct 6 ms 6764 KB Output is correct
20 Correct 6 ms 6764 KB Output is correct
21 Correct 7 ms 6892 KB Output is correct
22 Correct 6 ms 6764 KB Output is correct
23 Correct 6 ms 6764 KB Output is correct
24 Correct 7 ms 6892 KB Output is correct
25 Correct 7 ms 6764 KB Output is correct
26 Correct 6 ms 6784 KB Output is correct
27 Correct 144 ms 88428 KB Output is correct
28 Correct 13 ms 19308 KB Output is correct
29 Correct 9 ms 7916 KB Output is correct
30 Correct 1 ms 748 KB Output is correct
31 Correct 101 ms 71916 KB Output is correct
32 Correct 118 ms 89324 KB Output is correct
33 Correct 116 ms 89452 KB Output is correct
34 Correct 116 ms 83308 KB Output is correct
35 Correct 110 ms 89324 KB Output is correct
36 Correct 103 ms 89196 KB Output is correct
37 Correct 148 ms 89452 KB Output is correct
38 Correct 80 ms 71788 KB Output is correct
39 Correct 76 ms 71660 KB Output is correct