Submission #209194

# Submission time Handle Problem Language Result Execution time Memory
209194 2020-03-13T11:11:51 Z ffao Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
155 ms 82340 KB
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <memory.h>
#include <cmath>
#include <array>

void re(int& x);

void re(char* c);

void pr(long long x);

void pr(const char *x);

void ps();
template<class T, class... Ts> void ps(const T& t, const Ts&... ts);

#ifdef FFDBG

#else
#define dbg(x...) dsfdsfsdfasd
#endif

void re(int& x) { scanf("%d", &x); }

void re(char* c) { scanf("%s", c); }

void pr(long long x) { printf("%lld", x); }

void pr(const char *x) { printf("%s", x); }

void ps() { pr("\n"); }
template<class T, class... Ts> void ps(const T& t, const Ts&... ts) { 
    pr(t); if (sizeof...(ts)) pr(" "); ps(ts...); 
}

#define rep(i, a, b) for(int i = a; i < (b); ++i)

int r,c;
char board[3100][3100];
int orbs_right[3100][3100];
int ingots_below[3100][3100];

void solve()
{
    re(r); re(c);
    rep(i,0,r) re(board[i]);

    for (int i = r-1; i>= 0; i--) {
        for (int j = c-1; j >= 0; j--) {
            orbs_right[i][j] = (orbs_right[i][j+1] + (board[i][j] == 'O'));
            ingots_below[i][j] = (ingots_below[i+1][j] + (board[i][j] == 'I'));
        }
    }

    long long ans = 0;
    rep(i,0,r) rep(j,0,c) if (board[i][j] == 'J') ans += orbs_right[i][j] * ingots_below[i][j];
    ps(ans);
}

int main() {

    solve();
}

Compilation message

joi2019_ho_t1.cpp: In function 'void re(int&)':
joi2019_ho_t1.cpp:30:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void re(int& x) { scanf("%d", &x); }
                   ~~~~~^~~~~~~~~~
joi2019_ho_t1.cpp: In function 'void re(char*)':
joi2019_ho_t1.cpp:32:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void re(char* c) { scanf("%s", c); }
                    ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 1532 KB Output is correct
6 Correct 5 ms 1400 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 1532 KB Output is correct
6 Correct 5 ms 1400 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 11 ms 7288 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 7 ms 4216 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 11 ms 7800 KB Output is correct
19 Correct 10 ms 7800 KB Output is correct
20 Correct 10 ms 7672 KB Output is correct
21 Correct 12 ms 7800 KB Output is correct
22 Correct 10 ms 7672 KB Output is correct
23 Correct 10 ms 7672 KB Output is correct
24 Correct 11 ms 7800 KB Output is correct
25 Correct 10 ms 7672 KB Output is correct
26 Correct 10 ms 7672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 1532 KB Output is correct
6 Correct 5 ms 1400 KB Output is correct
7 Correct 5 ms 1400 KB Output is correct
8 Correct 5 ms 1528 KB Output is correct
9 Correct 5 ms 1400 KB Output is correct
10 Correct 5 ms 1400 KB Output is correct
11 Correct 5 ms 1528 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 5 ms 1400 KB Output is correct
14 Correct 11 ms 7288 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 7 ms 4216 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 11 ms 7800 KB Output is correct
19 Correct 10 ms 7800 KB Output is correct
20 Correct 10 ms 7672 KB Output is correct
21 Correct 12 ms 7800 KB Output is correct
22 Correct 10 ms 7672 KB Output is correct
23 Correct 10 ms 7672 KB Output is correct
24 Correct 11 ms 7800 KB Output is correct
25 Correct 10 ms 7672 KB Output is correct
26 Correct 10 ms 7672 KB Output is correct
27 Correct 154 ms 82340 KB Output is correct
28 Correct 19 ms 26104 KB Output is correct
29 Correct 13 ms 7416 KB Output is correct
30 Correct 6 ms 504 KB Output is correct
31 Correct 112 ms 68600 KB Output is correct
32 Correct 116 ms 82252 KB Output is correct
33 Correct 113 ms 81912 KB Output is correct
34 Correct 129 ms 79480 KB Output is correct
35 Correct 121 ms 82296 KB Output is correct
36 Correct 110 ms 81912 KB Output is correct
37 Correct 155 ms 82168 KB Output is correct
38 Correct 90 ms 68496 KB Output is correct
39 Correct 90 ms 68600 KB Output is correct