제출 #467949

#제출 시각아이디문제언어결과실행 시간메모리
467949RibljiKeksicDango Maker (JOI18_dango_maker)C++14
0 / 100
3 ms476 KiB
#include <bits/stdc++.h>

using namespace std;

int n,m,DP[3010][3010][5],u;
string s[3010],f;

int main()
{
    freopen("03-29.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    for(int i=0; i<n; i++)
    {
        cin >> f;
        s[i+1] += ' ';
        s[i+1] += f;
    }
    fclose(stdin);
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; 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]));
            if(s[i][j]=='G')
            {
                if(s[i][j-1]=='R' && s[i][j+1]=='W') DP[i][j][1] = max(DP[i-1][j+1][0],DP[i-1][j+1][1]) + 1;
                if(s[i-1][j]=='R' && s[i+1][j]=='W') DP[i][j][2] = max(DP[i-1][j+1][0],DP[i-1][j+1][2]) + 1;
            }
            if(j==1)
            {
                u += max(DP[i][j][0],max(DP[i][j][1],DP[i][j][2]));
            }
            else
            {
                if(i==n)
                {
                    u += max(DP[i][j][0],max(DP[i][j][1],DP[i][j][2]));
                }
            }
        }
    }
    cout << u <<endl;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     freopen("03-29.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...