# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199765 | 2020-02-03T08:41:42 Z | Mercenary | Bitaro the Brave (JOI19_ho_t1) | C++14 | 114 ms | 89592 KB |
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define taskname "A" using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> ii; const int maxn = 3005; string s[maxn]; int a[maxn][maxn] , b[maxn][maxn] , m , n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname".INP","r")){ freopen(taskname".INP", "r",stdin); freopen(taskname".OUT", "w",stdout); } ll res = 0; cin >> m >> n; for(int i = 0 ; i < m ; ++i)cin >> s[i]; for(int i = m - 1 ; i >= 0 ; --i){ for(int j = n - 1 ; j >= 0 ; --j){ a[i][j] = a[i][j + 1] + (s[i][j] == 'O'); b[i][j] = b[i + 1][j] + (s[i][j] == 'I'); } } for(int i = 0 ; i < m ; ++i){ for(int j = 0 ; j < n ; ++j){ res += (ll)(s[i][j] == 'J') * a[i][j] * b[i][j]; } } cout << res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 1272 KB | Output is correct |
6 | Correct | 6 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1272 KB | Output is correct |
8 | Correct | 6 ms | 1272 KB | Output is correct |
9 | Correct | 5 ms | 1272 KB | Output is correct |
10 | Correct | 5 ms | 1276 KB | Output is correct |
11 | Correct | 6 ms | 1400 KB | Output is correct |
12 | Correct | 5 ms | 1400 KB | Output is correct |
13 | Correct | 6 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 1272 KB | Output is correct |
6 | Correct | 6 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1272 KB | Output is correct |
8 | Correct | 6 ms | 1272 KB | Output is correct |
9 | Correct | 5 ms | 1272 KB | Output is correct |
10 | Correct | 5 ms | 1276 KB | Output is correct |
11 | Correct | 6 ms | 1400 KB | Output is correct |
12 | Correct | 5 ms | 1400 KB | Output is correct |
13 | Correct | 6 ms | 1272 KB | Output is correct |
14 | Correct | 10 ms | 6392 KB | Output is correct |
15 | Correct | 7 ms | 3832 KB | Output is correct |
16 | Correct | 8 ms | 3832 KB | Output is correct |
17 | Correct | 5 ms | 632 KB | Output is correct |
18 | Correct | 11 ms | 6904 KB | Output is correct |
19 | Correct | 11 ms | 6904 KB | Output is correct |
20 | Correct | 10 ms | 6776 KB | Output is correct |
21 | Correct | 11 ms | 6904 KB | Output is correct |
22 | Correct | 10 ms | 6904 KB | Output is correct |
23 | Correct | 11 ms | 6904 KB | Output is correct |
24 | Correct | 11 ms | 6904 KB | Output is correct |
25 | Correct | 11 ms | 6776 KB | Output is correct |
26 | Correct | 14 ms | 6776 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 1272 KB | Output is correct |
6 | Correct | 6 ms | 1400 KB | Output is correct |
7 | Correct | 6 ms | 1272 KB | Output is correct |
8 | Correct | 6 ms | 1272 KB | Output is correct |
9 | Correct | 5 ms | 1272 KB | Output is correct |
10 | Correct | 5 ms | 1276 KB | Output is correct |
11 | Correct | 6 ms | 1400 KB | Output is correct |
12 | Correct | 5 ms | 1400 KB | Output is correct |
13 | Correct | 6 ms | 1272 KB | Output is correct |
14 | Correct | 10 ms | 6392 KB | Output is correct |
15 | Correct | 7 ms | 3832 KB | Output is correct |
16 | Correct | 8 ms | 3832 KB | Output is correct |
17 | Correct | 5 ms | 632 KB | Output is correct |
18 | Correct | 11 ms | 6904 KB | Output is correct |
19 | Correct | 11 ms | 6904 KB | Output is correct |
20 | Correct | 10 ms | 6776 KB | Output is correct |
21 | Correct | 11 ms | 6904 KB | Output is correct |
22 | Correct | 10 ms | 6904 KB | Output is correct |
23 | Correct | 11 ms | 6904 KB | Output is correct |
24 | Correct | 11 ms | 6904 KB | Output is correct |
25 | Correct | 11 ms | 6776 KB | Output is correct |
26 | Correct | 14 ms | 6776 KB | Output is correct |
27 | Correct | 109 ms | 88512 KB | Output is correct |
28 | Correct | 18 ms | 19324 KB | Output is correct |
29 | Correct | 13 ms | 7800 KB | Output is correct |
30 | Correct | 6 ms | 760 KB | Output is correct |
31 | Correct | 84 ms | 72032 KB | Output is correct |
32 | Correct | 114 ms | 89412 KB | Output is correct |
33 | Correct | 105 ms | 89212 KB | Output is correct |
34 | Correct | 94 ms | 83448 KB | Output is correct |
35 | Correct | 105 ms | 89336 KB | Output is correct |
36 | Correct | 108 ms | 89208 KB | Output is correct |
37 | Correct | 108 ms | 89592 KB | Output is correct |
38 | Correct | 81 ms | 72056 KB | Output is correct |
39 | Correct | 79 ms | 71672 KB | Output is correct |