Submission #151097

# Submission time Handle Problem Language Result Execution time Memory
151097 2019-09-01T17:29:47 Z karma Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
93 ms 10232 KB
#include <bits/stdc++.h>
#define ll      long long
#define pb      emplace_back
#define mp      make_pair
#define fi      first
#define se      second

using namespace std;

const int N = int(3e3) + 1;
const int mod = int(1e9) + 7;

string s[N];
ll res = 0;
int n, m, c[N], cur;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if(fopen("test.inp", "r")) {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
    cin >> n >> m;
    for(int i = 0; i < n; ++i) cin >> s[i];
    for(int i = n - 1; i >= 0; --i) {
        cur = 0;
        for(int j = 0; j < m; ++j) {
            if(s[i][j] == 'J') cur += c[j];
            else if(s[i][j] == 'I') ++c[j];
            else res += cur;
        }
    }
    cout << res;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("test.inp", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("test.out", "w", stdout);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 4 ms 632 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 632 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 5 ms 636 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 3 ms 760 KB Output is correct
21 Correct 4 ms 760 KB Output is correct
22 Correct 3 ms 760 KB Output is correct
23 Correct 3 ms 632 KB Output is correct
24 Correct 5 ms 632 KB Output is correct
25 Correct 4 ms 760 KB Output is correct
26 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 4 ms 632 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 632 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 5 ms 636 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 3 ms 760 KB Output is correct
21 Correct 4 ms 760 KB Output is correct
22 Correct 3 ms 760 KB Output is correct
23 Correct 3 ms 632 KB Output is correct
24 Correct 5 ms 632 KB Output is correct
25 Correct 4 ms 760 KB Output is correct
26 Correct 3 ms 760 KB Output is correct
27 Correct 93 ms 9464 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 5 ms 1144 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 68 ms 7160 KB Output is correct
32 Correct 43 ms 9976 KB Output is correct
33 Correct 43 ms 10232 KB Output is correct
34 Correct 79 ms 8184 KB Output is correct
35 Correct 45 ms 9976 KB Output is correct
36 Correct 42 ms 10104 KB Output is correct
37 Correct 93 ms 10104 KB Output is correct
38 Correct 28 ms 7072 KB Output is correct
39 Correct 30 ms 7032 KB Output is correct