Submission #111950

# Submission time Handle Problem Language Result Execution time Memory
111950 2019-05-16T23:20:23 Z Lawliet Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
566 ms 30816 KB
#include <bits/stdc++.h>

#define MAX 1010

using namespace std;
typedef long long int lli;

int n, m;

lli ans;

lli sO[MAX][MAX];
lli sI[MAX][MAX];

char v[MAX][MAX];

int main()
{
	scanf("%d %d",&n,&m);
	
	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= m ; h++)
			scanf(" %c",&v[g][h]);
			
	for(int g = 1 ; g <= n ; g++)
		for(int h = m ; h > 0 ; h--)
			sO[g][h] = sO[g][h + 1] + ((v[g][h] == 'O') ? 1 : 0);
			
	for(int g = n ; g > 0 ; g--)
		for(int h = 1 ; h <= m ; h++)
			sI[g][h] = sI[g + 1][h] + ((v[g][h] == 'I') ? 1 : 0);
	
	for(int g = 1 ; g <= n ; g++)
		for(int h = 1 ; h <= m ; h++)
			if(v[g][h] == 'J')
				ans += sO[g][h] * sI[g][h];
				
	printf("%lld\n",ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:19: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:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&v[g][h]);
    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 356 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 4 ms 1408 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 4 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 4 ms 1280 KB Output is correct
11 Correct 4 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 3 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 356 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 4 ms 1408 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 4 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 4 ms 1280 KB Output is correct
11 Correct 4 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 3 ms 1280 KB Output is correct
14 Correct 24 ms 8064 KB Output is correct
15 Correct 5 ms 4224 KB Output is correct
16 Correct 12 ms 4736 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 22 ms 8952 KB Output is correct
19 Correct 20 ms 8952 KB Output is correct
20 Correct 20 ms 8824 KB Output is correct
21 Correct 22 ms 8960 KB Output is correct
22 Correct 20 ms 8832 KB Output is correct
23 Correct 22 ms 8764 KB Output is correct
24 Correct 24 ms 8952 KB Output is correct
25 Correct 21 ms 8832 KB Output is correct
26 Correct 28 ms 8824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 356 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 4 ms 1408 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 4 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 4 ms 1280 KB Output is correct
11 Correct 4 ms 1408 KB Output is correct
12 Correct 4 ms 1280 KB Output is correct
13 Correct 3 ms 1280 KB Output is correct
14 Correct 24 ms 8064 KB Output is correct
15 Correct 5 ms 4224 KB Output is correct
16 Correct 12 ms 4736 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 22 ms 8952 KB Output is correct
19 Correct 20 ms 8952 KB Output is correct
20 Correct 20 ms 8824 KB Output is correct
21 Correct 22 ms 8960 KB Output is correct
22 Correct 20 ms 8832 KB Output is correct
23 Correct 22 ms 8764 KB Output is correct
24 Correct 24 ms 8952 KB Output is correct
25 Correct 21 ms 8832 KB Output is correct
26 Correct 28 ms 8824 KB Output is correct
27 Runtime error 566 ms 30816 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -