답안 #1082621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1082621 2024-08-31T18:38:49 Z lamlamlam Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
257 ms 159216 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int MN = 3005;
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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 1628 KB Output is correct
6 Correct 1 ms 1628 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 1628 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 1624 KB Output is correct
13 Correct 1 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 1628 KB Output is correct
6 Correct 1 ms 1628 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 1628 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 1624 KB Output is correct
13 Correct 1 ms 1368 KB Output is correct
14 Correct 7 ms 8792 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 3 ms 5212 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 9 ms 9888 KB Output is correct
19 Correct 6 ms 9564 KB Output is correct
20 Correct 6 ms 9564 KB Output is correct
21 Correct 11 ms 9820 KB Output is correct
22 Correct 6 ms 9564 KB Output is correct
23 Correct 6 ms 9564 KB Output is correct
24 Correct 9 ms 9888 KB Output is correct
25 Correct 6 ms 9564 KB Output is correct
26 Correct 7 ms 9604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 1628 KB Output is correct
6 Correct 1 ms 1628 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 1628 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 1624 KB Output is correct
13 Correct 1 ms 1368 KB Output is correct
14 Correct 7 ms 8792 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 3 ms 5212 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 9 ms 9888 KB Output is correct
19 Correct 6 ms 9564 KB Output is correct
20 Correct 6 ms 9564 KB Output is correct
21 Correct 11 ms 9820 KB Output is correct
22 Correct 6 ms 9564 KB Output is correct
23 Correct 6 ms 9564 KB Output is correct
24 Correct 9 ms 9888 KB Output is correct
25 Correct 6 ms 9564 KB Output is correct
26 Correct 7 ms 9604 KB Output is correct
27 Correct 257 ms 152924 KB Output is correct
28 Correct 11 ms 26460 KB Output is correct
29 Correct 12 ms 13916 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 197 ms 131404 KB Output is correct
32 Correct 152 ms 159060 KB Output is correct
33 Correct 148 ms 158656 KB Output is correct
34 Correct 215 ms 152276 KB Output is correct
35 Correct 147 ms 159060 KB Output is correct
36 Correct 140 ms 158636 KB Output is correct
37 Correct 254 ms 159216 KB Output is correct
38 Correct 122 ms 130736 KB Output is correct
39 Correct 105 ms 130788 KB Output is correct