Submission #151417

#TimeUsernameProblemLanguageResultExecution timeMemory
151417TadijaSebezJOI 문장 (JOI14_ho_t1)C++11
100 / 100
162 ms3420 KiB
#include <bits/stdc++.h> using namespace std; const int N=2005; char flag[N][N],emblem[2][3]; int n,m; int Check(int x, int y) { if(x<n && y<m && x>0 && y>0) { for(int i=0;i<2;i++) for(int j=0;j<2;j++) if(flag[x+i][y+j]!=emblem[i][j]) return 0; return 1; } else return 0; } int Calc(int x, int y, char f) { char tmp=flag[x][y]; int pre=Check(x-1,y-1)+Check(x,y-1)+Check(x-1,y)+Check(x,y); flag[x][y]=f; int nxt=Check(x-1,y-1)+Check(x,y-1)+Check(x-1,y)+Check(x,y); flag[x][y]=tmp; return nxt-pre; } int main() { int ans=0,mx=0; scanf("%i %i",&n,&m); for(int i=1;i<=n;i++) scanf("%s",flag[i]+1); scanf("%s %s",emblem[0],emblem[1]); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { mx=max(mx,Calc(i,j,'J')); mx=max(mx,Calc(i,j,'O')); mx=max(mx,Calc(i,j,'I')); ans+=Check(i,j); } printf("%i\n",ans+mx); return 0; }

Compilation message (stderr)

2014_ho_t1.cpp: In function 'int main()':
2014_ho_t1.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
2014_ho_t1.cpp:30:29: 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",flag[i]+1);
                        ~~~~~^~~~~~~~~~~~~~~~
2014_ho_t1.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s %s",emblem[0],emblem[1]);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...