Submission #701205

# Submission time Handle Problem Language Result Execution time Memory
701205 2023-02-20T14:05:56 Z Alihan_8 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
130 ms 159824 KB
#include <bits/stdc++.h>
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
// define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define mpr make_pair
#define ln '\n'
void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define int long long
const int N = 3e3+1;
int orb[N][N], ignot[N][N];
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m; cin >> n >> m;
    vector <string> p(n);
    for ( auto &i: p ) cin >> i;
    for ( int i = 1; i <= n; i++ ){
        for ( int j = 1; j <= m; j++ ){
            orb[i][j] = orb[i][j-1]+(p[i-1][j-1] == 'O');
            ignot[i][j] = ignot[i-1][j]+(p[i-1][j-1] == 'I');
        }
    }
    int cnt = 0;
    for ( int i = 1; i <= n; i++ ){
        for ( int j = 1; j <= m; j++ ){
            if ( p[i-1][j-1] != 'J' ) continue;
            int l = ignot[n][j]-ignot[i][j];
            int r = orb[i][m]-orb[i][j];
            cnt += l*r;
        }
    }
    cout << cnt;

    cout << '\n';
}

Compilation message

joi2019_ho_t1.cpp: In function 'void IO(std::string)':
joi2019_ho_t1.cpp:11:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:70: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 328 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 328 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 5 ms 7760 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 6 ms 8788 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 5 ms 8540 KB Output is correct
21 Correct 6 ms 8788 KB Output is correct
22 Correct 5 ms 8528 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 6 ms 8788 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 5 ms 8628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 328 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 5 ms 7760 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4692 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 6 ms 8788 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 5 ms 8540 KB Output is correct
21 Correct 6 ms 8788 KB Output is correct
22 Correct 5 ms 8528 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 6 ms 8788 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 5 ms 8628 KB Output is correct
27 Correct 122 ms 158776 KB Output is correct
28 Correct 12 ms 19540 KB Output is correct
29 Correct 10 ms 13780 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 99 ms 130704 KB Output is correct
32 Correct 105 ms 159728 KB Output is correct
33 Correct 97 ms 159308 KB Output is correct
34 Correct 109 ms 151452 KB Output is correct
35 Correct 100 ms 159728 KB Output is correct
36 Correct 93 ms 159336 KB Output is correct
37 Correct 130 ms 159824 KB Output is correct
38 Correct 80 ms 130044 KB Output is correct
39 Correct 74 ms 130124 KB Output is correct