# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1005644 | MarwenElarbi | Bitaro the Brave (JOI19_ho_t1) | C++17 | 11 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int nax=2e3+5;
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
optimise;
int n,m;
cin>>n>>m;
char grid[n][m];
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
cin>>grid[i][j];
}
}
long long ans=0;
int xx[n][m];
int yy[n][m];
for (int i = 0; i < n; ++i)
{
int cur=0;
for (int j = m-1; j >= 0; --j)
{
if(grid[i][j]=='O') cur++;
xx[i][j]=cur;
}
}
for (int j = 0; j < m; ++j)
{
int cur=0;
for (int i = n-1; i >= 0; --i)
{
if(grid[i][j]=='I') cur++;
yy[i][j]=cur;
}
}
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
if(grid[i][j]=='J'){
ans+=yy[i][j]*xx[i][j];
}
}
}
cout <<ans<<endl;
}
컴파일 시 표준 에러 (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... |