답안 #306739

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306739 2020-09-26T08:17:12 Z syy Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
400 ms 159096 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

ll h, w, ans, row[3005][3005], col[3005][3005];
char grid[3005][3005];

int main() {
	fastio; cin >> h >> w;
	FOR(i, 1, h) FOR(j, 1, w) cin >> grid[i][j];
	FOR(i, 1, h) DEC(j, w, 1) row[i][j] = row[i][j+1] + (grid[i][j] == 'O');
	FOR(i, 1, w) DEC(j, h, 1) col[i][j] = col[i][j+1] + (grid[j][i] == 'I');
	FOR(i, 1, h) FOR(j, 1, w) if (grid[i][j] == 'J') ans += row[i][j] * col[j][i];
	cout << ans;
}
# 결과 실행 시간 메모리 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 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 2 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1696 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 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 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 2 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1696 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
14 Correct 11 ms 8576 KB Output is correct
15 Correct 3 ms 3456 KB Output is correct
16 Correct 7 ms 6272 KB Output is correct
17 Correct 2 ms 1664 KB Output is correct
18 Correct 14 ms 9984 KB Output is correct
19 Correct 12 ms 9728 KB Output is correct
20 Correct 12 ms 9856 KB Output is correct
21 Correct 14 ms 9984 KB Output is correct
22 Correct 12 ms 9728 KB Output is correct
23 Correct 13 ms 9856 KB Output is correct
24 Correct 13 ms 9984 KB Output is correct
25 Correct 12 ms 9728 KB Output is correct
26 Correct 12 ms 9856 KB Output is correct
# 결과 실행 시간 메모리 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 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 2 ms 1536 KB Output is correct
8 Correct 2 ms 1664 KB Output is correct
9 Correct 2 ms 1536 KB Output is correct
10 Correct 2 ms 1696 KB Output is correct
11 Correct 2 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 2 ms 1536 KB Output is correct
14 Correct 11 ms 8576 KB Output is correct
15 Correct 3 ms 3456 KB Output is correct
16 Correct 7 ms 6272 KB Output is correct
17 Correct 2 ms 1664 KB Output is correct
18 Correct 14 ms 9984 KB Output is correct
19 Correct 12 ms 9728 KB Output is correct
20 Correct 12 ms 9856 KB Output is correct
21 Correct 14 ms 9984 KB Output is correct
22 Correct 12 ms 9728 KB Output is correct
23 Correct 13 ms 9856 KB Output is correct
24 Correct 13 ms 9984 KB Output is correct
25 Correct 12 ms 9728 KB Output is correct
26 Correct 12 ms 9856 KB Output is correct
27 Correct 384 ms 154616 KB Output is correct
28 Correct 12 ms 17024 KB Output is correct
29 Correct 32 ms 22944 KB Output is correct
30 Correct 9 ms 9984 KB Output is correct
31 Correct 289 ms 131448 KB Output is correct
32 Correct 348 ms 158584 KB Output is correct
33 Correct 350 ms 158840 KB Output is correct
34 Correct 325 ms 142972 KB Output is correct
35 Correct 363 ms 158712 KB Output is correct
36 Correct 347 ms 158840 KB Output is correct
37 Correct 400 ms 159096 KB Output is correct
38 Correct 243 ms 130556 KB Output is correct
39 Correct 246 ms 131064 KB Output is correct