답안 #369332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
369332 2021-02-21T10:22:10 Z parsabahrami Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
346 ms 88700 KB
// Call my Name and Save me from The Dark
#include <bits/stdc++.h>
 
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
 
#define SZ(x)                       (int) x.size()
#define F                           first
#define S                           second

const int N = 3e3 + 10, MOD = 1e9 + 7;
char A[N][N]; int n, m, I[N][N], O[N][N]; 

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%s", A[i] + 1);
    }
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= 1; j--) O[i][j] = O[i][j + 1] + (A[i][j] == 'O');
    }
    for (int j = 1; j <= m; j++) {
        for (int i = n; i >= 1; i--) {
            I[i][j] = I[i + 1][j] + (A[i][j] == 'I');
        }
    }
    ll ret = 0;
    for (int i = 1; i <= n; i++) 
        for (int j = 1; j <= m; j++) if (A[i][j] == 'J') ret += 1ll * O[i][j] * I[i][j];
    printf("%lld\n", ret);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |         scanf("%s", A[i] + 1);
      |         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1516 KB Output is correct
6 Correct 1 ms 1516 KB Output is correct
7 Correct 2 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1516 KB Output is correct
10 Correct 2 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 1 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1516 KB Output is correct
6 Correct 1 ms 1516 KB Output is correct
7 Correct 2 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1516 KB Output is correct
10 Correct 2 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 1 ms 1388 KB Output is correct
14 Correct 9 ms 7532 KB Output is correct
15 Correct 5 ms 4972 KB Output is correct
16 Correct 5 ms 4332 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 9 ms 8044 KB Output is correct
19 Correct 10 ms 7916 KB Output is correct
20 Correct 10 ms 7916 KB Output is correct
21 Correct 9 ms 8044 KB Output is correct
22 Correct 10 ms 7916 KB Output is correct
23 Correct 8 ms 7916 KB Output is correct
24 Correct 9 ms 8044 KB Output is correct
25 Correct 9 ms 7916 KB Output is correct
26 Correct 8 ms 7916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 1516 KB Output is correct
6 Correct 1 ms 1516 KB Output is correct
7 Correct 2 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 2 ms 1516 KB Output is correct
10 Correct 2 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 1 ms 1388 KB Output is correct
14 Correct 9 ms 7532 KB Output is correct
15 Correct 5 ms 4972 KB Output is correct
16 Correct 5 ms 4332 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 9 ms 8044 KB Output is correct
19 Correct 10 ms 7916 KB Output is correct
20 Correct 10 ms 7916 KB Output is correct
21 Correct 9 ms 8044 KB Output is correct
22 Correct 10 ms 7916 KB Output is correct
23 Correct 8 ms 7916 KB Output is correct
24 Correct 9 ms 8044 KB Output is correct
25 Correct 9 ms 7916 KB Output is correct
26 Correct 8 ms 7916 KB Output is correct
27 Correct 339 ms 88140 KB Output is correct
28 Correct 18 ms 26092 KB Output is correct
29 Correct 13 ms 7788 KB Output is correct
30 Correct 1 ms 620 KB Output is correct
31 Correct 244 ms 72772 KB Output is correct
32 Correct 321 ms 88684 KB Output is correct
33 Correct 315 ms 88524 KB Output is correct
34 Correct 286 ms 84276 KB Output is correct
35 Correct 317 ms 88556 KB Output is correct
36 Correct 308 ms 88428 KB Output is correct
37 Correct 346 ms 88700 KB Output is correct
38 Correct 220 ms 72808 KB Output is correct
39 Correct 221 ms 72428 KB Output is correct