이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Problem: B - Bitaro the Brave
// Contest: Virtual Judge - THT - Day 14
// URL: https://vjudge.net/contest/571691#problem/B
// Memory Limit: 268 MB
// Time Limit: 1000 ms
#include <bits/stdc++.h>
#define ll long long
#define sp << " "
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
ll n, m, k, t, s;
char c[3005][3005];
ll a[3005][3005], b[3005][3005];
int main(){
faster;
cin >> n >> m;
for(ll i = 1; i <= n; i++){
for(ll j = 1; j <= m; j++) cin >> c[i][j];
}
for(ll i = 1; i <= n; i++){
for(ll j = m; j >= 1; j--){
a[i][j]=a[i][j+1];
if(c[i][j]=='O') a[i][j]++;
}
}
for(ll j = 1; j <= m; j++){
for(ll i = n; i >= 1; i--){
b[i][j]=b[i+1][j];
if(c[i][j]=='I') b[i][j]++;
}
}
for(ll i = 1; i <= n; i++){
for(ll j = 1; j <= m; j++){
if(c[i][j]=='J')s+=(a[i][j]*b[i][j]);
}
}
cout << s;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |