답안 #101843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101843 2019-03-20T13:55:18 Z brcode Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
4 ms 1664 KB
#include <iostream>

using namespace std;
const long long MAXN = 3010;
char arr[MAXN][MAXN];
long long dp[MAXN][MAXN];
long long dp2[MAXN][MAXN];
int main(){
    long long n,m;
    cin>>n>>m;
    for(long long i=1;i<=n;i++){
        for(long long j=1;j<=m;j++){
            cin>>arr[i][j];
        }
    }
    for(long long i=1;i<=n;i++){
        for(long long j=m;j>=1;j--){
            dp[i][j] = dp[i][j+1]+(arr[i][j] == 'O');
            
        }
    }
    for(long long j=1;j<=m;j++){
        for(long long i=n;i>=1;i--){
            dp2[i][j] = dp2[i+1][j] + (arr[i][j] == 'I');
        }
    }
    long long ans =0;
    for(long long i=1;i<=n;i++){
        for(long long j=1;j<=n;j++){
            if(arr[i][j] == 'J'){
                ans+= ((long long)1*(dp2[i][j]*dp[i][j]));
            }
        }
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Incorrect 4 ms 1408 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Incorrect 4 ms 1408 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 4 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Incorrect 4 ms 1408 KB Output isn't correct
8 Halted 0 ms 0 KB -