Submission #1082619

# Submission time Handle Problem Language Result Execution time Memory
1082619 2024-08-31T18:38:09 Z lamlamlam Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
179 ms 141812 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int MN = 2005;
int n,m,cnt_o[MN][MN],cnt_i[MN][MN];
char a[MN][MN];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #define task "sus"
    if(fopen(task".inp","r")){
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            cin >> a[i][j];
            if(a[i][j]=='O') cnt_o[i][j]++;
            if(a[i][j]=='I') cnt_i[i][j]++;
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            cnt_o[i][j] += cnt_o[i][j-1];
            cnt_i[i][j] += cnt_i[i-1][j];
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) if(a[i][j]=='J')
        ans += (cnt_o[i][m]-cnt_o[i][j])*(cnt_i[n][j]-cnt_i[i][j]);
    cout << ans;
    cerr << "\nTime: " << clock();
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:16:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 8 ms 8540 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 3 ms 5212 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 11 ms 9564 KB Output is correct
19 Correct 6 ms 9308 KB Output is correct
20 Correct 8 ms 9492 KB Output is correct
21 Correct 9 ms 9564 KB Output is correct
22 Correct 7 ms 9416 KB Output is correct
23 Correct 6 ms 9304 KB Output is correct
24 Correct 9 ms 9428 KB Output is correct
25 Correct 6 ms 9308 KB Output is correct
26 Correct 6 ms 9360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 1 ms 1628 KB Output is correct
6 Correct 1 ms 1372 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1628 KB Output is correct
9 Correct 1 ms 1372 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 1 ms 1628 KB Output is correct
12 Correct 1 ms 1372 KB Output is correct
13 Correct 1 ms 1372 KB Output is correct
14 Correct 8 ms 8540 KB Output is correct
15 Correct 2 ms 4700 KB Output is correct
16 Correct 3 ms 5212 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 11 ms 9564 KB Output is correct
19 Correct 6 ms 9308 KB Output is correct
20 Correct 8 ms 9492 KB Output is correct
21 Correct 9 ms 9564 KB Output is correct
22 Correct 7 ms 9416 KB Output is correct
23 Correct 6 ms 9304 KB Output is correct
24 Correct 9 ms 9428 KB Output is correct
25 Correct 6 ms 9308 KB Output is correct
26 Correct 6 ms 9360 KB Output is correct
27 Runtime error 179 ms 141812 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -