Task: | Elegant Showroom |
Sender: | KnowYourArchitecture |
Submission time: | 2016-11-12 14:17:03 +0200 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | WRONG ANSWER | 0.05 s | details |
#3 | WRONG ANSWER | 0.06 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | WRONG ANSWER | 0.05 s | details |
#6 | WRONG ANSWER | 0.06 s | details |
#7 | WRONG ANSWER | 0.07 s | details |
#8 | WRONG ANSWER | 0.06 s | details |
#9 | WRONG ANSWER | 0.06 s | details |
#10 | WRONG ANSWER | 0.05 s | details |
#11 | WRONG ANSWER | 0.06 s | details |
#12 | WRONG ANSWER | 0.06 s | details |
#13 | WRONG ANSWER | 0.05 s | details |
#14 | ACCEPTED | 0.05 s | details |
#15 | ACCEPTED | 0.05 s | details |
#16 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:33:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (x-1 < 0 || y-1 < 0 || x-1 >= map.size() || y-1 >= map[x-1].size()) ^ input/code.cpp:33:71: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (x-1 < 0 || y-1 < 0 || x-1 >= map.size() || y-1 >= map[x-1].size()) ^
Code
#include <iostream> #include <string> #include <vector> #include <queue> using namespace std; typedef pair<int, int> P; #define X first #define Y second bool visited[500][500]; int main() { int r, c; cin >> r >> c; vector<string> map(r); for (string &s : map) cin >> s; queue<pair<P, int>> q; int x, y; cin >> x >> y; q.push({P(x, y), 1}); visited[x][y] = true; while (!q.empty()) { auto t = q.front(); q.pop(); int x = t.first.X; int y = t.first.Y; int d = t.second; if (x-1 < 0 || y-1 < 0 || x-1 >= map.size() || y-1 >= map[x-1].size()) continue; char r = map[x-1][y-1]; //cout<<x<<" "<<y<<" "<<d<<" "<<r<<endl; if (r == '#') continue; if (r == 'D') d--; if (x == 1 || y == 1 || x == r || y == c) { cout << d << "\n"; return 0; } #define FOO(x, y) \ if (!visited[x][y]) { \ q.push({P(x, y), d+1}); \ visited[x][y] = true; \ } FOO(x+1,y) FOO(x-1,y) FOO(x,y+1) FOO(x,y-1) } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
20 20 DDDDDDDDDDD##DD#DD#D DDccccc#c##c##cDccDD Dc#c#c#cc#ccc#c#Dc#D DccDc#Dc####ccc#c#DD ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 2
Verdict: WRONG ANSWER
input |
---|
20 20 #################### #cccccccccccccccccc# #c################c# #c#cccccccccccccc#c# ... |
correct output |
---|
179 |
user output |
---|
(empty) |
Test 3
Verdict: WRONG ANSWER
input |
---|
20 20 #################### #cccccccccccccccccc# #cccccccccccccccccc# #cccccccccccccccccc# ... |
correct output |
---|
35 |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
400 400 DDD##D#DD##DDDDDDDD#DDDD###DDD... |
correct output |
---|
63 |
user output |
---|
6 |
Test 5
Verdict: WRONG ANSWER
input |
---|
400 400 #DDD###D#DD#DD#DD##DDD##D#DDD#... |
correct output |
---|
11 |
user output |
---|
76 |
Test 6
Verdict: WRONG ANSWER
input |
---|
400 400 DDDDDDD#D#DDDD##D#DDDDDDD#DD##... |
correct output |
---|
37 |
user output |
---|
55 |
Test 7
Verdict: WRONG ANSWER
input |
---|
400 400 #######D#DDD#D##DD####DDDDDD##... |
correct output |
---|
55 |
user output |
---|
73 |
Test 8
Verdict: WRONG ANSWER
input |
---|
400 400 DD############################... |
correct output |
---|
184 |
user output |
---|
135 |
Test 9
Verdict: WRONG ANSWER
input |
---|
20 20 DDDDD#DDDDDDDDD##D#D DccccD#DccccDcDD#c#D Dc###DD#c#ccDcccc#DD DccDc##DccccDcccc#DD ... |
correct output |
---|
4 |
user output |
---|
5 |
Test 10
Verdict: WRONG ANSWER
input |
---|
5 6 ####D# #DDDD# #D##c# #DDDc# ... |
correct output |
---|
1 |
user output |
---|
2 |
Test 11
Verdict: WRONG ANSWER
input |
---|
20 20 DDDDDD#DDDDDD#D#D#D# Dc#cccccccDcc#ccccDD DDcD#c##cDcc####Dc#D D#Dcccc#D##ccc#c#D#D ... |
correct output |
---|
5 |
user output |
---|
7 |
Test 12
Verdict: WRONG ANSWER
input |
---|
20 20 DDD#DDDD#DDDD#DDDD#D Dc##DDccDccD#DDcDDDD DcDDccc#cc#ccc##D##D DcccD#cDc##Dcccc##D# ... |
correct output |
---|
3 |
user output |
---|
4 |
Test 13
Verdict: WRONG ANSWER
input |
---|
20 20 #D###DD##DDDDDD###DD DDcDDccccDccDccDcc#D DcD##ccc#cDcDccccDD# DDcccc#Dc####c##ccDD ... |
correct output |
---|
7 |
user output |
---|
10 |
Test 14
Verdict: ACCEPTED
input |
---|
6 7 ####### #ccc#cD #c#c#c# #c#c#c# ... |
correct output |
---|
14 |
user output |
---|
14 |
Test 15
Verdict: ACCEPTED
input |
---|
5 5 DDDDD DDDDD DDcDD DDDDD ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 16
Verdict: ACCEPTED
input |
---|
3 3 ### #cD ### 2 2 |
correct output |
---|
1 |
user output |
---|
1 |