Submission #542017

# Submission time Handle Problem Language Result Execution time Memory
542017 2022-03-25T07:21:54 Z PixelCat Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
336 ms 80312 KB
/*       code by the cute PixelCat owo       */
/*   as cute as nacho neko (aka. my wife)!   */
//#pragma GCC optimize("O4,unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
#define int LL  //__int128
#define double long double
using namespace std;
using LL = long long;
using uLL = unsigned long long;
using pii = pair<int, int>;

#define For(i, a, b) for (int i = a; i <= b; i++)
#define Fors(i, a, b, s) for (int i = a; i <= b; i += s)
#define Forr(i, a, b) for (int i = a; i >= b; i--)
#define F first
#define S second
#define L(id) (id * 2 + 1)
#define R(id) (id * 2 + 2)
#define LO(x) (x & (-x))

#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define mkp make_pair

#define MOD (int)(1000000007)
#define INF (int)(1000000000000000ll)  // 1e15
#define EPS (1e-6)

#ifdef NYAOWO
#include "library/debug.hpp"
inline void USACO(const string &s) {
    cerr << "USACO: " << s << "\n";
}

#else
#define debug(...)
inline void timer() {}
inline void USACO(const string &s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

#endif

inline void NYA() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}
inline int gcd(int a, int b) {
    return __gcd(a, b);
}
inline int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
int fpow(int b, int p, const int &mod) {
    int ans = 1;
    while (p) {
        if (p & 1) ans = ans * b % mod;
        p /= 2;
        b = b * b % mod;
    }
    return ans;
}
template <typename T>
inline void chmin(T &_a, const T &_b) {
    if (_b < _a) _a = _b;
}
template <typename T>
inline void chmax(T &_a, const T &_b) {
    if (_b > _a) _a = _b;
}
// mt19937_64 rng(
//     chrono::steady_clock::now().time_since_epoch().count());

char g[3010][3010];
int32_t O[3010][3010];
int32_t I[3010][3010];

int32_t main() {
    NYA();
    // nyaacho >/////<
    // miku sama bless me >/////<
    int n,m; cin>>n>>m;
    For(i,1,n) For(j,1,m) cin>>g[i][j];
    For(i,1,n) Forr(j,m,1) O[i][j]=O[i][j+1]+(g[i][j]=='O');
    For(j,1,m) Forr(i,n,1) I[i][j]=I[i+1][j]+(g[i][j]=='I');
    int ans=0;
    For(i,1,n) For(j,1,m){
        if(g[i][j]=='J') ans+=O[i][j]*I[i][j];
    }
    cout<<ans<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 7 ms 7508 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 4 ms 4308 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 9 ms 8020 KB Output is correct
19 Correct 8 ms 7932 KB Output is correct
20 Correct 8 ms 7892 KB Output is correct
21 Correct 10 ms 8020 KB Output is correct
22 Correct 11 ms 7868 KB Output is correct
23 Correct 8 ms 7892 KB Output is correct
24 Correct 9 ms 8020 KB Output is correct
25 Correct 8 ms 7892 KB Output is correct
26 Correct 9 ms 7896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1492 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 7 ms 7508 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 4 ms 4308 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 9 ms 8020 KB Output is correct
19 Correct 8 ms 7932 KB Output is correct
20 Correct 8 ms 7892 KB Output is correct
21 Correct 10 ms 8020 KB Output is correct
22 Correct 11 ms 7868 KB Output is correct
23 Correct 8 ms 7892 KB Output is correct
24 Correct 9 ms 8020 KB Output is correct
25 Correct 8 ms 7892 KB Output is correct
26 Correct 9 ms 7896 KB Output is correct
27 Correct 333 ms 80192 KB Output is correct
28 Correct 13 ms 26032 KB Output is correct
29 Correct 15 ms 7508 KB Output is correct
30 Correct 1 ms 596 KB Output is correct
31 Correct 229 ms 66860 KB Output is correct
32 Correct 323 ms 80312 KB Output is correct
33 Correct 305 ms 79884 KB Output is correct
34 Correct 275 ms 77644 KB Output is correct
35 Correct 316 ms 80192 KB Output is correct
36 Correct 314 ms 80032 KB Output is correct
37 Correct 336 ms 80096 KB Output is correct
38 Correct 220 ms 66956 KB Output is correct
39 Correct 216 ms 66764 KB Output is correct