# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
969588 | 2024-04-25T10:38:47 Z | Amaarsaa | Bitaro the Brave (JOI19_ho_t1) | C++14 | 539 ms | 134232 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long ; vector < ll > O[3002], I[3002]; vector < pair < ll, ll > > J; ll A[3003][3003]; int main() { // freopen("moocast.in", "r", stdin); // freopen("moocast.out", "w", stdout); ios::sync_with_stdio(false); cin.tie(NULL); ll t, n, m, ans, s, sum, x, y, r, p, i, j; cin >> n >> m; for (i = 1; i <= n; i ++) { string str; cin >> str; for (j = 1; j <= m; j ++) { if ( str[j - 1] == 'O') { O[i].push_back(j); } if ( str[j - 1] == 'I') { I[j].push_back(i); } if ( str[j - 1] == 'J') { J.push_back({i, j}); } } } ans = 0; for ( pair < ll, ll>&P : J) { x = P.first; y = P.second; r = (upper_bound(I[y].begin(), I[y].end(), x) - I[y].begin()); r = I[y].size() - r; s = upper_bound(O[x].begin(), O[x].end(), y) - O[x].begin(); s = O[x].size() - s; ans = ans + (r * s); } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 604 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 1 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 604 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 1 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 9 ms | 3280 KB | Output is correct |
15 | Correct | 1 ms | 604 KB | Output is correct |
16 | Correct | 3 ms | 2392 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 11 ms | 4816 KB | Output is correct |
19 | Correct | 4 ms | 3412 KB | Output is correct |
20 | Correct | 5 ms | 3600 KB | Output is correct |
21 | Correct | 11 ms | 5068 KB | Output is correct |
22 | Correct | 6 ms | 4064 KB | Output is correct |
23 | Correct | 5 ms | 3480 KB | Output is correct |
24 | Correct | 11 ms | 4048 KB | Output is correct |
25 | Correct | 4 ms | 3536 KB | Output is correct |
26 | Correct | 5 ms | 3348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 604 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 1 ms | 604 KB | Output is correct |
12 | Correct | 1 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 9 ms | 3280 KB | Output is correct |
15 | Correct | 1 ms | 604 KB | Output is correct |
16 | Correct | 3 ms | 2392 KB | Output is correct |
17 | Correct | 1 ms | 604 KB | Output is correct |
18 | Correct | 11 ms | 4816 KB | Output is correct |
19 | Correct | 4 ms | 3412 KB | Output is correct |
20 | Correct | 5 ms | 3600 KB | Output is correct |
21 | Correct | 11 ms | 5068 KB | Output is correct |
22 | Correct | 6 ms | 4064 KB | Output is correct |
23 | Correct | 5 ms | 3480 KB | Output is correct |
24 | Correct | 11 ms | 4048 KB | Output is correct |
25 | Correct | 4 ms | 3536 KB | Output is correct |
26 | Correct | 5 ms | 3348 KB | Output is correct |
27 | Correct | 447 ms | 116660 KB | Output is correct |
28 | Correct | 1 ms | 860 KB | Output is correct |
29 | Correct | 15 ms | 9672 KB | Output is correct |
30 | Correct | 2 ms | 860 KB | Output is correct |
31 | Correct | 321 ms | 82916 KB | Output is correct |
32 | Correct | 159 ms | 105640 KB | Output is correct |
33 | Correct | 231 ms | 121708 KB | Output is correct |
34 | Correct | 376 ms | 117916 KB | Output is correct |
35 | Correct | 274 ms | 119344 KB | Output is correct |
36 | Correct | 233 ms | 120568 KB | Output is correct |
37 | Correct | 539 ms | 134232 KB | Output is correct |
38 | Correct | 103 ms | 72560 KB | Output is correct |
39 | Correct | 173 ms | 88480 KB | Output is correct |