제출 #237609

#제출 시각아이디문제언어결과실행 시간메모리
237609PbezzT-Covering (eJOI19_covering)C++14
5 / 100
131 ms4216 KiB
#include <bits/stdc++.h> using namespace std; #define loop(i,n) for (ll i = 0; i < n; i++) #define ll int #define INF 1e9+5 #define MAXN 1005 #define MOD 1000000000007 #define pb push_back #define mp make_pair typedef pair<ll,ll> pii; int main(){ ll n,m,k,r,c,ans=0; scanf("%d%d",&m,&n); int arr[m][n]; loop(i,m){ loop(j,n){ scanf("%d",&arr[i][j]); } } scanf("%d",&k); loop(i,k){ cin>>r>>c; ll cur=arr[r][c]; if(r>0&&c>0&&r<m-1&&c<n-1){ cur+=arr[r+1][c]; cur+=arr[r][c+1]; cur+=arr[r-1][c]; cur+=arr[r][c-1]; cur-=min(arr[r][c-1],min(arr[r][c+1],min(arr[r-1][c],arr[r+1][c]))); }else if(r==0){ if(c==0||c==n-1)return -1; cur+=arr[r][c-1]; cur+=arr[r][c+1]; cur+=arr[r+1][c]; }else if(r==m-1){ if(c==0||c==n-1)return -1; cur+=arr[r][c-1]; cur+=arr[r][c+1]; cur+=arr[r-1][c]; }else if(c==0){ cur+=arr[r+1][c]; cur+=arr[r-1][c]; cur+=arr[r][c+1]; }else if(c==n-1){ cur+=arr[r+1][c]; cur+=arr[r-1][c]; cur+=arr[r][c-1]; } if(cur==-1){ printf("No\n");return 0; } ans+=cur; } printf("%d\n",ans); return 0; }

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

covering.cpp: In function 'int main()':
covering.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&m,&n);
  ~~~~~^~~~~~~~~~~~~~
covering.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&arr[i][j]);
   ~~~~~^~~~~~~~~~~~~~~~~
covering.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&k);
  ~~~~~^~~~~~~~~
#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...