# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484162 | 2021-11-02T08:49:01 Z | ToroTN | Bitaro the Brave (JOI19_ho_t1) | C++14 | 0 ms | 204 KB |
#include<bits/stdc++.h> using namespace std; long long n,m,c[3005][3005][2],r[3005][3005][2],cnt=0; char s[3005][3005]; int main() { scanf("%lld%lld",&n,&m); for(int i=1;i<=n;i++) { scanf("%s",s[i]+1); } /*for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(s[i][j]=='O') { c[i][j][0]=c[i-1][j][0]+1; r[i][j][0]=r[i][j-1][0]+1; }else { c[i][j][0]=c[i-1][j][0]; r[i][j][0]=r[i][j-1][0]; } if(s[i][j]=='I') { c[i][j][1]=c[i-1][j][1]+1; r[i][j][1]=r[i][j-1][1]+1; }else { c[i][j][1]=c[i-1][j][1]; r[i][j][1]=r[i][j-1][1]; } } } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(s[i][j]=='J') { cnt+=(c[n][j][0]-c[i][j][0])*(r[i][m][1]-r[i][j][1]); cnt+=(c[n][j][1]-c[i][j][1])*(r[i][m][0]-r[i][j][0]); } } } printf("%lld\n",cnt);*/ for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { for(int k=i+1;k<=n;k++) { for(int l=j+1;l<=n;l++) { if(s[i][j]=='J'&&s[i][l]=='O'&&s[k][j]=='I'||s[i][j]=='J'&&s[i][l]=='I'&&s[k][j]=='O') { ++cnt; } } } } } printf("%lld\n",cnt); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |