제출 #464494

#제출 시각아이디문제언어결과실행 시간메모리
464494kilikumaT-Covering (eJOI19_covering)C++14
0 / 100
2 ms332 KiB
#include <bits/stdc++.h> using namespace std; int maxi=0; int m, n; bool dans(int lig, int col) { if (lig<0||col<0||lig>=m||col>=n) return false; return true; } int main() { scanf("%d%d", &m,&n); int grille[m+1][n+1]; for (int lig=0;lig<m;lig++) { for (int col=0;col<n;col++) { scanf("%d",&grille[lig][col]); } } int k; scanf("%d",&k); for (int i=0;i<k;i++) { int r, c; scanf("%d%d",&r,&c); int maxiCur = 0; // premier cas if (dans(r-1,c-1)&&dans(r-1,c+1)) { // printf("oriter"); maxiCur = max(maxiCur, grille[r-1][c-1]+grille[r-1][c]+grille[r-1][c+1]+grille[r][c]); } if (dans(r-1,c+1)&&dans(r+1,c+1)) { // printf("oriter"); maxiCur= max(maxiCur, grille[r-1][c+1]+grille[r][c+1]+grille[r+1][c+1]+grille[r][c]); } if (dans(r+1,c-1)&&dans(r+1,c+1)) { // printf("oriter"); maxiCur = max(maxiCur, grille[r+1][c-1]+grille[r+1][c]+grille[r+1][c+1]+grille[r][c]); } if (dans(r-1,c-1)&&dans(r+1,c-1)) { // printf("oriter"); maxiCur = max(maxiCur, grille[r-1][c-1]+grille[r][c-1]+grille[r+1][c-1]+grille[r][c]); } // 2 // 3 // 4 maxi += maxiCur; } printf("%d\n", maxi); }

컴파일 시 표준 에러 (stderr) 메시지

covering.cpp: In function 'int main()':
covering.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d", &m,&n);
      |   ~~~~~^~~~~~~~~~~~~~~
covering.cpp:14:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |       scanf("%d",&grille[lig][col]);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
covering.cpp:17:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   int k; scanf("%d",&k);
      |          ~~~~~^~~~~~~~~
covering.cpp:19:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     int r, c; scanf("%d%d",&r,&c);
      |               ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...