#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long h, w;
cin >> h >> w;
vector<pair<long long, long long>> joia;
map<long long, vector<long long>> orbe;
map<long long, vector<long long>> ingo;
for (long long i = 1; i <= h; i++)
{
for (long long j = 1; j <= w; j++)
{
char x;
cin >> x;
if (x == 'J')
{
joia.push_back({i, j});
}
if (x == 'O')
{
if (orbe.find(i) == orbe.end())
{
vector<long long> k;
orbe[i] = k;
}
orbe[i].push_back(j);
}
if (x == 'I')
{
if (ingo.find(j) == orbe.end())
{
vector<long long> k;
ingo[j] = k;
}
ingo[j].push_back(i);
}
}
}
long long ans = 0;
long long a= 0, b= 0;
for (auto k : joia)
{
a = 0;
b = 0;
cout << "( " << k.first << " , " << k.second << " )\n";
cout << "l: ";
for (auto o : orbe[k.first])
{
cout << o << " ";
if (k.second < o) a++;
}
cout << "\n";
cout << "k: ";
for (auto i : ingo[k.second])
{
cout << i << " ";
if (k.first < i) b++;
}
if (ingo[k.second].size() == 0 || orbe[k.first].size() == 0)
{
a = 0;
b = 0;
}
cout << "\n";
cout << a << ", " << b << "\n";
ans += a*b;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |