Submission #702484

# Submission time Handle Problem Language Result Execution time Memory
702484 2023-02-24T07:47:27 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
498 ms 150304 KB
//~ #pragma GCC optimize("Ofast,unroll-loops")
//~ #pragma GCC target("avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define fi first
#define se second
#define space " "
#define endl "\n"
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define md 1000000007
#define inf 1000000000
#define li 3005
#define int long long
using namespace std;
int n,m,prei[li][li],preo[li][li],flag;
char c[li][li];
int32_t main(){
	scanf("%lld %lld",&n,&m);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			scanf(" %c",&c[i][j]);
		}
	}
	for(int i=n;i>=1;i--){
		for(int j=m;j>=1;j--){
			if(j!=m){
				preo[i][j]=preo[i][j+1];
				if(c[i][j+1]=='O') preo[i][j]++;
			}
			if(i!=n){
				prei[i][j]=prei[i+1][j];
				if(c[i+1][j]=='I') prei[i][j]++;
			}
			if(c[i][j]=='J') flag+=prei[i][j]*preo[i][j];
		}
	}
	printf("%lld\n",flag);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int32_t main()':
joi2019_ho_t1.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |  scanf("%lld %lld",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:25:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |    scanf(" %c",&c[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 4 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 4 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 13 ms 8788 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 8 ms 5104 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 18 ms 9644 KB Output is correct
19 Correct 16 ms 9516 KB Output is correct
20 Correct 14 ms 9504 KB Output is correct
21 Correct 16 ms 9684 KB Output is correct
22 Correct 14 ms 9548 KB Output is correct
23 Correct 20 ms 9416 KB Output is correct
24 Correct 15 ms 9692 KB Output is correct
25 Correct 15 ms 9468 KB Output is correct
26 Correct 15 ms 9428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 4 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 13 ms 8788 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 8 ms 5104 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 18 ms 9644 KB Output is correct
19 Correct 16 ms 9516 KB Output is correct
20 Correct 14 ms 9504 KB Output is correct
21 Correct 16 ms 9684 KB Output is correct
22 Correct 14 ms 9548 KB Output is correct
23 Correct 20 ms 9416 KB Output is correct
24 Correct 15 ms 9692 KB Output is correct
25 Correct 15 ms 9468 KB Output is correct
26 Correct 15 ms 9428 KB Output is correct
27 Correct 498 ms 150172 KB Output is correct
28 Correct 13 ms 26164 KB Output is correct
29 Correct 34 ms 13204 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 329 ms 125168 KB Output is correct
32 Correct 431 ms 150148 KB Output is correct
33 Correct 451 ms 149836 KB Output is correct
34 Correct 391 ms 145176 KB Output is correct
35 Correct 441 ms 150304 KB Output is correct
36 Correct 430 ms 149716 KB Output is correct
37 Correct 458 ms 150248 KB Output is correct
38 Correct 352 ms 124740 KB Output is correct
39 Correct 305 ms 124624 KB Output is correct