제출 #15085

#제출 시각아이디문제언어결과실행 시간메모리
15085sujin빨간 직사각형 (kriii3_QQ)C++98
10 / 20
1000 ms10004 KiB
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <vector> using namespace std; int N, M; char G[3001][3001]; long long S; int main(){ scanf("%d %d", &N, &M); for (int i = 1; i <= N; i++) for (int j = 1; j <= M; j++) scanf(" %c", &G[i][j]); vector<int> D[2]; for (int j = 1; j <= M; j++){ D[0].clear(); D[1].clear(); for (int i = 1; i <= N; i++){ if (G[i][j] == 'R'){ int s = D[!(i % 2)].size(); for (int k = j; G[i][k] == 'R'; k--){ int d = (j - k < s ? D[!(i % 2)][j - k] : 0); D[i % 2].push_back(d + 1); S += d + 1; } } D[!(i % 2)].clear(); } } printf("%lld", S); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...