답안 #851250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851250 2023-09-19T06:37:57 Z askow Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 83624 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    char a[n+1][m+1];
    for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)cin>>a[i][j];
    int ans=0;
    int pref[n+1];
    for(int i=0;i<=n;i++)pref[i]=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(a[i][j]=='I')pref[i]++;
        }
    }
    int suf[n+1][m+2];
    for(int i=0;i<=n;i++)for(int j=0;j<=m+1;j++)suf[i][j]=0;
    for(int i=1;i<=n;i++){
        for(int j=m;j>=1;j--){
            suf[i][j]=suf[i][j+1];
            if(a[i][j]=='O')suf[i][j]++;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]=='J'){
                int Z=0;
                int R=0;
                for(int k=i+1;k<=n;k++){
                    if(a[k][j]=='I')Z++;
                }
                for(int k=j+1;k<=m;k++){
                    if(a[i][k]=='O')R++;
                }
                ans+=Z*R;
            }
        }
    }
    cout<<ans;
}
// bitset fora?
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 27 ms 2136 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 15 ms 1624 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 43 ms 2908 KB Output is correct
19 Correct 12 ms 2648 KB Output is correct
20 Correct 41 ms 2652 KB Output is correct
21 Correct 36 ms 2904 KB Output is correct
22 Correct 35 ms 2652 KB Output is correct
23 Correct 41 ms 2648 KB Output is correct
24 Correct 44 ms 2904 KB Output is correct
25 Correct 13 ms 2652 KB Output is correct
26 Correct 41 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 27 ms 2136 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 15 ms 1624 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 43 ms 2908 KB Output is correct
19 Correct 12 ms 2648 KB Output is correct
20 Correct 41 ms 2652 KB Output is correct
21 Correct 36 ms 2904 KB Output is correct
22 Correct 35 ms 2652 KB Output is correct
23 Correct 41 ms 2648 KB Output is correct
24 Correct 44 ms 2904 KB Output is correct
25 Correct 13 ms 2652 KB Output is correct
26 Correct 41 ms 2648 KB Output is correct
27 Execution timed out 1030 ms 83624 KB Time limit exceeded
28 Halted 0 ms 0 KB -