답안 #130616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130616 2019-07-15T18:08:23 Z doowey Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
327 ms 88540 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
 
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 3005;

int O[N][N];
int I[N][N];

bool is[N][N];

int main(){
    fastIO;
    int n, m;
    cin >> n >> m;
    char f;
    for(int i = 1; i <= n; i ++ ){
        for(int j = 1; j <= m ; j ++ ){
            cin >> f;
            if(f == 'J')
                is[i][j] = true;
            else if(f == 'O')
                O[i][j] = 1;
            else
                I[i][j] = 1;
        }
    }
    for(int i = 1; i <= n; i ++ ){
        for(int j = 1; j <= m ; j ++ ){
            O[i][j] += O[i][j-1];
            I[i][j] += I[i-1][j];
        }
    }
    ll res = 0;
    for(int i = 1; i <= n; i ++ ){
        for(int j = 1; j <= m; j ++ ){
            res += is[i][j] * (O[i][m] - O[i][j]) * (I[n][j] - I[i][j]);
        }
    }
    cout << res;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1540 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1500 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1540 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1500 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 7 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 15 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 14 ms 7928 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 12 ms 7928 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 15 ms 8056 KB Output is correct
25 Correct 12 ms 7928 KB Output is correct
26 Correct 13 ms 7928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 1528 KB Output is correct
6 Correct 3 ms 1528 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1540 KB Output is correct
9 Correct 3 ms 1528 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1500 KB Output is correct
12 Correct 5 ms 1528 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 15 ms 7544 KB Output is correct
15 Correct 7 ms 4984 KB Output is correct
16 Correct 7 ms 4344 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 15 ms 8056 KB Output is correct
19 Correct 14 ms 7928 KB Output is correct
20 Correct 14 ms 7928 KB Output is correct
21 Correct 15 ms 8056 KB Output is correct
22 Correct 12 ms 7928 KB Output is correct
23 Correct 13 ms 7928 KB Output is correct
24 Correct 15 ms 8056 KB Output is correct
25 Correct 12 ms 7928 KB Output is correct
26 Correct 13 ms 7928 KB Output is correct
27 Correct 317 ms 88036 KB Output is correct
28 Correct 22 ms 25592 KB Output is correct
29 Correct 21 ms 7800 KB Output is correct
30 Correct 3 ms 632 KB Output is correct
31 Correct 240 ms 72596 KB Output is correct
32 Correct 256 ms 88440 KB Output is correct
33 Correct 237 ms 88440 KB Output is correct
34 Correct 278 ms 84216 KB Output is correct
35 Correct 261 ms 88440 KB Output is correct
36 Correct 266 ms 88184 KB Output is correct
37 Correct 327 ms 88540 KB Output is correct
38 Correct 181 ms 72568 KB Output is correct
39 Correct 194 ms 72412 KB Output is correct