Task: | Järjestys |
Sender: | 3isagreatnumber |
Submission time: | 2016-10-05 15:46:55 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | 1 | details |
#2 | WRONG ANSWER | 0.05 s | 2 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'void print(std::vector<int>*)': input/code.cpp:67:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < (*list_p).size(); i++) ^
Code
#include <iostream> #include <vector> using namespace std; // prototypes void swap(vector<int> *list_p, int n); void print(vector<int> *list_p); int main(void) { // variables int n; int m; vector<int> list; // populate list cin >> n; for (int i = 0; i < n; i++) { cin >> m; list.push_back(m); } // locate 1 and move to to correct position //print(&list); for (int i = 0; i < n; i++) { if (list[i] == 1) swap(&list, i); } //print(&list); for (int i = n; i > 1; i--) { for (int j = 0; j < n; j++) { if (list[j] == i) { swap(&list, j-1); swap(&list, j); swap(&list, 1); continue; } } } cout << endl; //for (int i = 0; i < list.size(); i++) cout << list[i] << " "; //cout << endl; return 0; } void swap(vector<int> *list_p, int k) { cout << k+1 << " "; int c = k/2; for (int i = 0; i <= c; i++) { int tmp = (*list_p)[i]; (*list_p)[i] = (*list_p)[k-i]; (*list_p)[k-i] = tmp; } } void print(vector<int> *list_p) { for (int i = 0; i < (*list_p).size(); i++) { cout << (*list_p)[i] << " "; } cout << endl; }
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 3 4 2 9 10 2 3 4 2 7 8 2 7 ... |
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 |
---|
207 201 202 2 111 112 2 77 78 ... |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 94703 47808 62366 31885 7091 8... |
correct output |
---|
399956 98676 98676 98675 98676 62994 ... |
user output |
---|
(empty) |