Submission #1085316

# Submission time Handle Problem Language Result Execution time Memory
1085316 2024-09-07T23:50:11 Z ShaShi Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
152 ms 88660 KB
#include <bits/stdc++.h>
 
#define int long long
 
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
 
#define F first 
#define S second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define kill(x) cout << x << "\n", exit(0);
#define pii pair<int, int>
#define endl "\n"
 
 
 
using namespace std;
typedef long long ll;
// typedef __int128_t lll;
typedef long double ld;
 
const int MAXN = (int)3e3 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 + 7;


int n, m, k, tmp, t, tmp2, tmp3, tmp4, u, v, w, flag, q, ans, flag2;
char arr[MAXN][MAXN];
int ps[MAXN][MAXN];


int32_t main() {
    #ifdef LOCAL
    freopen("inp.in", "r", stdin);
    freopen("res.out", "w", stdout);
    #else
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    cin >> n >> m;

    for (int i=1; i<=n; i++) for (int j=1; j<=m; j++) cin >> arr[i][j];

    for (int i=1; i<=n; i++) {
        tmp = 0;

        for (int j=m; j>=1; j--) {
            tmp += (arr[i][j] == 'O');

            if (arr[i][j] == 'J') ps[i][j] += tmp;

            ps[i][j] += ps[i-1][j];

            if (arr[i][j] == 'I') ans += ps[i][j];
        }
    }
    
    cout << ans << endl;


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 5 ms 5464 KB Output is correct
15 Correct 1 ms 3420 KB Output is correct
16 Correct 3 ms 3240 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 5 ms 6116 KB Output is correct
19 Correct 4 ms 5980 KB Output is correct
20 Correct 5 ms 5980 KB Output is correct
21 Correct 6 ms 5980 KB Output is correct
22 Correct 5 ms 5980 KB Output is correct
23 Correct 5 ms 6000 KB Output is correct
24 Correct 6 ms 5980 KB Output is correct
25 Correct 4 ms 5980 KB Output is correct
26 Correct 5 ms 5976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 5 ms 5464 KB Output is correct
15 Correct 1 ms 3420 KB Output is correct
16 Correct 3 ms 3240 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 5 ms 6116 KB Output is correct
19 Correct 4 ms 5980 KB Output is correct
20 Correct 5 ms 5980 KB Output is correct
21 Correct 6 ms 5980 KB Output is correct
22 Correct 5 ms 5980 KB Output is correct
23 Correct 5 ms 6000 KB Output is correct
24 Correct 6 ms 5980 KB Output is correct
25 Correct 4 ms 5980 KB Output is correct
26 Correct 5 ms 5976 KB Output is correct
27 Correct 146 ms 88180 KB Output is correct
28 Correct 7 ms 16732 KB Output is correct
29 Correct 9 ms 7932 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 122 ms 72700 KB Output is correct
32 Correct 115 ms 88404 KB Output is correct
33 Correct 123 ms 88400 KB Output is correct
34 Correct 129 ms 84276 KB Output is correct
35 Correct 116 ms 88404 KB Output is correct
36 Correct 110 ms 88404 KB Output is correct
37 Correct 152 ms 88660 KB Output is correct
38 Correct 81 ms 72272 KB Output is correct
39 Correct 84 ms 72300 KB Output is correct