# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963695 | 2024-04-15T13:41:59 Z | Maaxle | Bitaro the Brave (JOI19_ho_t1) | C++17 | 248 ms | 206496 KB |
#include <bits/stdc++.h> #define range(it, a, b) for (ll it = a; it < b; it++) #define all(x) begin(x), end(x) #define ll long long #define ull unsigned long long #define INF64 ((ll) 1 << 62) #define INF32 (1 << 30) #define mset multiset #define uset unordered_set #define umap unordered_map #define pqueue priority_queue #define ptr(A) shared_ptr<A> using namespace std; void setio (string name) { ios_base::sync_with_stdio(0); cin.tie(0); if (name.size()) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } struct TPos { ll i, j; }; ll h, w; ll orb[3000][3000]; ll ingot[3000][3000]; void solve() { cin >> h >> w; vector<TPos> q; char x; range(i, 0, h) { range(j, 0, w) { cin >> x; orb[i][j] = (x == 'O'); ingot[i][j] = (x == 'I'); if (x == 'J') q.push_back({i, j}); orb[i][j] += (j ? orb[i][j-1] : 0); ingot[i][j] += (i ? ingot[i-1][j] : 0); } } ll ans = 0; for (TPos& it : q) { ll o = orb[it.i][w-1] - orb[it.i][it.j]; ll i = ingot[h-1][it.j] - ingot[it.i][it.j]; ans += o*i; } cout << ans; } int main () { setio(""); ll t = 1; // cin >> t; while (t--) solve(); } // IT'S TOUGH, I KNOW // BUT YOU'D RATHER DIE FIGHTING THAN LIVE ON YOUR KNEES // THOUG H YOU WON'T DO NEITHER OF THOSE // IMPOSSIBLE, AS IT'S AGAINST YOUR NATURE // AS YOU ALREADY WON // I SEE YOUR MEDAL HANGING FROM YOUR NECK // SHINING AS NOTHING YOU'VE EVER HAD // THOUSANDS AND THOUSANDS OF LINES // YOU AREADY MADE IT THIS FAR // AND WHO COULD TELL HOW FAR YOU WILL GET... // BUT YOU? // THEN COME ON, YOU BASTARD! // GO CLEAR YOUR MIND AND STAND // AS EACH OF THOSE LINES IS A STEP CLOSER // CLOSER TO THE GREATNESS YOU PURSUE // CLOSER TO THE GREATNESS YOU ALREADY HAVE
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2648 KB | Output is correct |
2 | Correct | 2 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 4700 KB | Output is correct |
5 | Correct | 2 ms | 8796 KB | Output is correct |
6 | Correct | 2 ms | 8540 KB | Output is correct |
7 | Correct | 1 ms | 6748 KB | Output is correct |
8 | Correct | 2 ms | 8660 KB | Output is correct |
9 | Correct | 2 ms | 8792 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 2 ms | 8796 KB | Output is correct |
12 | Correct | 1 ms | 8540 KB | Output is correct |
13 | Correct | 1 ms | 6748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2648 KB | Output is correct |
2 | Correct | 2 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 4700 KB | Output is correct |
5 | Correct | 2 ms | 8796 KB | Output is correct |
6 | Correct | 2 ms | 8540 KB | Output is correct |
7 | Correct | 1 ms | 6748 KB | Output is correct |
8 | Correct | 2 ms | 8660 KB | Output is correct |
9 | Correct | 2 ms | 8792 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 2 ms | 8796 KB | Output is correct |
12 | Correct | 1 ms | 8540 KB | Output is correct |
13 | Correct | 1 ms | 6748 KB | Output is correct |
14 | Correct | 8 ms | 26328 KB | Output is correct |
15 | Correct | 3 ms | 23068 KB | Output is correct |
16 | Correct | 5 ms | 15832 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 10 ms | 26796 KB | Output is correct |
19 | Correct | 8 ms | 25660 KB | Output is correct |
20 | Correct | 8 ms | 26580 KB | Output is correct |
21 | Correct | 9 ms | 26836 KB | Output is correct |
22 | Correct | 10 ms | 26836 KB | Output is correct |
23 | Correct | 8 ms | 26792 KB | Output is correct |
24 | Correct | 10 ms | 27092 KB | Output is correct |
25 | Correct | 7 ms | 25820 KB | Output is correct |
26 | Correct | 8 ms | 26580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2648 KB | Output is correct |
2 | Correct | 2 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 4700 KB | Output is correct |
5 | Correct | 2 ms | 8796 KB | Output is correct |
6 | Correct | 2 ms | 8540 KB | Output is correct |
7 | Correct | 1 ms | 6748 KB | Output is correct |
8 | Correct | 2 ms | 8660 KB | Output is correct |
9 | Correct | 2 ms | 8792 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 2 ms | 8796 KB | Output is correct |
12 | Correct | 1 ms | 8540 KB | Output is correct |
13 | Correct | 1 ms | 6748 KB | Output is correct |
14 | Correct | 8 ms | 26328 KB | Output is correct |
15 | Correct | 3 ms | 23068 KB | Output is correct |
16 | Correct | 5 ms | 15832 KB | Output is correct |
17 | Correct | 1 ms | 4444 KB | Output is correct |
18 | Correct | 10 ms | 26796 KB | Output is correct |
19 | Correct | 8 ms | 25660 KB | Output is correct |
20 | Correct | 8 ms | 26580 KB | Output is correct |
21 | Correct | 9 ms | 26836 KB | Output is correct |
22 | Correct | 10 ms | 26836 KB | Output is correct |
23 | Correct | 8 ms | 26792 KB | Output is correct |
24 | Correct | 10 ms | 27092 KB | Output is correct |
25 | Correct | 7 ms | 25820 KB | Output is correct |
26 | Correct | 8 ms | 26580 KB | Output is correct |
27 | Correct | 248 ms | 193604 KB | Output is correct |
28 | Correct | 13 ms | 111448 KB | Output is correct |
29 | Correct | 12 ms | 19092 KB | Output is correct |
30 | Correct | 2 ms | 4956 KB | Output is correct |
31 | Correct | 124 ms | 158168 KB | Output is correct |
32 | Correct | 134 ms | 164828 KB | Output is correct |
33 | Correct | 154 ms | 196832 KB | Output is correct |
34 | Correct | 158 ms | 197476 KB | Output is correct |
35 | Correct | 175 ms | 195960 KB | Output is correct |
36 | Correct | 171 ms | 196664 KB | Output is correct |
37 | Correct | 207 ms | 206496 KB | Output is correct |
38 | Correct | 101 ms | 136768 KB | Output is correct |
39 | Correct | 101 ms | 158412 KB | Output is correct |