| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1342631 | minhtien | Bitaro the Brave (JOI19_ho_t1) | C++20 | 458 ms | 9380 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3e3+6;
char a[N][N];
ll a1[N][3];
ll a2[N][3];
int n,m;
ll dem=0;
int main()
{
cin >>n >>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> a[i][j];
}
}
for(int j=1;j<=m;j++){
for(int i=1;i<=n;i++){
if(a[i][j]=='J'){
a1[j][0]++;
}
else if(a[i][j]=='O'){
a1[j][1]++;
}
else{
a1[j][2]++;
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]=='J'){
a2[i][0]++;
}
else if(a[i][j]=='O'){
a2[i][1]++;
}
else{
a2[i][2]++;
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]=='J'){
a1[j][0]--;
a2[i][0]--;
}
else if(a[i][j]=='O'){
a1[j][1]--;
a2[i][1]--;
}
else{
a1[j][2]--;
a2[i][2]--;
}
if(a[i][j]=='J'){
if(a2[i][1]>0 && a1[j][2]>0){
dem+=a2[i][1]*a1[j][2];
}
}
}
}
cout << dem;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
