# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
627552 | Farhan_HY | Strah (COCI18_strah) | C++14 | 1092 ms | 68324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define float double
#define pb push_back
#define F first
#define S second
#define T int t; cin >> t; while(t--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
/// Benzema is the best player in the world
const int inf = 8e18;
const int N = 2002;
const int M = 1e3 + 3;
const int LOG = 31;
const int mod = 1e9 + 7;
const float pi = atan(1) * 4;
int n, m, dp[N][N], suf[N][N];
string s[N];
void build()
{
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
dp[i][j] += dp[i][j - 1] + i;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
dp[i][j] += dp[i][j - 1];
}
main()
{
IOS
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> s[i], s[i] = '.' + s[i];
build();
for(int i = 1; i <= n; i++)
{
suf[i][m + 1] = m + 1;
for(int j = m; j; j--)
{
suf[i][j] = suf[i][j + 1];
if (s[i][j] == '#') suf[i][j] = j;
}
}
int ans = 0;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
int k = i;
int lst = m + 1;
while(suf[k][j] != j && k <= n)
{
lst = min(lst, suf[k][j]);
int y = lst - j;
ans += dp[k - i + 1][y];
k++;
}
}
}
cout << ans;
}
///use scanf
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |