Submission #28620

# Submission time Handle Problem Language Result Execution time Memory
28620 2017-07-16T08:05:44 Z Shocking Hot(#1200, khsoo01) Oriental P.A.D.A.K (FXCUP2_padak) C++14
0 / 1
1000 ms 64852 KB
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, m, k, b, z, x, y, a[1000005];
vector<int> 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=1;i<=n;i++) {
		d[i].reserve(m+1);
		d[i].push_back(0);
		for(int j=1;j<=m;j++) d[i].push_back(inf);
	}
	for(int i=1;i<=k;i++) {
		int A, B;
		scanf("%d%d",&A,&B);
		if(d[A][B] == inf) {
			d[A][B] = 0;
			q.push(A*(m+1)+B);
		}
	}
	while(!q.empty()) {
		int A, B, T; T = q.front(); q.pop();
		A = T / (m+1); B = T % (m+1);
		a[d[A][B]]++;
		for(int i=0;i<4;i++) {
			int na = A+dx[i], nb = B+dy[i];
			if(1 <= na && na <= n && 1 <= nb && nb <= m && d[na][nb] == inf) {
				d[na][nb] = d[A][B] + 1;
				q.push(na*(m+1)+nb);
			}
		}
	}
	for(int i=0;i<=n*m;i++) {
		for(int j=0;j<a[i];j++) {
			if(y/z < i) y++;
		}
	}
	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

padak.cpp: In function 'int main()':
padak.cpp:13:36: 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:21:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&A,&B);
                      ^
# Verdict Execution time Memory Grader output
1 Correct 6 ms 29368 KB Output is correct
2 Correct 6 ms 29368 KB Output is correct
3 Correct 49 ms 33328 KB Output is correct
4 Correct 53 ms 33356 KB Output is correct
5 Correct 49 ms 33308 KB Output is correct
6 Correct 59 ms 35572 KB Output is correct
7 Correct 53 ms 33352 KB Output is correct
8 Correct 46 ms 33276 KB Output is correct
9 Correct 86 ms 60652 KB Output is correct
10 Correct 49 ms 33328 KB Output is correct
11 Correct 49 ms 33356 KB Output is correct
12 Correct 56 ms 33308 KB Output is correct
13 Correct 63 ms 35704 KB Output is correct
14 Correct 53 ms 33352 KB Output is correct
15 Correct 46 ms 33276 KB Output is correct
16 Correct 156 ms 60652 KB Output is correct
17 Correct 66 ms 33460 KB Output is correct
18 Correct 49 ms 33620 KB Output is correct
19 Correct 89 ms 33440 KB Output is correct
20 Correct 69 ms 35704 KB Output is correct
21 Correct 89 ms 33880 KB Output is correct
22 Correct 49 ms 33276 KB Output is correct
23 Correct 249 ms 60652 KB Output is correct
24 Correct 416 ms 37524 KB Output is correct
25 Correct 429 ms 37524 KB Output is correct
26 Correct 426 ms 37432 KB Output is correct
27 Correct 736 ms 39852 KB Output is correct
28 Correct 426 ms 37508 KB Output is correct
29 Correct 413 ms 37400 KB Output is correct
30 Execution timed out 1000 ms 64852 KB Execution timed out
31 Halted 0 ms 0 KB -