Task: | Järjestys |
Sender: | ankka22 |
Submission time: | 2016-10-14 15:02:53 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | 1 | details |
#2 | WRONG ANSWER | 0.06 s | 2 | details |
#3 | WRONG ANSWER | 0.08 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:14:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (c < 5*v.size()) { ^ input/code.cpp:22:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i < v.size()) { ^ input/code.cpp:38:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < s.size(); i++) { ^
Code
#include <iostream> #include <algorithm> int main() { int n; std::vector<int> v; std::vector<int> s; std::cin >> n; for (int i = 0; i < n; i++) { int t; std::cin >> t; v.push_back(t); } int c = 0; while (c < 5*v.size()) { if (v.at(0) != 1) { s.push_back(v.at(0)); std::swap(v[0],v[v.at(0) - 1]); } else { bool ready = true; int i = 1; while (i < v.size()) { if (v.at(i) != i + 1) { s.push_back(i + 1); std::swap(v[0], v[i]); ready = false; break; } i++; } if (ready) { break; } } c++; } std::cout << c << std::endl; for (int i = 0; i < s.size(); i++) { std::cout << s.at(i) << " "; } std::cout << std::endl; return 0; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
10 9 3 4 7 6 5 10 2 8 1 |
correct output |
---|
32 10 10 9 10 9 8 7 9 4 2 1 4 5 2... |
user output |
---|
10 9 8 2 3 4 7 10 5 6 5 |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 650 716 982 41 133 1000 876 92... |
correct output |
---|
3984 207 207 206 207 128 127 126 12... |
user output |
---|
1000 650 328 760 478 737 281 696 98... |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 94703 47808 62366 31885 7091 8... |
correct output |
---|
399956 98676 98676 98675 98676 62994 ... |
user output |
---|
100008 94703 71577 78918 31721 46072 ... |