Submission #484164

# Submission time Handle Problem Language Result Execution time Memory
484164 2021-11-02T08:59:10 Z ToroTN Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
183 ms 274436 KB
#include<bits/stdc++.h>
using namespace std;
long long n,m,c[3005][3005][2],r[3005][3005][2],cnt=0;
char s[3005][3005];
int main()
{
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%s",s[i]+1);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='O')
            {
                c[i][j][0]=c[i-1][j][0]+1;
                r[i][j][0]=r[i][j-1][0]+1;
            }else
            {
                c[i][j][0]=c[i-1][j][0];
                r[i][j][0]=r[i][j-1][0];
            }
            if(s[i][j]=='I')
            {
                c[i][j][1]=c[i-1][j][1]+1;
                r[i][j][1]=r[i][j-1][1]+1;
            }else
            {
                c[i][j][1]=c[i-1][j][1];
                r[i][j][1]=r[i][j-1][1];
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='J')
            {
                //cnt+=(c[n][j][0]-c[i][j][0])*(r[i][m][1]-r[i][j][1]);
                cnt+=(c[n][j][1]-c[i][j][1])*(r[i][m][0]-r[i][j][0]);
            }
        }
    }
    printf("%lld\n",cnt);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld%lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%s",s[i]+1);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1740 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1740 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 7 ms 11724 KB Output is correct
15 Correct 2 ms 5068 KB Output is correct
16 Correct 4 ms 7116 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 10 ms 13644 KB Output is correct
19 Correct 8 ms 13260 KB Output is correct
20 Correct 8 ms 13388 KB Output is correct
21 Correct 9 ms 13644 KB Output is correct
22 Correct 7 ms 13260 KB Output is correct
23 Correct 8 ms 13388 KB Output is correct
24 Correct 10 ms 13668 KB Output is correct
25 Correct 8 ms 13260 KB Output is correct
26 Correct 8 ms 13372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1612 KB Output is correct
9 Correct 1 ms 1612 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1740 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 7 ms 11724 KB Output is correct
15 Correct 2 ms 5068 KB Output is correct
16 Correct 4 ms 7116 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 10 ms 13644 KB Output is correct
19 Correct 8 ms 13260 KB Output is correct
20 Correct 8 ms 13388 KB Output is correct
21 Correct 9 ms 13644 KB Output is correct
22 Correct 7 ms 13260 KB Output is correct
23 Correct 8 ms 13388 KB Output is correct
24 Correct 10 ms 13668 KB Output is correct
25 Correct 8 ms 13260 KB Output is correct
26 Correct 8 ms 13372 KB Output is correct
27 Runtime error 183 ms 274436 KB Execution killed with signal 9
28 Halted 0 ms 0 KB -