Submission #261252

# Submission time Handle Problem Language Result Execution time Memory
261252 2020-08-11T15:27:25 Z Valera_Grinenko Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
282 ms 89628 KB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
char a[3042][3042];
int orb[3042][3042] = {0}, ing[3042][3042] = {0};
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  ll ans = 0;

  int h, w;

  cin >> h >> w;

  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
      cin >> a[i][j];

  for(int i = h - 1; i >= 0; i--)
    for(int j = w - 1; j >= 0; j--) {
      orb[i][j] = orb[i][j + 1] + (a[i][j] == 'O');
      ing[i][j] = ing[i + 1][j] + (a[i][j] == 'I');
    }

  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++)
      if(a[i][j] == 'J')
        ans += 1ll * orb[i][j + 1] * ing[i + 1][j];

  cout << ans;

  return 0;
}
/*

*/

Compilation message

joi2019_ho_t1.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 2 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 2 ms 1536 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 ms 1536 KB Output is correct
13 Correct 2 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 2 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 2 ms 1536 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 ms 1536 KB Output is correct
13 Correct 2 ms 1408 KB Output is correct
14 Correct 15 ms 7552 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 10 ms 4352 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 21 ms 8064 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 10 ms 7936 KB Output is correct
21 Correct 12 ms 8064 KB Output is correct
22 Correct 13 ms 7936 KB Output is correct
23 Correct 13 ms 7936 KB Output is correct
24 Correct 11 ms 8064 KB Output is correct
25 Correct 11 ms 7936 KB Output is correct
26 Correct 10 ms 7936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 2 ms 1536 KB Output is correct
6 Correct 2 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 2 ms 1536 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 ms 1536 KB Output is correct
13 Correct 2 ms 1408 KB Output is correct
14 Correct 15 ms 7552 KB Output is correct
15 Correct 4 ms 4992 KB Output is correct
16 Correct 10 ms 4352 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 21 ms 8064 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 10 ms 7936 KB Output is correct
21 Correct 12 ms 8064 KB Output is correct
22 Correct 13 ms 7936 KB Output is correct
23 Correct 13 ms 7936 KB Output is correct
24 Correct 11 ms 8064 KB Output is correct
25 Correct 11 ms 7936 KB Output is correct
26 Correct 10 ms 7936 KB Output is correct
27 Correct 282 ms 89192 KB Output is correct
28 Correct 18 ms 26112 KB Output is correct
29 Correct 16 ms 7936 KB Output is correct
30 Correct 1 ms 640 KB Output is correct
31 Correct 169 ms 73532 KB Output is correct
32 Correct 215 ms 89480 KB Output is correct
33 Correct 215 ms 89208 KB Output is correct
34 Correct 218 ms 85200 KB Output is correct
35 Correct 217 ms 89464 KB Output is correct
36 Correct 220 ms 89208 KB Output is correct
37 Correct 261 ms 89628 KB Output is correct
38 Correct 161 ms 73372 KB Output is correct
39 Correct 151 ms 73208 KB Output is correct