Submission #775472

#TimeUsernameProblemLanguageResultExecution timeMemory
775472Trisanu_DasBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
178 ms20456 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
 main () {
	int h, w;
	cin >> h >> w;
	string v[h];
	for(int i = 0;i<h;i++)cin>>v[i];
	int cnt[w] = {0}, ans = 0, k = 0;
	for(int i = h-1;i>=0;i--) {
		k = 0;
		for(int j = w-1;j>=0;j--) {
			if(v[i][j] == 'J')ans+=cnt[j]*k;
			else if(v[i][j] == 'O')k++;
			else cnt[j]++;
		}
	}
	cout<<ans<<endl;
}

Compilation message (stderr)

joi2019_ho_t1.cpp:4:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 |  main () {
      |  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...