Submission #98874

# Submission time Handle Problem Language Result Execution time Memory
98874 2019-02-27T04:01:04 Z bash Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
854 ms 153460 KB
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

#define int __int64_t

const int N = 3025;

char a[N][N];

int cntI[N][N];
int cntO[N][N];

main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt(), m = readInt();
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = n; i >= 1; i--) {
        for (int j = 1; j <= m; j++) {
            cntI[i][j] = cntI[i + 1][j] + (a[i][j] == 'I');
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= 1; j--) {
            cntO[i][j] = cntO[i][j + 1] + (a[i][j] == 'O');
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == 'J') {
                int ans = cntI[i][j] * cntO[i][j];
                res += ans;
            }
        }
    }
    cout << res;
    return 0;
}

Compilation message

joi2019_ho_t1.cpp:70:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1740 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 4 ms 1532 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1740 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 4 ms 1532 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 25 ms 9088 KB Output is correct
15 Correct 7 ms 5092 KB Output is correct
16 Correct 17 ms 5376 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 31 ms 10032 KB Output is correct
19 Correct 31 ms 9856 KB Output is correct
20 Correct 24 ms 9848 KB Output is correct
21 Correct 36 ms 9976 KB Output is correct
22 Correct 24 ms 9848 KB Output is correct
23 Correct 29 ms 9856 KB Output is correct
24 Correct 28 ms 9984 KB Output is correct
25 Correct 29 ms 9848 KB Output is correct
26 Correct 28 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1740 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 5 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 5 ms 1536 KB Output is correct
11 Correct 4 ms 1532 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 25 ms 9088 KB Output is correct
15 Correct 7 ms 5092 KB Output is correct
16 Correct 17 ms 5376 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 31 ms 10032 KB Output is correct
19 Correct 31 ms 9856 KB Output is correct
20 Correct 24 ms 9848 KB Output is correct
21 Correct 36 ms 9976 KB Output is correct
22 Correct 24 ms 9848 KB Output is correct
23 Correct 29 ms 9856 KB Output is correct
24 Correct 28 ms 9984 KB Output is correct
25 Correct 29 ms 9848 KB Output is correct
26 Correct 28 ms 9848 KB Output is correct
27 Correct 755 ms 153460 KB Output is correct
28 Correct 33 ms 26360 KB Output is correct
29 Correct 56 ms 13944 KB Output is correct
30 Correct 6 ms 896 KB Output is correct
31 Correct 532 ms 127480 KB Output is correct
32 Correct 801 ms 153044 KB Output is correct
33 Correct 750 ms 152760 KB Output is correct
34 Correct 642 ms 147328 KB Output is correct
35 Correct 724 ms 153080 KB Output is correct
36 Correct 647 ms 152568 KB Output is correct
37 Correct 854 ms 153216 KB Output is correct
38 Correct 561 ms 126664 KB Output is correct
39 Correct 515 ms 126968 KB Output is correct