# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224504 | 2020-04-18T08:41:49 Z | Ruxandra985 | Dango Maker (JOI18_dango_maker) | C++14 | 6 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; char a[3010][3010]; int dp[3010][3010][3]; int main() { FILE *fin = stdin; FILE *fout = stdout; int n , m , dif , i , j , sol = 0; fscanf (fin,"%d%d\n",&n,&m); for (i = 1 ; i <= n ; i++) fgets(a[i] + 1 , m + 10 , fin); for (dif = 1 - m ; dif <= n - 1 ; dif++){ for (i = 1 ; i <= n ; i++){ /// i - j = dif j = i - dif; if (j <= 0 || j > m) continue; /// nu e ok /// acum avem o pereche i j dp[i][j][0] = max(dp[i - 1][j + 1][0] ,max ( dp[i - 1][j + 1][1] , dp[i - 1][j + 1][2] )); /// nu mi se impune nimic pt ca nu l iau pe i j if (a[i][j - 1] == 'R' && a[i][j] == 'G' && a[i][j + 1] == 'W') dp[i][j][1] = max(dp[i - 1][j + 1][0] , dp[i - 1][j + 1][1]) + 1; /// R G W orizontal if (a[i - 1][j] == 'R' && a[i][j] == 'G' && a[i + 1][j] == 'W') dp[i][j][1] = max(dp[i - 1][j + 1][0] , dp[i - 1][j + 1][2]) + 1; /// R G W vertical if (i + 1 > n || j - 1 <= 0) /// stare finala, n o mai folosesc la nimic sol += max(dp[i][j][0] , max(dp[i][j][1] , dp[i][j][2])); } } fprintf (fout,"%d",sol); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Incorrect | 4 ms | 384 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Incorrect | 4 ms | 384 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Incorrect | 4 ms | 384 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |