답안 #418219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418219 2021-06-05T08:28:16 Z tgehr Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
157 ms 151328 KB
// -*- compile-command: "g++ -g -Wno-return-type -Wall -Wextra -DLOCAL -std=c++17 -D_GLIBCXX_DEBUG ho_t1.cpp -oho_t1 && ./ho_t1 " -*-
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#define int LL
#define vc vector
#define pb push_back
#define pr pair
#define fi first
#define se second
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define f(i,n) for(int i=0;i<(n);i++)
#define fr(i,n) for(int i=(n);i--;)
#define fv(i,v) f(i,sz(v))

main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int h,w;
	cin>>h>>w;
	vc<string> s(h);
	f(i,h) cin>>s[i];
	vc<vc<int>> ning(h,vc<int>(w));
	vc<vc<int>> norb(h,vc<int>(w));
	fr(i,h) fr(j,w){
		ning[i][j]+=(s[i][j]=='I')+(i+1<h?ning[i+1][j]:0);
		norb[i][j]+=(s[i][j]=='O')+(j+1<w?norb[i][j+1]:0);
	}
	int r=0;
	f(i,h) f(j,w){
		if(s[i][j]=='J') r+=ning[i][j]*norb[i][j];
	}
	cout<<r<<'\n';
}

Compilation message

joi2019_ho_t1.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 4 ms 3652 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 2508 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 5 ms 4556 KB Output is correct
19 Correct 5 ms 4408 KB Output is correct
20 Correct 4 ms 4556 KB Output is correct
21 Correct 6 ms 4556 KB Output is correct
22 Correct 4 ms 4428 KB Output is correct
23 Correct 4 ms 4556 KB Output is correct
24 Correct 5 ms 4556 KB Output is correct
25 Correct 4 ms 4420 KB Output is correct
26 Correct 4 ms 4556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 4 ms 3652 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 2508 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 5 ms 4556 KB Output is correct
19 Correct 5 ms 4408 KB Output is correct
20 Correct 4 ms 4556 KB Output is correct
21 Correct 6 ms 4556 KB Output is correct
22 Correct 4 ms 4428 KB Output is correct
23 Correct 4 ms 4556 KB Output is correct
24 Correct 5 ms 4556 KB Output is correct
25 Correct 4 ms 4420 KB Output is correct
26 Correct 4 ms 4556 KB Output is correct
27 Correct 143 ms 142856 KB Output is correct
28 Correct 2 ms 844 KB Output is correct
29 Correct 9 ms 11324 KB Output is correct
30 Correct 1 ms 716 KB Output is correct
31 Correct 106 ms 105104 KB Output is correct
32 Correct 120 ms 150360 KB Output is correct
33 Correct 116 ms 150832 KB Output is correct
34 Correct 119 ms 121972 KB Output is correct
35 Correct 126 ms 150356 KB Output is correct
36 Correct 120 ms 150892 KB Output is correct
37 Correct 157 ms 151328 KB Output is correct
38 Correct 85 ms 104268 KB Output is correct
39 Correct 82 ms 104716 KB Output is correct