답안 #117694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
117694 2019-06-17T06:42:55 Z JohnTitor Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
327 ms 20548 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
#define __builtin_popcount __builtin_popcountll
using ll=long long; using ld=long double;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2;
template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);}
template <typename T> inline void writeln(T x){write(x); putchar('\n');}
#define taskname "Bitaro"
int h, w;
string s[3000];
int cnt[3000];
int main(){
    #ifdef Aria
        if(fopen(taskname".in", "r"))
            freopen(taskname".in", "r", stdin);
    #endif // Aria
    cin>>h>>w;
    FFOR(i, 0, h) cin>>s[i];
    ll ans=0;
    DFOR(i, h-1, 0){
        FFOR(j, 0, w) if(s[i][j]=='I') cnt[j]++;
        int x=0;
        DFOR(j, w-1, 0) if(s[i][j]=='J'){
//            bug(cnt[j]);
//            bug(x);
            ans+=cnt[j]*x;
        }
        else x+=s[i][j]=='O';
    }
    writeln(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 7 ms 768 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 12 ms 1152 KB Output is correct
19 Correct 10 ms 896 KB Output is correct
20 Correct 10 ms 1152 KB Output is correct
21 Correct 12 ms 1152 KB Output is correct
22 Correct 10 ms 896 KB Output is correct
23 Correct 9 ms 1152 KB Output is correct
24 Correct 11 ms 1152 KB Output is correct
25 Correct 9 ms 896 KB Output is correct
26 Correct 10 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 7 ms 768 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 12 ms 1152 KB Output is correct
19 Correct 10 ms 896 KB Output is correct
20 Correct 10 ms 1152 KB Output is correct
21 Correct 12 ms 1152 KB Output is correct
22 Correct 10 ms 896 KB Output is correct
23 Correct 9 ms 1152 KB Output is correct
24 Correct 11 ms 1152 KB Output is correct
25 Correct 9 ms 896 KB Output is correct
26 Correct 10 ms 1152 KB Output is correct
27 Correct 327 ms 20124 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 22 ms 2040 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 235 ms 16032 KB Output is correct
32 Correct 275 ms 20548 KB Output is correct
33 Correct 269 ms 20472 KB Output is correct
34 Correct 266 ms 18524 KB Output is correct
35 Correct 278 ms 20448 KB Output is correct
36 Correct 276 ms 20472 KB Output is correct
37 Correct 327 ms 20504 KB Output is correct
38 Correct 191 ms 15864 KB Output is correct
39 Correct 187 ms 15868 KB Output is correct