답안 #151093

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151093 2019-09-01T17:26:57 Z karma Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
102 ms 18168 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) + 2;
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 = 1; i <= n; ++i) cin >> s[i], s[i] = ' ' + s[i];
    for(int i = n; i >= 1; --i) {
        cur = 0;
        for(int j = 1; j <= m; ++j) {
            if(s[i][j] == 'J') cur += c[j];
            else if(s[i][j] == 'I') ++c[j];
            else if(s[i][j] == 'O') 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);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 508 KB Output is correct
14 Correct 5 ms 860 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 4 ms 760 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 6 ms 1016 KB Output is correct
19 Correct 4 ms 888 KB Output is correct
20 Correct 3 ms 888 KB Output is correct
21 Correct 5 ms 892 KB Output is correct
22 Correct 4 ms 888 KB Output is correct
23 Correct 4 ms 888 KB Output is correct
24 Correct 5 ms 1016 KB Output is correct
25 Correct 4 ms 888 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 508 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 508 KB Output is correct
14 Correct 5 ms 860 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 4 ms 760 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 6 ms 1016 KB Output is correct
19 Correct 4 ms 888 KB Output is correct
20 Correct 3 ms 888 KB Output is correct
21 Correct 5 ms 892 KB Output is correct
22 Correct 4 ms 888 KB Output is correct
23 Correct 4 ms 888 KB Output is correct
24 Correct 5 ms 1016 KB Output is correct
25 Correct 4 ms 888 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
27 Correct 102 ms 17144 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
29 Correct 6 ms 1656 KB Output is correct
30 Correct 3 ms 504 KB Output is correct
31 Correct 70 ms 12664 KB Output is correct
32 Correct 45 ms 18012 KB Output is correct
33 Correct 44 ms 18168 KB Output is correct
34 Correct 81 ms 14584 KB Output is correct
35 Correct 47 ms 18004 KB Output is correct
36 Correct 42 ms 18040 KB Output is correct
37 Correct 96 ms 18164 KB Output is correct
38 Correct 29 ms 12536 KB Output is correct
39 Correct 31 ms 12664 KB Output is correct