# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
634862 | 2022-08-25T07:25:13 Z | ghostwriter | Bitaro the Brave (JOI19_ho_t1) | C++14 | 177 ms | 53280 KB |
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include <debug.h> #endif #define st first #define nd second #define pb push_back #define pf push_front #define _pb pop_back #define _pf pop_front #define lb lower_bound #define ub upper_bound #define mtp make_tuple #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef string str; template<typename T> T gcd(T a, T b) { return (b == 0? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } #define FOR(i, l, r) for (int (i) = (l); (i) <= (r); ++(i)) #define FOS(i, r, l) for (int (i) = (r); (i) >= (l); --(i)) #define EACH(i, x) for (auto &(i) : (x)) #define WHILE while #define file "TEST" mt19937 rd(chrono::steady_clock::now().time_since_epoch().count()); ll rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rd); } /* Tran The Bao CTL - Da Lat Cay ngay cay dem nhung deo duoc cong nhan */ const int N = 3002; int h, w, d[N][N]; char a[N][N]; ll rs = 0; signed main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); // freopen(file".inp", "r", stdin); // freopen(file".out", "w", stdout); cin >> h >> w; FOR(i, 1, h) FOR(j, 1, w) cin >> a[i][j]; FOS(i, h, 1) FOR(j, 1, w) if (a[i][j] == 'I') d[i][j] = d[i + 1][j] + 1; else d[i][j] = d[i + 1][j]; FOR(i, 1, h) { int cnt = 0; FOS(j, w, 1) { if (a[i][j] == 'O') ++cnt; if (a[i][j] != 'J') continue; rs += 1LL * cnt * d[i][j]; } } cout << rs; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 980 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 976 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 1 ms | 980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 980 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 976 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 1 ms | 980 KB | Output is correct |
14 | Correct | 6 ms | 4692 KB | Output is correct |
15 | Correct | 2 ms | 3280 KB | Output is correct |
16 | Correct | 3 ms | 2648 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 7 ms | 4952 KB | Output is correct |
19 | Correct | 7 ms | 4948 KB | Output is correct |
20 | Correct | 5 ms | 4820 KB | Output is correct |
21 | Correct | 7 ms | 4948 KB | Output is correct |
22 | Correct | 5 ms | 4948 KB | Output is correct |
23 | Correct | 5 ms | 4844 KB | Output is correct |
24 | Correct | 7 ms | 4948 KB | Output is correct |
25 | Correct | 5 ms | 4948 KB | Output is correct |
26 | Correct | 7 ms | 4908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 980 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 976 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 1 ms | 980 KB | Output is correct |
14 | Correct | 6 ms | 4692 KB | Output is correct |
15 | Correct | 2 ms | 3280 KB | Output is correct |
16 | Correct | 3 ms | 2648 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 7 ms | 4952 KB | Output is correct |
19 | Correct | 7 ms | 4948 KB | Output is correct |
20 | Correct | 5 ms | 4820 KB | Output is correct |
21 | Correct | 7 ms | 4948 KB | Output is correct |
22 | Correct | 5 ms | 4948 KB | Output is correct |
23 | Correct | 5 ms | 4844 KB | Output is correct |
24 | Correct | 7 ms | 4948 KB | Output is correct |
25 | Correct | 5 ms | 4948 KB | Output is correct |
26 | Correct | 7 ms | 4908 KB | Output is correct |
27 | Correct | 177 ms | 52688 KB | Output is correct |
28 | Correct | 7 ms | 16596 KB | Output is correct |
29 | Correct | 10 ms | 4764 KB | Output is correct |
30 | Correct | 1 ms | 468 KB | Output is correct |
31 | Correct | 130 ms | 43072 KB | Output is correct |
32 | Correct | 136 ms | 53080 KB | Output is correct |
33 | Correct | 135 ms | 53016 KB | Output is correct |
34 | Correct | 161 ms | 49992 KB | Output is correct |
35 | Correct | 138 ms | 53048 KB | Output is correct |
36 | Correct | 132 ms | 52904 KB | Output is correct |
37 | Correct | 176 ms | 53280 KB | Output is correct |
38 | Correct | 105 ms | 43092 KB | Output is correct |
39 | Correct | 94 ms | 42904 KB | Output is correct |