#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli test=1;
for(;test>0;--test)
{
lli h,w,ans=0;
cin>>h>>w;
char a[h][w];
lli b[h][w]={};
for(lli i=0;i<h;++i)
{
for(lli j=0;j<w;++j)
cin>>a[i][j];
}
for(lli i=0;i<h;++i)
{
lli c=0;
for(lli j=w-1;j>=0;--j)
{
if(a[i][j]=='O')
c++;
else if(a[i][j]=='J')
b[i][j]=c;
}
}
for(lli j=0;j<w;++j)
{
lli c=0;
for(lli i=h-1;i>=0;--i)
{
if(a[i][j]=='I')
c++;
else if(a[i][j]=='J')
b[i][j]*=c;
}
}
for(lli i=0;i<h;++i)
for(lli j=0;j<w;++j)
ans+=b[i][j];
cout<<ans<<endl;
}
return(0);
}
Compilation message
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:55:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(lli i=0;i<h;++i)
^~~
joi2019_ho_t1.cpp:58:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
cout<<ans<<endl;
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
11 ms |
2192 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
7 ms |
1536 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
13 ms |
2816 KB |
Output is correct |
19 |
Correct |
10 ms |
2688 KB |
Output is correct |
20 |
Correct |
10 ms |
2688 KB |
Output is correct |
21 |
Correct |
13 ms |
2816 KB |
Output is correct |
22 |
Correct |
10 ms |
2688 KB |
Output is correct |
23 |
Correct |
10 ms |
2688 KB |
Output is correct |
24 |
Correct |
14 ms |
2816 KB |
Output is correct |
25 |
Correct |
10 ms |
2688 KB |
Output is correct |
26 |
Correct |
10 ms |
2688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
11 ms |
2192 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
7 ms |
1536 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
13 ms |
2816 KB |
Output is correct |
19 |
Correct |
10 ms |
2688 KB |
Output is correct |
20 |
Correct |
10 ms |
2688 KB |
Output is correct |
21 |
Correct |
13 ms |
2816 KB |
Output is correct |
22 |
Correct |
10 ms |
2688 KB |
Output is correct |
23 |
Correct |
10 ms |
2688 KB |
Output is correct |
24 |
Correct |
14 ms |
2816 KB |
Output is correct |
25 |
Correct |
10 ms |
2688 KB |
Output is correct |
26 |
Correct |
10 ms |
2688 KB |
Output is correct |
27 |
Correct |
354 ms |
83424 KB |
Output is correct |
28 |
Correct |
5 ms |
640 KB |
Output is correct |
29 |
Correct |
19 ms |
6656 KB |
Output is correct |
30 |
Correct |
5 ms |
512 KB |
Output is correct |
31 |
Correct |
260 ms |
61688 KB |
Output is correct |
32 |
Correct |
257 ms |
87920 KB |
Output is correct |
33 |
Correct |
269 ms |
88152 KB |
Output is correct |
34 |
Correct |
300 ms |
71288 KB |
Output is correct |
35 |
Correct |
279 ms |
87928 KB |
Output is correct |
36 |
Correct |
263 ms |
88016 KB |
Output is correct |
37 |
Correct |
384 ms |
88536 KB |
Output is correct |
38 |
Correct |
165 ms |
60924 KB |
Output is correct |
39 |
Correct |
182 ms |
61304 KB |
Output is correct |