Task: | Fence |
Sender: | aalto2024g_006 |
Submission time: | 2024-10-09 16:32:37 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | RUNTIME ERROR | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | RUNTIME ERROR | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | RUNTIME ERROR | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | RUNTIME ERROR | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | RUNTIME ERROR | 0.00 s | details |
#34 | RUNTIME ERROR | 0.00 s | details |
#35 | RUNTIME ERROR | 0.00 s | details |
#36 | RUNTIME ERROR | 0.00 s | details |
#37 | RUNTIME ERROR | 0.00 s | details |
#38 | RUNTIME ERROR | 0.00 s | details |
#39 | RUNTIME ERROR | 0.00 s | details |
#40 | RUNTIME ERROR | 0.00 s | details |
#41 | RUNTIME ERROR | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | RUNTIME ERROR | 0.00 s | details |
#44 | RUNTIME ERROR | 0.00 s | details |
#45 | RUNTIME ERROR | 0.00 s | details |
#46 | RUNTIME ERROR | 0.00 s | details |
#47 | RUNTIME ERROR | 0.00 s | details |
#48 | RUNTIME ERROR | 0.00 s | details |
#49 | RUNTIME ERROR | 0.00 s | details |
#50 | RUNTIME ERROR | 0.00 s | details |
#51 | RUNTIME ERROR | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | RUNTIME ERROR | 0.00 s | details |
#54 | RUNTIME ERROR | 0.00 s | details |
#55 | RUNTIME ERROR | 0.00 s | details |
#56 | RUNTIME ERROR | 0.00 s | details |
#57 | RUNTIME ERROR | 0.00 s | details |
#58 | RUNTIME ERROR | 0.00 s | details |
#59 | RUNTIME ERROR | 0.00 s | details |
#60 | RUNTIME ERROR | 0.00 s | details |
#61 | RUNTIME ERROR | 0.00 s | details |
#62 | RUNTIME ERROR | 0.00 s | details |
#63 | WRONG ANSWER | 0.10 s | details |
#64 | WRONG ANSWER | 0.07 s | details |
#65 | WRONG ANSWER | 0.06 s | details |
#66 | WRONG ANSWER | 0.07 s | details |
#67 | WRONG ANSWER | 0.10 s | details |
#68 | WRONG ANSWER | 0.05 s | details |
#69 | WRONG ANSWER | 0.10 s | details |
#70 | WRONG ANSWER | 0.04 s | details |
#71 | WRONG ANSWER | 0.09 s | details |
#72 | WRONG ANSWER | 0.03 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:60:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 60 | for(int i=0; i< suport.size(); i++){ | ~^~~~~~~~~~~~~~~
Code
#include <iostream> #include <vector> #include <stack> using namespace std; int main(){ int n,q; cin >> n>>q; vector<int> obre(n); for(int i=0; i<n; i++){ int temp; cin >> temp; obre[temp-1] = i; } vector<int> querry(q); for(int i=0; i<q; i++){ int ttemp; cin >> ttemp; querry[i] = ttemp-1; } vector<int> solucions(n, -1); for(int i=0; i<q; i++){ if(solucions[querry[i]]!=-1){ cout << solucions[querry[i]]; if(i!=q-1)cout << " "; continue; } vector<bool> open(n,false); int key = querry[i]; int count = 0; stack<int> podem; podem.push(key); vector<pair<int,int>> suport; bool a = true; while(!podem.empty()){ int act = podem.top(); podem.pop(); open[act] = true; count +=1; if(!open[obre[act]]){ podem.push(obre[act]); suport.push_back(make_pair(obre[act], -count)); } else{ a = false; } } solucions[key] = count; if(a==false){ for(int i=0; i< suport.size(); i++){ solucions[suport[i].first] = count; } } cout << count; if(i!=q-1)cout << " "; } cout << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1 8 3 5 |
correct output |
---|
Yes |
user output |
---|
0 0 0 0 0 0 0 0 |
Test 2
Verdict: WRONG ANSWER
input |
---|
1 9 3 4 |
correct output |
---|
No |
user output |
---|
0 0 0 0 0 0 0 0 0 |
Test 3
Verdict: WRONG ANSWER
input |
---|
2 3 2 1 2 1 |
correct output |
---|
Yes |
user output |
---|
2 2 2 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2 3 2 1 1 2 |
correct output |
---|
Yes |
user output |
---|
2 2 2 |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 5 3 2 2 3 2 3 |
correct output |
---|
Yes |
user output |
---|
2 3 3 3 3 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 8 3 5 3 5 2 6 |
correct output |
---|
Yes |
user output |
---|
0 2 0 0 0 0 0 0 |
Test 7
Verdict: WRONG ANSWER
input |
---|
3 4 3 1 1 3 2 2 |
correct output |
---|
Yes |
user output |
---|
2 3 3 3 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 2 1 1 1 1 1 1 1 1 |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 9
Verdict: RUNTIME ERROR
input |
---|
4 8 1 7 2 6 7 1 2 6 |
correct output |
---|
Yes |
user output |
---|
(empty) |
Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0)...
Test 10
Verdict: WRONG ANSWER
input |
---|
4 2 1 1 1 1 1 1 1 1 |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 11
Verdict: WRONG ANSWER
input |
---|
4 2 1 1 1 1 1 1 1 1 |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 12
Verdict: WRONG ANSWER
input |
---|
4 8 5 2 6 2 2 6 4 3 |
correct output |
---|
No |
user output |
---|
3 0 3 2 2 2 2 2 |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 6 4 2 5 1 4 2 5 1 5 3 |
correct output |
---|
Yes |
user output |
---|
1 4 4 4 4 4 |
Test 14
Verdict: WRONG ANSWER
input |
---|
5 5 3 2 4 1 1 4 1 4 2 3 |
correct output |
---|
Yes |
user output |
---|
4 4 4 1 4 |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 5 1 4 3 4 2 2 2 2 2 1 |
correct output |
---|
No |
user output |
---|
3 3 3 3 3 |
Test 16
Verdict: WRONG ANSWER
input |
---|
5 6 4 5 2 1 3 3 5 3 5 1 |
correct output |
---|
Yes |
user output |
---|
3 3 3 3 2 2 |
Test 17
Verdict: RUNTIME ERROR
input |
---|
5 10 5 5 2 8 9 1 8 2 7 3 |
correct output |
---|
Yes |
user output |
---|
(empty) |
Error:
malloc(): corrupted top size
Test 18
Verdict: WRONG ANSWER
input |
---|
5 3 2 2 1 1 2 2 1 1 2 1 |
correct output |
---|
Yes |
user output |
---|
4 4 4 |
Test 19
Verdict: RUNTIME ERROR
input |
---|
5 10 3 7 2 8 8 2 1 9 1 9 |
correct output |
---|
Yes |
user output |
---|
(empty) |
Error:
malloc(): corrupted top size
Test 20
Verdict: WRONG ANSWER
input |
---|
5 2 1 1 1 1 1 1 1 1 1 1 |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 21
Verdict: RUNTIME ERROR
input |
---|
5 9 8 2 7 4 5 7 2 4 1 5 |
correct output |
---|
Yes |
user output |
---|
(empty) |
Error:
code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0)...
Test 22
Verdict: WRONG ANSWER
input |
---|
5 2 1 1 1 1 1 1 1 1 1 1 |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 6 4 2 5 1 4 2 5 1 5 3 4 2 4 2 2 ... |
correct output |
---|
Yes |
user output |
---|
5 4 5 4 4 5 |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 5 3 2 4 1 1 4 1 4 2 3 4 1 1 4 1 ... |
correct output |
---|
Yes |
user output |
---|
4 4 4 4 4 |
Test 25
Verdict: WRONG ANSWER
input |
---|
10 5 1 4 3 4 2 2 2 2 2 1 1 3 3 1 2 ... |
correct output |
---|
No |
user output |
---|
2 1 1 2 4 |
Test 26
Verdict: WRONG ANSWER
input |
---|
10 6 4 5 2 1 3 3 5 3 5 1 1 1 2 2 1 ... |
correct output |
---|
No |
user output |
---|
2 2 5 5 5 5 |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 10 5 5 2 8 9 1 8 2 7 3 6 4 7 3 6 ... |
correct output |
---|
Yes |
user output |
---|
2 3 5 4 4 3 5 5 5 5 |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 3 2 2 1 1 2 2 1 1 2 1 2 1 2 1 1 ... |
correct output |
---|
Yes |
user output |
---|
4 4 4 |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 10 3 7 2 8 8 2 1 9 1 9 4 6 1 9 9 ... |
correct output |
---|
Yes |
user output |
---|
4 4 4 4 4 4 4 4 4 4 |
Test 30
Verdict: WRONG ANSWER
input |
---|
10 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 31
Verdict: WRONG ANSWER
input |
---|
10 9 8 2 7 4 5 7 2 4 1 5 4 7 4 4 5 ... |
correct output |
---|
Yes |
user output |
---|
4 4 4 4 4 4 4 4 4 |
Test 32
Verdict: WRONG ANSWER
input |
---|
10 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
Yes |
user output |
---|
2 2 |
Test 33
Verdict: RUNTIME ERROR
input |
---|
100 54882 39253 15632 47086 7798 23252 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 34
Verdict: RUNTIME ERROR
input |
---|
100 41703 30040 11663 38890 2813 5 41698... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 35
Verdict: RUNTIME ERROR
input |
---|
100 43601 1131 40616 23966 41322 18981 2... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 36
Verdict: RUNTIME ERROR
input |
---|
100 55081 39006 46265 16024 6683 28137 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 37
Verdict: RUNTIME ERROR
input |
---|
100 96704 52920 43784 16701 80003 94062 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 38
Verdict: RUNTIME ERROR
input |
---|
100 22201 19331 18456 4590 8076 20394 21... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 39
Verdict: RUNTIME ERROR
input |
---|
100 89287 29642 59645 18698 70589 73325 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 40
Verdict: RUNTIME ERROR
input |
---|
100 7632 5952 2435 3346 7465 5521 3477 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 41
Verdict: RUNTIME ERROR
input |
---|
100 87344 84597 20914 75919 32974 46368 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 42
Verdict: WRONG ANSWER
input |
---|
100 1039 521 518 6 1030 146 890 911 126... |
correct output |
---|
No |
user output |
---|
0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 ... Truncated |
Test 43
Verdict: RUNTIME ERROR
input |
---|
200 54882 39253 15632 47086 7798 23252 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 44
Verdict: RUNTIME ERROR
input |
---|
200 41703 30040 11663 38890 2813 5 41698... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 45
Verdict: RUNTIME ERROR
input |
---|
200 43601 1131 40616 23966 41322 18981 2... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 46
Verdict: RUNTIME ERROR
input |
---|
200 55081 39006 46265 16024 6683 28137 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 47
Verdict: RUNTIME ERROR
input |
---|
200 96704 52920 43784 16701 80003 94062 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 48
Verdict: RUNTIME ERROR
input |
---|
200 22201 19331 18456 4590 8076 20394 21... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 49
Verdict: RUNTIME ERROR
input |
---|
200 89287 29642 59645 18698 70589 73325 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 50
Verdict: RUNTIME ERROR
input |
---|
200 7632 5952 2435 3346 7465 5521 3477 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 51
Verdict: RUNTIME ERROR
input |
---|
200 87344 84597 20914 75919 32974 46368 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 52
Verdict: WRONG ANSWER
input |
---|
200 1039 521 518 6 1030 146 890 911 126... |
correct output |
---|
No |
user output |
---|
0 0 0 0 0 2 0 0 0 0 2 0 0 3 0 ... Truncated |
Test 53
Verdict: RUNTIME ERROR
input |
---|
1000 54882 39253 15632 47086 7798 23252 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 54
Verdict: RUNTIME ERROR
input |
---|
1000 41703 30040 11663 38890 2813 5 41698... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 55
Verdict: RUNTIME ERROR
input |
---|
1000 43601 1131 40616 23966 41322 18981 2... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 56
Verdict: RUNTIME ERROR
input |
---|
1000 55081 39006 46265 16024 6683 28137 3... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 57
Verdict: RUNTIME ERROR
input |
---|
1000 96704 52920 43784 16701 80003 94062 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 58
Verdict: RUNTIME ERROR
input |
---|
1000 22201 19331 18456 4590 8076 20394 21... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 59
Verdict: RUNTIME ERROR
input |
---|
1000 89287 29642 59645 18698 70589 73325 ... |
correct output |
---|
Yes |
user output |
---|
(empty) |
Test 60
Verdict: RUNTIME ERROR
input |
---|
1000 7632 5952 2435 3346 7465 5521 3477 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 61
Verdict: RUNTIME ERROR
input |
---|
1000 87344 84597 20914 75919 32974 46368 ... |
correct output |
---|
No |
user output |
---|
(empty) |
Test 62
Verdict: RUNTIME ERROR
input |
---|
1000 1039 521 518 6 1030 146 890 911 126... |
correct output |
---|
No |
user output |
---|
(empty) |
Error:
malloc(): corrupted top size
Test 63
Verdict: WRONG ANSWER
input |
---|
100000 54882 39253 15632 47086 7798 23252 3... |
correct output |
---|
No |
user output |
---|
3 4 3 3 3 3 3 3 3 3 2 3 2 3 3 ... Truncated |
Test 64
Verdict: WRONG ANSWER
input |
---|
100000 41703 30040 11663 38890 2813 5 41698... |
correct output |
---|
Yes |
user output |
---|
4 4 5 6 4 4 4 4 4 4 4 4 4 4 5 ... Truncated |
Test 65
Verdict: WRONG ANSWER
input |
---|
100000 43601 1131 40616 23966 41322 18981 2... |
correct output |
---|
No |
user output |
---|
4 4 4 5 3 4 4 4 4 5 4 3 4 6 4 ... Truncated |
Test 66
Verdict: WRONG ANSWER
input |
---|
100000 55081 39006 46265 16024 6683 28137 3... |
correct output |
---|
No |
user output |
---|
5 6 7 5 6 5 5 4 5 8 5 6 6 5 5 ... Truncated |
Test 67
Verdict: WRONG ANSWER
input |
---|
100000 96704 52920 43784 16701 80003 94062 ... |
correct output |
---|
Yes |
user output |
---|
4 4 6 7 4 4 5 5 4 4 6 7 7 6 7 ... Truncated |
Test 68
Verdict: WRONG ANSWER
input |
---|
100000 22201 19331 18456 4590 8076 20394 21... |
correct output |
---|
No |
user output |
---|
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ... Truncated |
Test 69
Verdict: WRONG ANSWER
input |
---|
100000 89287 29642 59645 18698 70589 73325 ... |
correct output |
---|
Yes |
user output |
---|
7 8 12 9 7 7 8 7 7 7 6 6 6 6 6... Truncated |
Test 70
Verdict: WRONG ANSWER
input |
---|
100000 7632 5952 2435 3346 7465 5521 3477 ... |
correct output |
---|
No |
user output |
---|
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ... Truncated |
Test 71
Verdict: WRONG ANSWER
input |
---|
100000 87344 84597 20914 75919 32974 46368 ... |
correct output |
---|
No |
user output |
---|
5 8 4 4 4 5 4 6 4 7 4 6 5 6 5 ... Truncated |
Test 72
Verdict: WRONG ANSWER
input |
---|
100000 1039 521 518 6 1030 146 890 911 126... |
correct output |
---|
No |
user output |
---|
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ... Truncated |