Submission #950851

#TimeUsernameProblemLanguageResultExecution timeMemory
950851ace5Dango Maker (JOI18_dango_maker)C++17
100 / 100
82 ms18028 KiB
#include <cstdio> char a[3001][3001]; bool u[3001][3001]; int ans = 0; int main(){ int n,m; scanf("%d%d",&n,&m); for(int i = 0;i < n;++i)scanf("%s",a[i]); for(int i = 0;i < n;++i) for(int j = 0;j < m;++j){ if(a[i][j]!='R')continue; if(j<m-2&&a[i][j+1]=='G'&&a[i][j+2]=='W'&&!(u[i][j+1]+u[i][j+2]))ans++; else if(i<n-2&&a[i+1][j]=='G'&&a[i+2][j]=='W'){ if(j>0&&j<m-1&&a[i+1][j-1]=='R'&&a[i+1][j+1]=='W'&&!u[i+1][j+1])u[i+1][j]=1; else u[i+2][j]=1; ans++; } } printf("%d",ans); }

Compilation message (stderr)

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