이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define MAXI (int) 1e6
ll a[MAXI];
ll si[MAXI];
ll r[MAXI];
ll maxi = 0;
ll sum = 0;
void solve(){
int h,w; cin >> h >> w;
char mat[h][w];
vector<int> down(w,0);
vector<int> right(h,0);
for(int i = 0;i<h;i++){
for(int j =0;j<w;j++){
cin >> mat[i][j];
if(mat[i][j] == 'I') down[j]++;
if(mat[i][j] == 'O') right[i]++;
}
}
for(int i = 0;i<h;i++){
for(int j =0;j<w;j++){
if(mat[i][j] == 'I') down[j]--;
if(mat[i][j] == 'O') right[i]--;
if(mat[i][j] == 'J') sum += down[j]*right[i];
}
}
cout << sum;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(nullptr);
cout << fixed << setprecision(8);
int t = 1;
//cin >> t;
while(t){
solve();
t--;
cout << "\n";
}
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... |