Submission #74347

#TimeUsernameProblemLanguageResultExecution timeMemory
74347khsoo01Oriental P.A.D.A.K (FXCUP2_padak)C++11
0 / 1
367 ms65828 KiB
#include<bits/stdc++.h> using namespace std; const int inf = 1e9; int n, m, k, b, z, x, y, a[1000005], d[1000005]; queue<int> q; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { scanf("%d%d%d%d%d",&n,&m,&k,&b,&z); for(int i=0;i<n*m;i++) d[i] = inf; for(int i=1;i<=k;i++) { int A, B; scanf("%d%d",&A,&B); A--; B--; if(d[A*m+B] == inf) { d[A*m+B] = 0; q.push(A*m+B); } } while(!q.empty()) { int T = q.front(); q.pop(); int A = T/m, B = T%m; if(y/z < d[T]) y++; a[d[T]]++; for(int i=0;i<4;i++) { int na = A+dx[i], nb = B+dy[i]; if(0 <= na && na < n && 0 <= nb && nb < m && d[na*m+nb] == inf) { d[na*m+nb] = d[T] + 1; q.push(na*m+nb); } } } for(int i=n*m;i>=0;i--) { for(int j=0;j<a[i];j++) { if(x/z < i) x++; } } printf("%d %d\n",x,y); }

Compilation message (stderr)

padak.cpp: In function 'int main()':
padak.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d%d",&n,&m,&k,&b,&z);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
padak.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&A,&B); A--; B--;
   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...