Submission #335719

# Submission time Handle Problem Language Result Execution time Memory
335719 2020-12-13T18:47:57 Z shahriarkhan Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
632 ms 150328 KB
#include<bits/stdc++.h>
using namespace std ;

//type 0 -> orb
//type 1 -> ingot

const int maxN = 3e3 + 5 ;

long long dp[maxN][maxN][2] ;

int main()
{
    char s[maxN][maxN] ;
    int H , W ;
    long long ans = 0 ;
    scanf("%d%d",&H,&W) ;
    for(int i = 0 ; i < H ; ++i)
    {
        for(int j = 0 ; j < W ; ++j)
        {
            scanf(" %c",&s[i][j]) ;
        }
    }
    for(int i = H - 1 ; i >= 0 ; --i)
    {
        for(int j = W - 1 ; j >= 0 ; --j)
        {
            dp[i][j][0] = dp[i][j+1][0] ;
            dp[i][j][1] = dp[i+1][j][1] ;
            if(s[i][j]=='J') ans += (dp[i][j+1][0]*dp[i+1][j][1]) ;
            else if(s[i][j]=='O') ++dp[i][j][0] ;
            else ++dp[i][j][1] ;
        }
    }
    printf("%lld\n",ans) ;
    return 0 ;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d%d",&H,&W) ;
      |     ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |             scanf(" %c",&s[i][j]) ;
      |             ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 1132 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 1132 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1132 KB Output is correct
14 Correct 16 ms 6892 KB Output is correct
15 Correct 3 ms 3456 KB Output is correct
16 Correct 10 ms 4204 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 20 ms 7788 KB Output is correct
19 Correct 18 ms 7532 KB Output is correct
20 Correct 18 ms 7660 KB Output is correct
21 Correct 20 ms 7788 KB Output is correct
22 Correct 19 ms 7532 KB Output is correct
23 Correct 19 ms 7660 KB Output is correct
24 Correct 20 ms 7788 KB Output is correct
25 Correct 18 ms 7532 KB Output is correct
26 Correct 23 ms 7660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 2 ms 1132 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1132 KB Output is correct
14 Correct 16 ms 6892 KB Output is correct
15 Correct 3 ms 3456 KB Output is correct
16 Correct 10 ms 4204 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 20 ms 7788 KB Output is correct
19 Correct 18 ms 7532 KB Output is correct
20 Correct 18 ms 7660 KB Output is correct
21 Correct 20 ms 7788 KB Output is correct
22 Correct 19 ms 7532 KB Output is correct
23 Correct 19 ms 7660 KB Output is correct
24 Correct 20 ms 7788 KB Output is correct
25 Correct 18 ms 7532 KB Output is correct
26 Correct 23 ms 7660 KB Output is correct
27 Correct 611 ms 150328 KB Output is correct
28 Correct 13 ms 17036 KB Output is correct
29 Correct 43 ms 12268 KB Output is correct
30 Correct 2 ms 768 KB Output is correct
31 Correct 507 ms 115564 KB Output is correct
32 Correct 588 ms 150252 KB Output is correct
33 Correct 595 ms 149872 KB Output is correct
34 Correct 518 ms 134124 KB Output is correct
35 Correct 578 ms 150252 KB Output is correct
36 Correct 588 ms 149868 KB Output is correct
37 Correct 632 ms 150324 KB Output is correct
38 Correct 423 ms 118764 KB Output is correct
39 Correct 426 ms 119056 KB Output is correct