답안 #99660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99660 2019-03-06T04:49:16 Z cki86201 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
228 ms 84936 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N, M;
char X[3030][3030];
ll ans;
int cnt[3030][3030][2];

int main() {
	scanf("%d%d", &N, &M);
	for(int i=1;i<=N;i++) scanf("%s", X[i] + 1);
	for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) {
		if(X[i][j] == 'O') cnt[i][j][0]++;
		if(X[i][j] == 'I') cnt[i][j][1]++;
	}
	for(int i=N;i;i--) for(int j=M;j;j--) {
		cnt[i][j][0] += cnt[i][j+1][0];
		cnt[i][j][1] += cnt[i+1][j][1];
	}
	for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) if(X[i][j] == 'J') {
		ans += (ll)cnt[i][j][0] * cnt[i][j][1];
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:39:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=N;i++) scanf("%s", X[i] + 1);
                        ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 1152 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 2 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 2 ms 1024 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 1152 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 2 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 2 ms 1024 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
14 Correct 10 ms 5504 KB Output is correct
15 Correct 4 ms 3328 KB Output is correct
16 Correct 6 ms 3240 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 6016 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 9 ms 5888 KB Output is correct
21 Correct 12 ms 6016 KB Output is correct
22 Correct 9 ms 5888 KB Output is correct
23 Correct 10 ms 5888 KB Output is correct
24 Correct 11 ms 6012 KB Output is correct
25 Correct 9 ms 5888 KB Output is correct
26 Correct 7 ms 5888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 1152 KB Output is correct
6 Correct 4 ms 1024 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 2 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 2 ms 1024 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
14 Correct 10 ms 5504 KB Output is correct
15 Correct 4 ms 3328 KB Output is correct
16 Correct 6 ms 3240 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 6016 KB Output is correct
19 Correct 9 ms 5888 KB Output is correct
20 Correct 9 ms 5888 KB Output is correct
21 Correct 12 ms 6016 KB Output is correct
22 Correct 9 ms 5888 KB Output is correct
23 Correct 10 ms 5888 KB Output is correct
24 Correct 11 ms 6012 KB Output is correct
25 Correct 9 ms 5888 KB Output is correct
26 Correct 7 ms 5888 KB Output is correct
27 Correct 213 ms 84100 KB Output is correct
28 Correct 15 ms 16812 KB Output is correct
29 Correct 17 ms 7780 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 171 ms 69860 KB Output is correct
32 Correct 154 ms 84828 KB Output is correct
33 Correct 140 ms 84600 KB Output is correct
34 Correct 188 ms 80376 KB Output is correct
35 Correct 152 ms 84936 KB Output is correct
36 Correct 130 ms 84600 KB Output is correct
37 Correct 228 ms 84840 KB Output is correct
38 Correct 107 ms 69496 KB Output is correct
39 Correct 114 ms 69608 KB Output is correct