# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580854 | 2022-06-22T02:19:38 Z | Metal_Sonic | Bitaro the Brave (JOI19_ho_t1) | C++17 | 188 ms | 184304 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define sz(x) (int)(x).size() #define all(x) x.begin() , x.end() void setIO(string name = "") { ios_base::sync_with_stdio(false); cin.tie(nullptr); if(sz(name)){ freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } const int N = 3005; ll I[N][N] , O[N][N]; vector<vector<ll>>J(N); void run_test_case(){ int n , m;cin>>n>>m; for(int i = 0; i < n; i++){ string s;cin>>s; for(int j = 0; j < m; j++){ if(s[j] == 'I')I[i][j]++; else if(s[j] == 'O')O[i][j]++; else J[i].push_back(j); if(j)O[i][j]+=O[i][j-1]; if(i)I[i][j]+=I[i-1][j]; } } ll ans = 0; for(int i = 0; i < n; i++){ for(auto it : J[i]){ ans+=(O[i][m-1]-O[i][it])*(I[n-1][it]-I[i][it]); } } cout<<ans; } int main() { setIO(); int T = 1; while(T--){ run_test_case(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 1364 KB | Output is correct |
6 | Correct | 1 ms | 1236 KB | Output is correct |
7 | Correct | 1 ms | 1236 KB | Output is correct |
8 | Correct | 1 ms | 1364 KB | Output is correct |
9 | Correct | 1 ms | 1364 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1364 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 1364 KB | Output is correct |
6 | Correct | 1 ms | 1236 KB | Output is correct |
7 | Correct | 1 ms | 1236 KB | Output is correct |
8 | Correct | 1 ms | 1364 KB | Output is correct |
9 | Correct | 1 ms | 1364 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1364 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
14 | Correct | 7 ms | 8148 KB | Output is correct |
15 | Correct | 2 ms | 3796 KB | Output is correct |
16 | Correct | 3 ms | 4948 KB | Output is correct |
17 | Correct | 1 ms | 468 KB | Output is correct |
18 | Correct | 7 ms | 9300 KB | Output is correct |
19 | Correct | 7 ms | 8404 KB | Output is correct |
20 | Correct | 6 ms | 8788 KB | Output is correct |
21 | Correct | 8 ms | 9556 KB | Output is correct |
22 | Correct | 6 ms | 9300 KB | Output is correct |
23 | Correct | 7 ms | 9044 KB | Output is correct |
24 | Correct | 8 ms | 9556 KB | Output is correct |
25 | Correct | 5 ms | 8680 KB | Output is correct |
26 | Correct | 6 ms | 9044 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 1364 KB | Output is correct |
6 | Correct | 1 ms | 1236 KB | Output is correct |
7 | Correct | 1 ms | 1236 KB | Output is correct |
8 | Correct | 1 ms | 1364 KB | Output is correct |
9 | Correct | 1 ms | 1364 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1364 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
14 | Correct | 7 ms | 8148 KB | Output is correct |
15 | Correct | 2 ms | 3796 KB | Output is correct |
16 | Correct | 3 ms | 4948 KB | Output is correct |
17 | Correct | 1 ms | 468 KB | Output is correct |
18 | Correct | 7 ms | 9300 KB | Output is correct |
19 | Correct | 7 ms | 8404 KB | Output is correct |
20 | Correct | 6 ms | 8788 KB | Output is correct |
21 | Correct | 8 ms | 9556 KB | Output is correct |
22 | Correct | 6 ms | 9300 KB | Output is correct |
23 | Correct | 7 ms | 9044 KB | Output is correct |
24 | Correct | 8 ms | 9556 KB | Output is correct |
25 | Correct | 5 ms | 8680 KB | Output is correct |
26 | Correct | 6 ms | 9044 KB | Output is correct |
27 | Correct | 163 ms | 168184 KB | Output is correct |
28 | Correct | 11 ms | 19612 KB | Output is correct |
29 | Correct | 11 ms | 15316 KB | Output is correct |
30 | Correct | 1 ms | 852 KB | Output is correct |
31 | Correct | 130 ms | 140640 KB | Output is correct |
32 | Correct | 107 ms | 153148 KB | Output is correct |
33 | Correct | 126 ms | 175188 KB | Output is correct |
34 | Correct | 149 ms | 162712 KB | Output is correct |
35 | Correct | 129 ms | 173476 KB | Output is correct |
36 | Correct | 120 ms | 175236 KB | Output is correct |
37 | Correct | 188 ms | 184304 KB | Output is correct |
38 | Correct | 77 ms | 126808 KB | Output is correct |
39 | Correct | 92 ms | 143996 KB | Output is correct |