Submission #207814

# Submission time Handle Problem Language Result Execution time Memory
207814 2020-03-09T06:10:23 Z DodgeBallMan Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
679 ms 75184 KB
#include <bits/stdc++.h>
#define pii pair<int, int>
#define x first
#define y second

using namespace std;

const int N = 3010;
vector<pii> coord;
int h, w;
vector<int> o[N], in[N];
long long ans;

int main()
{
    scanf("%d %d",&h,&w);
    for( int i = 0 ; i < h ; i++ ) {
        char arr[N];
        scanf("%s",arr);
        for( int j = 0 ; j < w ; j++ ) {
            if( arr[j] == 'J' ) coord.emplace_back( pii( i, j ) );
            else if( arr[j] == 'O' ) o[i].emplace_back( j );
            else if( arr[j] == 'I' ) in[j].emplace_back( i );
        }
    }
    for( pii i : coord ) {
        int idx = upper_bound( o[i.x].begin(), o[i.x].end(), i.y ) - o[i.x].begin();
        int idx2 = upper_bound( in[i.y].begin(), in[i.y].end(), i.x ) - in[i.y].begin();
        ans += ( long long )( ( ( int )o[i.x].size() - idx ) * ( ( int )in[i.y].size() - idx2 ) );
    }
    printf("%lld",ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&h,&w);
     ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",arr);
         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 14 ms 1904 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 9 ms 1396 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 18 ms 2672 KB Output is correct
19 Correct 10 ms 2040 KB Output is correct
20 Correct 13 ms 2032 KB Output is correct
21 Correct 18 ms 2672 KB Output is correct
22 Correct 13 ms 2416 KB Output is correct
23 Correct 12 ms 2032 KB Output is correct
24 Correct 20 ms 2264 KB Output is correct
25 Correct 10 ms 2040 KB Output is correct
26 Correct 11 ms 2032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 14 ms 1904 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 9 ms 1396 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 18 ms 2672 KB Output is correct
19 Correct 10 ms 2040 KB Output is correct
20 Correct 13 ms 2032 KB Output is correct
21 Correct 18 ms 2672 KB Output is correct
22 Correct 13 ms 2416 KB Output is correct
23 Correct 12 ms 2032 KB Output is correct
24 Correct 20 ms 2264 KB Output is correct
25 Correct 10 ms 2040 KB Output is correct
26 Correct 11 ms 2032 KB Output is correct
27 Correct 636 ms 62104 KB Output is correct
28 Correct 7 ms 760 KB Output is correct
29 Correct 22 ms 5476 KB Output is correct
30 Correct 6 ms 632 KB Output is correct
31 Correct 416 ms 44348 KB Output is correct
32 Correct 247 ms 61000 KB Output is correct
33 Correct 278 ms 64792 KB Output is correct
34 Correct 486 ms 61372 KB Output is correct
35 Correct 384 ms 65444 KB Output is correct
36 Correct 277 ms 64792 KB Output is correct
37 Correct 679 ms 75184 KB Output is correct
38 Correct 153 ms 41680 KB Output is correct
39 Correct 181 ms 49596 KB Output is correct