Submission #1301035


Source Code Expand

Copy

#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t H,W,K;
char map[1000][1000];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> H>>W>>K;
	for (size_t i = 0; i < H; i++)
	{
		in >> map[i];
	}
	int sx, sy;
	for (size_t i = 0; i < H; i++)
	{
		for (size_t w = 0; w < W; w++)
		{
			if (map[i][w] == 'S') {
				sx = w; sy = i; map[i][w] = '.';
			}
		}
	}

	int res = H*W;
	for (int i = 0; i < H; i++)
	{
		for (int w = 0; w < W; w++)
		{
			if (map[i][w] != '#' && ((std::abs(i-sy)+ std::abs(w-sx)) <= K)) {
				res = std::min(res, 1 + (std::min({ i,H - i - 1,w,W - w - 1 })+K-1)/K);
			}
		}
	}
	std::cout << res << std::endl;

	return 0;
}
#endif

Submission Info

Submission Time
Task C - Closed Rooms
User eiya
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1132 Byte
Status
Exec Time 7 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
× 3
× 25
× 21
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in3.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in4.txt, in40.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt 6 ms 1024 KB
in10.txt 5 ms 1024 KB
in11.txt 5 ms 1024 KB
in12.txt 5 ms 1024 KB
in13.txt 6 ms 1024 KB
in14.txt 5 ms 1024 KB
in15.txt 5 ms 1024 KB
in16.txt 6 ms 1024 KB
in17.txt 6 ms 1024 KB
in18.txt 6 ms 1024 KB
in19.txt 6 ms 1024 KB
in2.txt 7 ms 1024 KB
in20.txt 2 ms 1024 KB
in21.txt 1 ms 256 KB
in22.txt 1 ms 256 KB
in23.txt 5 ms 1024 KB
in24.txt 5 ms 1024 KB
in25.txt 5 ms 1024 KB
in26.txt 5 ms 1024 KB
in27.txt 5 ms 1024 KB
in28.txt 6 ms 1024 KB
in29.txt 6 ms 1024 KB
in3.txt 6 ms 1024 KB
in30.txt 5 ms 1024 KB
in31.txt 5 ms 1024 KB
in32.txt 5 ms 1024 KB
in33.txt 6 ms 1024 KB
in34.txt 6 ms 1024 KB
in35.txt 4 ms 1024 KB
in36.txt 4 ms 1024 KB
in37.txt 4 ms 1024 KB
in38.txt 4 ms 1024 KB
in39.txt 4 ms 1024 KB
in4.txt 7 ms 1024 KB
in40.txt 4 ms 1024 KB
in5.txt 7 ms 1024 KB
in6.txt 6 ms 1024 KB
in7.txt 6 ms 1024 KB
in8.txt 7 ms 1024 KB
in9.txt 6 ms 1024 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB
sample3.txt 1 ms 256 KB