# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
308245 | 2020-09-30T13:13:29 Z | Bill_00 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 1000 ms | 179908 KB |
#include <bits/stdc++.h> #define pp push #define mp make_pair #define ff first #define ss second #define pb push_back typedef long long ll; using namespace std; char a[3005][3005]; ll dpi[3005][3005]; ll dpo[3005][3005]; vector<pair<int,int> >J; int main(){ int h,w; cin >> h >> w; for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ cin >> a[i][j]; if(a[i][j]=='J'){ J.pb(mp(i,j)); } } } for(int i=1;i<=w;i++){ for(int j=h;j>=1;j--){ if(a[j][i]=='I'){ dpi[j][i]=dpi[j+1][i]+1; } else dpi[j][i]=dpi[j+1][i]; } } for(int i=1;i<=h;i++){ for(int j=w;j>=1;j--){ if(a[i][j]=='O'){ dpo[i][j]=dpo[i][j+1]+1; } else dpo[i][j]=dpo[i][j+1]; } } ll ans=0; for(int i=0;i<J.size();i++){ int x=J[i].ff; int y=J[i].ss; ans+=(dpo[x][y]*dpi[x][y]); } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 1664 KB | Output is correct |
6 | Correct | 2 ms | 1536 KB | Output is correct |
7 | Correct | 2 ms | 1536 KB | Output is correct |
8 | Correct | 2 ms | 1664 KB | Output is correct |
9 | Correct | 2 ms | 1664 KB | Output is correct |
10 | Correct | 2 ms | 1536 KB | Output is correct |
11 | Correct | 2 ms | 1664 KB | Output is correct |
12 | Correct | 2 ms | 1536 KB | Output is correct |
13 | Correct | 2 ms | 1536 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 1664 KB | Output is correct |
6 | Correct | 2 ms | 1536 KB | Output is correct |
7 | Correct | 2 ms | 1536 KB | Output is correct |
8 | Correct | 2 ms | 1664 KB | Output is correct |
9 | Correct | 2 ms | 1664 KB | Output is correct |
10 | Correct | 2 ms | 1536 KB | Output is correct |
11 | Correct | 2 ms | 1664 KB | Output is correct |
12 | Correct | 2 ms | 1536 KB | Output is correct |
13 | Correct | 2 ms | 1536 KB | Output is correct |
14 | Correct | 25 ms | 9712 KB | Output is correct |
15 | Correct | 4 ms | 5120 KB | Output is correct |
16 | Correct | 16 ms | 5880 KB | Output is correct |
17 | Correct | 1 ms | 512 KB | Output is correct |
18 | Correct | 31 ms | 10732 KB | Output is correct |
19 | Correct | 28 ms | 10100 KB | Output is correct |
20 | Correct | 29 ms | 10612 KB | Output is correct |
21 | Correct | 32 ms | 10732 KB | Output is correct |
22 | Correct | 30 ms | 10748 KB | Output is correct |
23 | Correct | 29 ms | 10604 KB | Output is correct |
24 | Correct | 32 ms | 10868 KB | Output is correct |
25 | Correct | 28 ms | 10100 KB | Output is correct |
26 | Correct | 29 ms | 10612 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 1664 KB | Output is correct |
6 | Correct | 2 ms | 1536 KB | Output is correct |
7 | Correct | 2 ms | 1536 KB | Output is correct |
8 | Correct | 2 ms | 1664 KB | Output is correct |
9 | Correct | 2 ms | 1664 KB | Output is correct |
10 | Correct | 2 ms | 1536 KB | Output is correct |
11 | Correct | 2 ms | 1664 KB | Output is correct |
12 | Correct | 2 ms | 1536 KB | Output is correct |
13 | Correct | 2 ms | 1536 KB | Output is correct |
14 | Correct | 25 ms | 9712 KB | Output is correct |
15 | Correct | 4 ms | 5120 KB | Output is correct |
16 | Correct | 16 ms | 5880 KB | Output is correct |
17 | Correct | 1 ms | 512 KB | Output is correct |
18 | Correct | 31 ms | 10732 KB | Output is correct |
19 | Correct | 28 ms | 10100 KB | Output is correct |
20 | Correct | 29 ms | 10612 KB | Output is correct |
21 | Correct | 32 ms | 10732 KB | Output is correct |
22 | Correct | 30 ms | 10748 KB | Output is correct |
23 | Correct | 29 ms | 10604 KB | Output is correct |
24 | Correct | 32 ms | 10868 KB | Output is correct |
25 | Correct | 28 ms | 10100 KB | Output is correct |
26 | Correct | 29 ms | 10612 KB | Output is correct |
27 | Execution timed out | 1085 ms | 179908 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |