#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll h,w,i,i1,x,y,sum=0;
cin>>h>>w;
vector<pair<ll,ll> >v;
ll orbs[h],ingots[w];
for (i=0;i<h;i++)orbs[i]=0;
for (i=0;i<w;i++)ingots[i]=0;
for (i=0;i<h;i++){
for (i1=0;i1<w;i1++){
char c;
cin>>c;
if (c=='J'){
v.push_back({i1,i});
}
else if (c=='O'){
orbs[i]++;
}
else {
ingots[i1]++;
}
}
}
for (i=0;i<v.size();i++){
x=v[i].first;
y=v[i].second;
sum+=ingots[x]*orbs[y];
}
cout<<sum<<'\n';
}
Compilation message
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:28:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i=0;i<v.size();i++){
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Incorrect |
5 ms |
248 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Incorrect |
5 ms |
248 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Incorrect |
5 ms |
248 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |