이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<ld,ld> id;
#define FOR(i, a, b) for(int i=(a); i<=(b); i++)
#define ROF(i, a, b) for(int i=(a); i>=(b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define SORT(x) sort((x).begin(), (x).end())
#define CMPSORT(x, cp) sort((x).begin(), (x).end(), cp)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f first
#define s second
#define e emplace
#define eb emplace_back
#define ef emplace_front
#define ins insert
#define p push
#define pf push_front
#define pb push_back
#define mp make_pair
#define getchar_unlocked _getchar_nolock
#define INF ((long long)1e18)
#define MOD 1000000007
#define db cout<<"YEET\n";
#define ct(x) cout<<x<<'\n';
int main(){
FAST
ll h, w;
char grid[3010][3010];
cin >> h >> w;
FOR(i, 1, h){
FOR(j, 1, w){
cin >> grid[i][j];
}
}
ll power[3010], total=0;
MEM(power, 0);
FOR(i, 1, h){
FOR(j, 1, w){
if (grid[i][j]=='I') total+=power[j];
}
ll ocnt=0;
ROF(j, w, 1){
if (grid[i][j]=='O') ocnt++;
if (grid[i][j]=='J') power[j]+=ocnt;
}
}
cout << total;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |