Submission #153800

#TimeUsernameProblemLanguageResultExecution timeMemory
153800mhy908Dango Maker (JOI18_dango_maker)C++14
13 / 100
3 ms424 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define mp make_pair #define llinf 8987654321987654321 #define inf 1987654321 using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; int n, m; char str[3010][3010]; int dp[6010], arr[6010], ans; int main() { scanf("%d %d", &n, &m); for(int i=1; i<=n; i++)scanf("%s", str[i]+1); for(int i=2; i<=n+m; i++){ memset(dp, 0, sizeof(dp)); memset(arr, 0, sizeof(arr)); for(int j=1; j<i; j++){ dp[j]=dp[j-1]; if(j>m||i-j>n)continue; int x=i-j, y=j; if(str[x][y]=='G'&&str[x-1][y]=='R'&&str[x+1][y]=='W')arr[j]+=1; if(str[x][y]=='G'&&str[x][y-1]=='R'&&str[x][y+1]=='W')arr[j]+=2; if(!arr[j-1]&&arr[j])dp[j]++; else if(arr[j]==3)dp[j]++; else if(arr[j]==1&&(arr[j-1]&1))dp[j]++; else if(arr[j]==2&&(arr[j-1]&2))dp[j]++; if(arr[j]==3&&arr[j-1]==1)arr[j]=1; if(arr[j]==3&&arr[j-1]==2)arr[j]=2; } ans+=dp[i-1]; } printf("%d", ans); }

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
dango_maker.cpp:18:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
                            ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...