Submission #994451

# Submission time Handle Problem Language Result Execution time Memory
994451 2024-06-07T16:20:41 Z daffuwu Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
332 ms 18104 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

long long ans;
char a[3069][3069];
int cnt[3069][2], h, w; //{idx, row/col}

int main() 
{
    int i, j;
    scanf("%d%d", &h, &w);
    for (i=1; i<=h; i++)
    {
        for (j=1; j<=w; j++) scanf(" %c", &a[i][j]);
    }
    for (i=h; i>=1; i--)
    {
        for (j=w; j>=1; j--)
        {
            if (a[i][j] == 'J') ans += 1ll*cnt[i][0]*cnt[j][1];
            else if (a[i][j] == 'O') cnt[i][0]++;
            else cnt[j][1]++;
        }
    }
    printf("%lld\n", ans);
} 

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d%d", &h, &w);
      |     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         for (j=1; j<=w; j++) scanf(" %c", &a[i][j]);
      |                              ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2504 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2504 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 7 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 6 ms 2908 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 2908 KB Output is correct
19 Correct 8 ms 2648 KB Output is correct
20 Correct 10 ms 2652 KB Output is correct
21 Correct 17 ms 2760 KB Output is correct
22 Correct 8 ms 2652 KB Output is correct
23 Correct 8 ms 2652 KB Output is correct
24 Correct 10 ms 2652 KB Output is correct
25 Correct 15 ms 2652 KB Output is correct
26 Correct 8 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2504 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 7 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 6 ms 2908 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 2908 KB Output is correct
19 Correct 8 ms 2648 KB Output is correct
20 Correct 10 ms 2652 KB Output is correct
21 Correct 17 ms 2760 KB Output is correct
22 Correct 8 ms 2652 KB Output is correct
23 Correct 8 ms 2652 KB Output is correct
24 Correct 10 ms 2652 KB Output is correct
25 Correct 15 ms 2652 KB Output is correct
26 Correct 8 ms 2908 KB Output is correct
27 Correct 299 ms 17748 KB Output is correct
28 Correct 3 ms 8796 KB Output is correct
29 Correct 19 ms 3088 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 218 ms 14904 KB Output is correct
32 Correct 312 ms 18004 KB Output is correct
33 Correct 285 ms 18000 KB Output is correct
34 Correct 267 ms 16184 KB Output is correct
35 Correct 297 ms 17984 KB Output is correct
36 Correct 275 ms 17988 KB Output is correct
37 Correct 332 ms 18104 KB Output is correct
38 Correct 209 ms 14656 KB Output is correct
39 Correct 205 ms 14676 KB Output is correct