Submission #136745

#TimeUsernameProblemLanguageResultExecution timeMemory
136745hamzqq9Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
168 ms88572 KiB
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 2000000000
#define N 3005
#define MOD 998244353
using namespace std;

char s[N][N];
int O[N][N],I[N][N];

int main() {

	int h,w;

	scanf("%d %d",&h,&w);

	for(int i=1;i<=h;i++) scanf("%s",s[i]+1);

	for(int i=1;i<=h;i++) {

		for(int j=1;j<=w;j++) {
		
			O[i][j]=O[i][j-1]+(s[i][j]=='O');
			I[i][j]=I[i-1][j]+(s[i][j]=='I');

		}

	}

	ll ans=0;

	for(int i=1;i<=h;i++) {

		for(int j=1;j<=w;j++) {

			if(s[i][j]=='J') {

				ans+=(I[h][j]-I[i-1][j])*(O[i][w]-O[i][j-1]);

			}

		}
 
	}

	printf("%lld",ans);

}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&h,&w);
  ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:27:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=h;i++) scanf("%s",s[i]+1);
                        ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...