Submission #1023844

# Submission time Handle Problem Language Result Execution time Memory
1023844 2024-07-15T07:48:23 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
144 ms 18004 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 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 4 ms 1884 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 2 ms 1116 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 5 ms 2188 KB Output is correct
19 Correct 4 ms 2140 KB Output is correct
20 Correct 3 ms 2080 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 3 ms 2180 KB Output is correct
23 Correct 3 ms 2136 KB Output is correct
24 Correct 4 ms 1960 KB Output is correct
25 Correct 4 ms 1972 KB Output is correct
26 Correct 4 ms 1992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 4 ms 1884 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 2 ms 1116 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 5 ms 2188 KB Output is correct
19 Correct 4 ms 2140 KB Output is correct
20 Correct 3 ms 2080 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 3 ms 2180 KB Output is correct
23 Correct 3 ms 2136 KB Output is correct
24 Correct 4 ms 1960 KB Output is correct
25 Correct 4 ms 1972 KB Output is correct
26 Correct 4 ms 1992 KB Output is correct
27 Correct 144 ms 17508 KB Output is correct
28 Correct 3 ms 7260 KB Output is correct
29 Correct 6 ms 1628 KB Output is correct
30 Correct 1 ms 528 KB Output is correct
31 Correct 101 ms 13916 KB Output is correct
32 Correct 88 ms 18000 KB Output is correct
33 Correct 95 ms 18004 KB Output is correct
34 Correct 120 ms 15956 KB Output is correct
35 Correct 90 ms 18004 KB Output is correct
36 Correct 82 ms 18000 KB Output is correct
37 Correct 135 ms 18004 KB Output is correct
38 Correct 61 ms 13632 KB Output is correct
39 Correct 61 ms 13656 KB Output is correct