Submission #133282

# Submission time Handle Problem Language Result Execution time Memory
133282 2019-07-20T10:58:52 Z osaaateiasavtnl Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
298 ms 159048 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3001;
char a[N][N];
vector <char> al = {'J', 'O', 'I'};
int get(char c) {
    for (int i = 0; i < 3; ++i) {
        if (al[i] == c) return i;
    }   
}   
int row[N][N], col[N][N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }   
    int ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        for (int j = m - 1; j >= 0; --j) {
            row[i][j] = row[i][j + 1] + (a[i][j] == 'O');
            col[i][j] = col[i + 1][j] + (a[i][j] == 'I');
            if (a[i][j] == 'J') {
                ans += row[i][j] * col[i][j];
            }   
        }   
    }   
    cout << ans << '\n';
}   

Compilation message

joi2019_ho_t1.cpp: In function 'long long int get(char)':
joi2019_ho_t1.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
 }   
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1656 KB Output is correct
6 Correct 3 ms 1656 KB Output is correct
7 Correct 3 ms 1528 KB Output is correct
8 Correct 3 ms 1656 KB Output is correct
9 Correct 3 ms 1656 KB Output is correct
10 Correct 3 ms 1528 KB Output is correct
11 Correct 3 ms 1656 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1656 KB Output is correct
6 Correct 3 ms 1656 KB Output is correct
7 Correct 3 ms 1528 KB Output is correct
8 Correct 3 ms 1656 KB Output is correct
9 Correct 3 ms 1656 KB Output is correct
10 Correct 3 ms 1528 KB Output is correct
11 Correct 3 ms 1656 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1532 KB Output is correct
14 Correct 13 ms 9080 KB Output is correct
15 Correct 6 ms 5112 KB Output is correct
16 Correct 8 ms 5288 KB Output is correct
17 Correct 2 ms 508 KB Output is correct
18 Correct 15 ms 9976 KB Output is correct
19 Correct 16 ms 9976 KB Output is correct
20 Correct 14 ms 9820 KB Output is correct
21 Correct 15 ms 9976 KB Output is correct
22 Correct 14 ms 9976 KB Output is correct
23 Correct 14 ms 9848 KB Output is correct
24 Correct 17 ms 10008 KB Output is correct
25 Correct 14 ms 9848 KB Output is correct
26 Correct 14 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1656 KB Output is correct
6 Correct 3 ms 1656 KB Output is correct
7 Correct 3 ms 1528 KB Output is correct
8 Correct 3 ms 1656 KB Output is correct
9 Correct 3 ms 1656 KB Output is correct
10 Correct 3 ms 1528 KB Output is correct
11 Correct 3 ms 1656 KB Output is correct
12 Correct 3 ms 1532 KB Output is correct
13 Correct 3 ms 1532 KB Output is correct
14 Correct 13 ms 9080 KB Output is correct
15 Correct 6 ms 5112 KB Output is correct
16 Correct 8 ms 5288 KB Output is correct
17 Correct 2 ms 508 KB Output is correct
18 Correct 15 ms 9976 KB Output is correct
19 Correct 16 ms 9976 KB Output is correct
20 Correct 14 ms 9820 KB Output is correct
21 Correct 15 ms 9976 KB Output is correct
22 Correct 14 ms 9976 KB Output is correct
23 Correct 14 ms 9848 KB Output is correct
24 Correct 17 ms 10008 KB Output is correct
25 Correct 14 ms 9848 KB Output is correct
26 Correct 14 ms 9848 KB Output is correct
27 Correct 281 ms 158472 KB Output is correct
28 Correct 26 ms 26360 KB Output is correct
29 Correct 23 ms 13944 KB Output is correct
30 Correct 3 ms 888 KB Output is correct
31 Correct 226 ms 131304 KB Output is correct
32 Correct 298 ms 158776 KB Output is correct
33 Correct 269 ms 158456 KB Output is correct
34 Correct 258 ms 152372 KB Output is correct
35 Correct 278 ms 158972 KB Output is correct
36 Correct 263 ms 158328 KB Output is correct
37 Correct 295 ms 159048 KB Output is correct
38 Correct 203 ms 130904 KB Output is correct
39 Correct 204 ms 130688 KB Output is correct