Submission #724848

# Submission time Handle Problem Language Result Execution time Memory
724848 2023-04-16T05:10:02 Z guagua0407 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
212 ms 17920 KB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

int main() {_
    int n,m;
    cin>>n>>m;
    char num[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>num[i][j];
        }
    }
    vector<int> cnt2(m,0);
    for(int j=0;j<m;j++){
        for(int i=0;i<n;i++){
            if(num[i][j]=='I') cnt2[j]++;
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        int cnt=0;
        for(int j=m-1;j>=0;j--){
            if(num[i][j]=='I') cnt2[j]--;
            if(num[i][j]=='O') cnt++;
            if(num[i][j]=='J'){
                ans+=cnt*cnt2[j];
            }
        }
    }
    cout<<ans;
    return 0;
}
//maybe its multiset not set

Compilation message

joi2019_ho_t1.cpp: In function 'void setIO(std::string)':
joi2019_ho_t1.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 5 ms 596 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 3 ms 456 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 7 ms 724 KB Output is correct
19 Correct 4 ms 724 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 7 ms 716 KB Output is correct
22 Correct 4 ms 712 KB Output is correct
23 Correct 5 ms 724 KB Output is correct
24 Correct 6 ms 804 KB Output is correct
25 Correct 5 ms 852 KB Output is correct
26 Correct 4 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 5 ms 596 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 3 ms 456 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 7 ms 724 KB Output is correct
19 Correct 4 ms 724 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 7 ms 716 KB Output is correct
22 Correct 4 ms 712 KB Output is correct
23 Correct 5 ms 724 KB Output is correct
24 Correct 6 ms 804 KB Output is correct
25 Correct 5 ms 852 KB Output is correct
26 Correct 4 ms 792 KB Output is correct
27 Correct 212 ms 16916 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 12 ms 1568 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 150 ms 12412 KB Output is correct
32 Correct 163 ms 17744 KB Output is correct
33 Correct 157 ms 17768 KB Output is correct
34 Correct 175 ms 14408 KB Output is correct
35 Correct 165 ms 17800 KB Output is correct
36 Correct 158 ms 17844 KB Output is correct
37 Correct 202 ms 17920 KB Output is correct
38 Correct 103 ms 12364 KB Output is correct
39 Correct 92 ms 12480 KB Output is correct