Submission #946963

#TimeUsernameProblemLanguageResultExecution timeMemory
946963ezzzayDango Maker (JOI18_dango_maker)C++14
13 / 100
2 ms4696 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define double long double const int N=3e3+5; char arr[N][N]; int ans=0; int n,m; int dp[N][N]; void fun(int y, int x, int w){ if(dp[y][x]>w)return; dp[y][x]=w; ans=max(ans,w); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(arr[i][j]=='R' and arr[i][j+1]=='G' and arr[i][j+2]=='W'){ arr[i][j]='X'; arr[i][j+1]='X'; arr[i][j+2]='X'; fun(i,j,w+1); arr[i][j]='R'; arr[i][j+1]='G'; arr[i][j+2]='W'; } if(arr[i][j]=='R' and arr[i+1][j]=='G' and arr[i+2][j]=='W'){ arr[i][j]='X'; arr[i+1][j]='X'; arr[i+2][j]='X'; fun(i,j,w+1); arr[i][j]='R'; arr[i+1][j]='G'; arr[i+2][j]='W'; } } } } signed main(){ cin>>n>>m; int cnt=0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ dp[i][j]=0; cin>>arr[i][j]; } } fun(1,1,0); cout<<ans; }

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:44:9: warning: unused variable 'cnt' [-Wunused-variable]
   44 |     int cnt=0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...