Submission #1023572

# Submission time Handle Problem Language Result Execution time Memory
1023572 2024-07-15T02:51:47 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
202 ms 79704 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define eb emplace_back
#define task ""
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
#define fi first
#define se second
#define pii pair <int, int>
#define tii tuple <int, int, int>
#define all(s) s.begin(), s.end()
using namespace std;

const int nmax = 3e3 + 2;
int h, w;
char s[nmax][nmax];

int cntO[nmax][nmax], cntI[nmax][nmax];

int main()
{
    if (ifstream(task".inp")) nx
    fast

    cin >> h >> w;
    for (int i = 1; i <= h; ++i)
        for (int j = 1; j <= w; ++j)
            cin >> s[i][j];
    
    for (int i = 1; i <= h; ++i)
        for (int j = w; j >= 1; --j)
            cntO[i][j] = cntO[i][j + 1] + (s[i][j] == 'O');
        
    for (int j = 1; j <= w; ++j)
        for (int i = h; i >= 1; --i)
            cntI[j][i] = cntI[j][i + 1] + (s[i][j] == 'I');

    ll ans = 0;
    for (int i = 1; i <= h; ++i)
        for (int j = 1; j <= w; ++j)
            if (s[i][j] == 'J')
                ans += cntO[i][j] * cntI[j][i];
                
    cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:7:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:31: note: in expansion of macro 'nx'
   23 |     if (ifstream(task".inp")) nx
      |                               ^~
joi2019_ho_t1.cpp:7:52: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | #define nx freopen (task".inp","r",stdin), freopen (task".out","w",stdout);
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:31: note: in expansion of macro 'nx'
   23 |     if (ifstream(task".inp")) nx
      |                               ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 6 ms 9564 KB Output is correct
15 Correct 1 ms 4244 KB Output is correct
16 Correct 4 ms 6492 KB Output is correct
17 Correct 1 ms 3676 KB Output is correct
18 Correct 7 ms 10332 KB Output is correct
19 Correct 7 ms 10328 KB Output is correct
20 Correct 6 ms 8408 KB Output is correct
21 Correct 7 ms 10328 KB Output is correct
22 Correct 8 ms 10332 KB Output is correct
23 Correct 6 ms 8284 KB Output is correct
24 Correct 8 ms 10332 KB Output is correct
25 Correct 6 ms 10332 KB Output is correct
26 Correct 7 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3164 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 6 ms 9564 KB Output is correct
15 Correct 1 ms 4244 KB Output is correct
16 Correct 4 ms 6492 KB Output is correct
17 Correct 1 ms 3676 KB Output is correct
18 Correct 7 ms 10332 KB Output is correct
19 Correct 7 ms 10328 KB Output is correct
20 Correct 6 ms 8408 KB Output is correct
21 Correct 7 ms 10328 KB Output is correct
22 Correct 8 ms 10332 KB Output is correct
23 Correct 6 ms 8284 KB Output is correct
24 Correct 8 ms 10332 KB Output is correct
25 Correct 6 ms 10332 KB Output is correct
26 Correct 7 ms 8284 KB Output is correct
27 Correct 202 ms 77764 KB Output is correct
28 Correct 6 ms 18008 KB Output is correct
29 Correct 17 ms 18140 KB Output is correct
30 Correct 5 ms 11864 KB Output is correct
31 Correct 134 ms 67152 KB Output is correct
32 Correct 173 ms 79440 KB Output is correct
33 Correct 163 ms 79700 KB Output is correct
34 Correct 156 ms 72904 KB Output is correct
35 Correct 174 ms 79444 KB Output is correct
36 Correct 168 ms 79700 KB Output is correct
37 Correct 198 ms 79704 KB Output is correct
38 Correct 117 ms 67016 KB Output is correct
39 Correct 118 ms 67276 KB Output is correct