# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
411786 | kimbj0709 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 456 ms | 218240 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define maxn 3050
int pref1[maxn][maxn];
int pref2[maxn][maxn];
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,m;
cin >> n >> m;
memset(pref1,0,sizeof(pref1));
memset(pref2,0,sizeof(pref2));
char input;
vector<pair<int,int> > pos;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> input;
if(input=='I'){
pref2[i][j] = 1;
}
else if(input=='J'){
pos.push_back({i,j});
}
else if(input=='O'){
pref1[i][j] = 1;
}
}
}
for(int i=0;i<maxn;i++){
for(int j=maxn-2;j>=0;j--){
pref1[i][j] += pref1[i][j+1];
pref2[j][i] += pref2[j+1][i];
}
}
int ans = 0;
for(int i=0;i<pos.size();i++){
ans += pref1[pos[i].f][pos[i].s]*pref2[pos[i].f][pos[i].s];
//cout << pos[i].f << " " << pos[i].s << " " << pref1[pos[i].f][pos[i].s]*pref2[pos[i].f][pos[i].s] << "\n";
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |