Submission #153807

#TimeUsernameProblemLanguageResultExecution timeMemory
153807mhy908JOI 문장 (JOI14_ho_t1)C++14
0 / 100
2 ms504 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]; char arr[10][10]; bool poss[3010][3010]; int ans, num; char c[10]=" JOI"; int main() { scanf("%d %d", &n, &m); for(int i=1; i<=n; i++)scanf("%s", str[i]+1); scanf("%s", arr[0]); scanf("%s", arr[1]); for(int i=1; i<n; i++){ for(int j=1; j<m; j++){ poss[i][j]=true; for(int k=0; k<=1; k++) for(int l=0; l<=1; l++) if(str[i+k][j+l]!=arr[k][l])poss[i][j]=false; if(poss[i][j])num++; } } ans=num; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ int temp=num; for(int k=i; k>=i-1&&k>=1; k--) for(int l=j; l>=j-1&&l>=1; l--) if(poss[k][l])temp--; for(int z=1; z<=3; z++){ char t=str[i][j]; int tempp=temp; str[i][j]=c[z]; for(int k=i; k>=i-1&&k>=1; k--) for(int l=j; l>=j-1&&l>=1; l--){ bool flag=true; for(int a=0; a<=1; a++) for(int b=0; b<=1; b++) if(str[k+a][l+b]!=arr[a][b])flag=false; if(flag)tempp++; } ans=max(ans, tempp); } } } printf("%d", ans); }

Compilation message (stderr)

2014_ho_t1.cpp: In function 'int main()':
2014_ho_t1.cpp:41:22: warning: unused variable 't' [-Wunused-variable]
                 char t=str[i][j];
                      ^
2014_ho_t1.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
2014_ho_t1.cpp:21: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);
                            ~~~~~^~~~~~~~~~~~~~~~
2014_ho_t1.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", arr[0]);
     ~~~~~^~~~~~~~~~~~~~
2014_ho_t1.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", arr[1]);
     ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...