# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
483575 | 2021-10-30T23:34:06 Z | TLP39 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 0 ms | 204 KB |
#include<bits/stdc++.h> using namespace std; int h,w; char jewel[3010][3010]; int orbRight[3010][3010]; int ingotDown[3010][3010]; void getOrb() { for(int i=0;i<h;i++) { orbRight[i][w-1] = 0; for(int j=w-1;j>=1;j--) { orbRight[i][j-1] = orbRight[i][j]+(jewel[i][j]=='O'? 1:0); } } } void getIngot() { for(int i=0;i<w;i++) ingotDown[h-1][i] = 0; for(int i=h-1;i>=1;i--) { for(int j=0;j<w;j++) { ingotDown[i-1][j] = ingotDown[i][j]+(jewel[i][j]=='I'? 1:0); } } } long long int total() { long long int tot = 0; for(int i=0;i<h;i++) { for(int j=0;j<w;j++) { if(jewel[i][j]=='J') tot += 1ll * orbRight[i][j] * ingotDown[i][j]; } } return tot; } int main() { scanf("%d %d",&h,&w); for(int i=0;i<h;i++) { for(int j=0;j<w;j++) { scanf("%c ",&jewel[i][j]); } } getOrb(); getIngot(); printf("%lld",total()); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 0 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 0 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 0 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |