This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#pragma optimize ("g",on)
#pragma GCC optimize ("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
typedef long long ll;
typedef long double ld;
#define pb push_back
#define ff first
#define ss second
#define lowb lower_bound
#define upb upper_bound
#define sz(x) (ll)x.size()
#define all(v) (v).begin(), (v).end()
pair<ll, ll> dx[] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
void ioSync() { ios_base::sync_with_stdio(false); cin.tie(NULL); }
void pre(ll a) { cout<<fixed<<setprecision(a); }
ll bit(ll x) { return __builtin_popcountll(x); }
ll binpow(ll a, ll n, ll c) { if(n==0) return 1; if(n%2==1) return binpow(a, n-1, c)*a%c; else { ll b = binpow(a, n/2, c)%c; return b*b%c; } }
template<typename T> T gcd(T a, T b) { if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b) { return a*b/gcd(a, b); }
const ll mod = 1e9+7;
const ll inf = 1e9+7;
const ll INF = 1e18+7;
const ll MX = LLONG_MAX; //.
const ll MN = LLONG_MIN; //.
const ld P = acos(-1.0);
const ll N = 1e5+5;
// char a[3005][3005];
void precalc()
{
return;
}
// Respa Gold
void kigash()
{
ll n, m;
cin>>n>>m;
string s[n+1];
for(ll i=1; i<=n; i++)
{
cin>>s[i];
s[i] = ' '+s[i];
}
ll ans = 0;
for(ll i=1; i<=n; i++)
{
for(ll k=i+1; k<=n; k++)
{
for(ll j=1; j<=m; j++)
{
for(ll l=j+1; l<=m; l++)
{
if(s[i][j]=='J' && s[i][l]=='O' && s[k][j]=='I') ans++;
}
}
}
}
cout<<ans<<"\n";
return;
}
signed main()
{
// freopen("");
ioSync();
precalc();
ll tt = 1;
// cin>>tt;
for(ll i=1; i<=tt; i++)
{
// cout<<"Case "<<i<<": "<<'\n';
kigash();
}
exit(0);
}
Compilation message (stderr)
ho_t2.cpp:4: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
4 | #pragma optimize ("g",on)
|
ho_t2.cpp:10: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
10 | #pragma comment(linker, "/stack:200000000")
|
ho_t2.cpp: In function 'void freopen(std::string)':
ho_t2.cpp:24:33: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
24 | void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ho_t2.cpp:24:75: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
24 | void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |