Submission #717560

# Submission time Handle Problem Language Result Execution time Memory
717560 2023-04-02T07:59:50 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
1000 ms 55260 KB
#include <bits/stdc++.h>

using namespace std;

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

vector<pii> posJ;
vector<int> posO[3010], posI[3010];
int n, m;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            char c; cin >> c;
            if(c == 'J') {
                posJ.push_back({i, j});
            }
            else if(c == 'O') {
                posO[i].push_back(j);
            }
            else {
                posI[j].push_back(i);
            }
        }
    }
    ll res = 0;
    for(auto [i, j] : posJ) {
        ll cntO = 0, cntI = 0;
        for(auto l : posO[i]) {
            if(l > j) cntO++;
        }
        for(auto k : posI[j]) {
            if(k > i) cntI++;
        }
        res += (cntO * cntI);
    }
    cout << res << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 22 ms 1792 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 9 ms 1360 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 30 ms 2380 KB Output is correct
19 Correct 11 ms 1748 KB Output is correct
20 Correct 31 ms 1812 KB Output is correct
21 Correct 29 ms 2480 KB Output is correct
22 Correct 20 ms 2124 KB Output is correct
23 Correct 31 ms 1812 KB Output is correct
24 Correct 32 ms 1996 KB Output is correct
25 Correct 11 ms 1744 KB Output is correct
26 Correct 31 ms 1812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 22 ms 1792 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 9 ms 1360 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 30 ms 2380 KB Output is correct
19 Correct 11 ms 1748 KB Output is correct
20 Correct 31 ms 1812 KB Output is correct
21 Correct 29 ms 2480 KB Output is correct
22 Correct 20 ms 2124 KB Output is correct
23 Correct 31 ms 1812 KB Output is correct
24 Correct 32 ms 1996 KB Output is correct
25 Correct 11 ms 1744 KB Output is correct
26 Correct 31 ms 1812 KB Output is correct
27 Execution timed out 1073 ms 55260 KB Time limit exceeded
28 Halted 0 ms 0 KB -