Task: | Tontti |
Sender: | tomivah |
Submission time: | 2015-10-11 22:03:51 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.15 s | 1 | details |
#2 | TIME LIMIT EXCEEDED | -- | 1 | details |
#3 | TIME LIMIT EXCEEDED | -- | 1 | details |
#4 | TIME LIMIT EXCEEDED | -- | 1 | details |
#5 | TIME LIMIT EXCEEDED | -- | 1 | details |
#6 | RUNTIME ERROR | 0.14 s | 2 | details |
#7 | TIME LIMIT EXCEEDED | -- | 2 | details |
#8 | RUNTIME ERROR | 0.14 s | 2 | details |
#9 | RUNTIME ERROR | 0.14 s | 2 | details |
#10 | RUNTIME ERROR | 0.14 s | 2 | details |
#11 | RUNTIME ERROR | 0.15 s | 3 | details |
#12 | TIME LIMIT EXCEEDED | -- | 3 | details |
#13 | RUNTIME ERROR | 0.12 s | 3 | details |
#14 | RUNTIME ERROR | 0.15 s | 3 | details |
#15 | RUNTIME ERROR | 0.14 s | 3 | details |
Compiler report
input/code.cpp: In function 'bool search(std::set<std::pair<std::pair<long long unsigned int, long long unsigned int>, long long unsigned int> >&, std::map<long long unsigned int, std::pair<long long unsigned int, long long unsigned int> >&, std::vector<std::vector<long long unsigned int*> >&)': input/code.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for ( int j = 0; j < cities.at( city.first - 1 ).size(); ++j ) ^
Code
#include <iostream>#include <vector>#include <set>#include <map>#define ull unsigned long longbool search( std::set< std::pair< std::pair< ull, ull>, ull > >& open, std::map< ull, std::pair< ull, ull > >& closed, std::vector< std::vector< ull* > >& cities ){std::pair< ull, std::pair< ull, ull> > city( open.begin()->second, open.begin()->first );if ( city.first == cities.size() ){std::cout << city.second.first << "\n";return true;}closed.insert( city );open.erase( open.begin() );for ( int j = 0; j < cities.at( city.first - 1 ).size(); ++j ){ull* path = cities.at( city.first - 1 ).at( j );ull cost = city.second.first;if ( city.second.second % 2 == 0 ){cost += path[ 1 ];}if ( !closed.count( path[ 0 ] ) ){open.insert( std::pair< std::pair< ull, ull >, ull >( std::pair< ull, ull >( cost, city.second.second + 1 ), path[ 0 ] ) );}else if ( city.second.second % 2 == closed[ path[ 0 ] ].second % 2 && city.second.second < closed[ path[ 0 ] ].second + 10 ){open.insert( std::pair< std::pair< ull, ull >, ull >( std::pair< ull, ull >( cost, city.second.second + 1 ), path[ 0 ] ) );closed.erase( path[ 0 ] );}}return false;}int main(){std::ios_base::sync_with_stdio( false );ull cityCount, pathCount;std::cin >> cityCount >> pathCount;std::vector< std::vector< ull* > > cities;for ( ull i = 0; i < cityCount; ++i ){std::vector< ull* > vec;cities.push_back( vec );}for ( ull i = 0; i < pathCount; ++i ){ull from;ull* path = new ull[ 2 ];std::cin >> from >> path[ 0 ] >> path[ 1 ];cities.at( from - 1 ).push_back( path );}std::set< std::pair< std::pair< ull, ull>, ull > > open;open.insert( std::pair< std::pair< ull, ull>, ull >( std::pair< ull, ull >( 0, 0 ), 1 ) );std::map< ull, std::pair< ull, ull > > closed;while ( !search( open, closed, cities ) ){}for ( ull i = 0; i < cityCount; ++i ){for ( ull j = 0; j < cities.at( i ).size(); ++j ){delete[] cities.at( i ).at( j );}}return 0;}
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
10 10 1 ......*... .......*.. *..*....*. *....*.... ... |
correct output |
---|
94 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 10)
Test 2
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 10 5 ********** ********** ********** ********** ... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 3
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 10 10 **...*...* *..*.**.*. ...**.*..* *...**.*.. ... |
correct output |
---|
4 |
user output |
---|
(empty) |
Test 4
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 10 5 ****...... *.*.**..** ....*.*..* ...*.***.. ... |
correct output |
---|
16 |
user output |
---|
(empty) |
Test 5
Group: 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 10 2 **.***..*. ...*.*.... .***.*...* ***.***..* ... |
correct output |
---|
30 |
user output |
---|
(empty) |
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
500 500 1 ................................. |
correct output |
---|
9552040 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 500)
Test 7
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 500 5 ................................. |
correct output |
---|
1536063 |
user output |
---|
(empty) |
Test 8
Group: 2
Verdict: RUNTIME ERROR
input |
---|
500 500 25000 **...*...**..*.*..*.**.*..*.*.... |
correct output |
---|
288 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 24999) >= this->size() (which is 500)
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
500 500 12500 **.**.*..*...*.**...*.***........ |
correct output |
---|
786 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 12499) >= this->size() (which is 500)
Test 10
Group: 2
Verdict: RUNTIME ERROR
input |
---|
500 500 5000 .*.*.**..*.*.**.**..*..**...*.... |
correct output |
---|
1763 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 4999) >= this->size() (which is 500)
Test 11
Group: 3
Verdict: RUNTIME ERROR
input |
---|
2000 2000 1 ................................. |
correct output |
---|
489611392 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 2000)
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 2000 5 ................................. |
correct output |
---|
120725884 |
user output |
---|
(empty) |
Test 13
Group: 3
Verdict: RUNTIME ERROR
input |
---|
2000 2000 400000 ..*..**.**.**.*.***...**.*..**... |
correct output |
---|
1849 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 399999) >= this->size() (which is 2000)
Test 14
Group: 3
Verdict: RUNTIME ERROR
input |
---|
2000 2000 200000 ***.*....*.*..*....**..*..*.*.... |
correct output |
---|
2665 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 199999) >= this->size() (which is 2000)
Test 15
Group: 3
Verdict: RUNTIME ERROR
input |
---|
2000 2000 80000 **.**...*.***.**....**.*....*.... |
correct output |
---|
5587 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 79999) >= this->size() (which is 2000)