Submission #926880

# Submission time Handle Problem Language Result Execution time Memory
926880 2024-02-14T03:05:26 Z haru09 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
150 ms 18020 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define task "code"

const int ar=3e3+5;
const ll mod=1e9+7;
int m,n;
char a[ar][ar];
int cnt[ar];
ll ans=0;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    if (fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    cin>>m>>n;
    for (int i=1;i<=m;i++)
    {
        for (int j=1;j<=n;j++)
        {
            cin>>a[i][j];
        }
    }
    for (int i=m;i>=1;i--)
    {
        int sum=0;
        for (int j=1;j<=n;j++)
        {
            if (a[i][j]=='J') sum+=cnt[j];
            else if (a[i][j]=='O')
            {
                ans+=sum;
            }
        }
        for (int j=1;j<=n;j++)
        {
            if (a[i][j]=='I') cnt[j]++;
        }
    }
    cout<<ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 464 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2520 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2664 KB Output is correct
# Verdict Execution time Memory 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 464 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2520 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2664 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 2 ms 2780 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 5 ms 2908 KB Output is correct
19 Correct 3 ms 2908 KB Output is correct
20 Correct 3 ms 2908 KB Output is correct
21 Correct 5 ms 2908 KB Output is correct
22 Correct 3 ms 2920 KB Output is correct
23 Correct 3 ms 2908 KB Output is correct
24 Correct 5 ms 2940 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2796 KB Output is correct
# Verdict Execution time Memory 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 464 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2520 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2664 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 2 ms 2780 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 5 ms 2908 KB Output is correct
19 Correct 3 ms 2908 KB Output is correct
20 Correct 3 ms 2908 KB Output is correct
21 Correct 5 ms 2908 KB Output is correct
22 Correct 3 ms 2920 KB Output is correct
23 Correct 3 ms 2908 KB Output is correct
24 Correct 5 ms 2940 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2796 KB Output is correct
27 Correct 150 ms 17576 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 8 ms 3140 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 112 ms 14820 KB Output is correct
32 Correct 95 ms 18004 KB Output is correct
33 Correct 92 ms 18004 KB Output is correct
34 Correct 140 ms 16060 KB Output is correct
35 Correct 94 ms 18020 KB Output is correct
36 Correct 89 ms 17760 KB Output is correct
37 Correct 143 ms 18000 KB Output is correct
38 Correct 70 ms 14888 KB Output is correct
39 Correct 65 ms 14676 KB Output is correct