답안 #818662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
818662 2023-08-10T06:11:13 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
596 ms 63064 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MX = 3005;
int N, M;
char grid[MX][MX];

vector<int> v[MX], vv[MX];

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

      cin >> N >> M;
      for(int i = 0; i < N; i++) {
            for(int j = 0; j < M; j++) {
                  cin >> grid[i][j];

                  if(grid[i][j] == 'O') {
                        v[i].push_back(j);
                  }

                  if(grid[i][j] == 'I') {
                        vv[j].push_back(i);
                  }
            }
      }

      ll ans = 0;
      for(int i = 0; i < N; i++) {
            for(int j = 0; j < M; j++) {
                  if(grid[i][j] != 'J') continue;

                  auto x = lower_bound(v[i].begin(), v[i].end(), j) - v[i].begin();
                  auto y = lower_bound(vv[j].begin(), vv[j].end(), i) - vv[j].begin();

                  ans += 1LL * (v[i].size() - x) * (vv[j].size() - y);
            }
      }

      cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 468 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 736 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 468 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 736 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 12 ms 2900 KB Output is correct
15 Correct 1 ms 1748 KB Output is correct
16 Correct 4 ms 1748 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 3284 KB Output is correct
19 Correct 6 ms 3284 KB Output is correct
20 Correct 6 ms 2772 KB Output is correct
21 Correct 13 ms 3296 KB Output is correct
22 Correct 7 ms 3028 KB Output is correct
23 Correct 7 ms 2784 KB Output is correct
24 Correct 16 ms 2900 KB Output is correct
25 Correct 6 ms 3284 KB Output is correct
26 Correct 5 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 468 KB Output is correct
4 Correct 0 ms 468 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 736 KB Output is correct
9 Correct 1 ms 724 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 12 ms 2900 KB Output is correct
15 Correct 1 ms 1748 KB Output is correct
16 Correct 4 ms 1748 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 13 ms 3284 KB Output is correct
19 Correct 6 ms 3284 KB Output is correct
20 Correct 6 ms 2772 KB Output is correct
21 Correct 13 ms 3296 KB Output is correct
22 Correct 7 ms 3028 KB Output is correct
23 Correct 7 ms 2784 KB Output is correct
24 Correct 16 ms 2900 KB Output is correct
25 Correct 6 ms 3284 KB Output is correct
26 Correct 5 ms 2772 KB Output is correct
27 Correct 521 ms 49220 KB Output is correct
28 Correct 4 ms 7380 KB Output is correct
29 Correct 13 ms 4308 KB Output is correct
30 Correct 2 ms 612 KB Output is correct
31 Correct 374 ms 35508 KB Output is correct
32 Correct 214 ms 63064 KB Output is correct
33 Correct 231 ms 50128 KB Output is correct
34 Correct 427 ms 40124 KB Output is correct
35 Correct 311 ms 51432 KB Output is correct
36 Correct 207 ms 50128 KB Output is correct
37 Correct 596 ms 55848 KB Output is correct
38 Correct 146 ms 43980 KB Output is correct
39 Correct 160 ms 40640 KB Output is correct