제출 #1053128

#제출 시각아이디문제언어결과실행 시간메모리
1053128NickpapadakT-Covering (eJOI19_covering)C++14
0 / 100
1 ms508 KiB
#include<bits/stdc++.h> using namespace std; #define XX first #define YY second const unsigned int MAXK = 1e+6 + 10; vector<vector<int>> grid; vector<pair<int,int>> special; int N,M, K; int firsSub(){ int ans = 0; // totalinc = 0/; for(int i = 0; i<K; ++i){ int c = 0; int x = special[i].XX, y = special[i].YY; int u = 0,r=0,l=0,d=0; r += grid[x+1][y]; r += grid[x][y+1]; r += grid[x][y-1]; l += grid[x-1][y]; l += grid[x][y+1]; l += grid[x][y-1]; d += grid[x-1][y]; d += grid[x+1][y]; d += grid[x][y-1]; u += grid[x-1][y]; u += grid[x+1][y]; u += grid[x][y+1]; // int x = special[i].X, y = special[i].Y; ans += grid[x][y]; if(x == 1){ ans += r; c++; } if(x == M){ ans += l; c++; } if(y == 1){ ans += d; c++; } if(y==M){ ans += u; c++; } if(c>=2) return -1; if(c==1) continue; int best = max(l, r); best = max(best, u); ans += max(best, d); } return ans; } int main(){ scanf("%d%d", &N,&M);// N = y M = x grid.resize(M+2, vector<int>(N+2, 0)); for(int y = 1; y <=N;++y){ for(int x = 1; x <=M; ++x){ scanf("%d", &grid[x][y]); // printf("done\n"); } } scanf("%d", &K); for(int i = 1; i<=K; ++i){ int a,b; scanf("%d%d", &a,&b); special.push_back({a+1,b+1}); } int sol = firsSub(); if(sol == -1) printf("No"); else printf("%d", sol); return 0; }

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

covering.cpp: In function 'int main()':
covering.cpp:60:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     scanf("%d%d", &N,&M);// N = y M = x
      |     ~~~~~^~~~~~~~~~~~~~~
covering.cpp:64:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |             scanf("%d", &grid[x][y]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~
covering.cpp:68:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |     scanf("%d", &K);
      |     ~~~~~^~~~~~~~~~
covering.cpp:71:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |         scanf("%d%d", &a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~
#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...