답안 #574616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574616 2022-06-08T23:26:08 Z teki Bitaro the Brave (JOI19_ho_t1) C++11
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>

typedef long long ll;

#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
#define MN 1000000007

using namespace std;

char mat[3001][3001];
ll oDesno[3001][3001];
ll iDole[3001][3001];

ll getO (ll i, ll j) {
    if (j != 0) return oDesno[i][j-1];
    else return 0;
}

ll getI (ll i, ll j) {
    if (i != 0) return iDole[i-1][j];
    else return 0;
}

int main()
{
    #if LOCAL_DEBUG
        fstream cin("in.txt");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n,m;
    cin>>n>>m;

    for (ll i = 0; i<n; i++) {
        for (ll j = 0; j<m; j++) {
            cin>>mat[i][j];

            oDesno[i][j] = (mat[i][j] == 'O') + getO(i,j);
            iDole[i][j] = (mat[i][j] == 'I') + getI(i,j);
        }
    }

    ll res = 0;

    for (ll i = 0; i<n; i++) {
        for (ll j = 0; j<m; j++) {
            if (mat[i][j] != 'J') continue;

            res += (oDesno[i][m-1]-oDesno[i][j]) * (iDole[n-1][j]-oDesno[i][j]);
        }
    }

    cout<<res<<endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -