Task: | Inversiot |
Sender: | Katajisto |
Submission time: | 2018-01-07 20:02:39 +0200 |
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 | ACCEPTED | 0.04 s | 1 | details |
#2 | WRONG ANSWER | 0.04 s | 1 | details |
#3 | WRONG ANSWER | 0.04 s | 1 | details |
#4 | WRONG ANSWER | 0.05 s | 1 | details |
#5 | WRONG ANSWER | 0.05 s | 1 | details |
#6 | ACCEPTED | 0.05 s | 2 | details |
#7 | WRONG ANSWER | 0.04 s | 2 | details |
#8 | WRONG ANSWER | 0.06 s | 2 | details |
#9 | WRONG ANSWER | 0.05 s | 2 | details |
#10 | WRONG ANSWER | 0.04 s | 2 | details |
#11 | ACCEPTED | 0.16 s | 3 | details |
#12 | WRONG ANSWER | 0.16 s | 3 | details |
#13 | WRONG ANSWER | 0.15 s | 3 | details |
#14 | WRONG ANSWER | 0.16 s | 3 | details |
#15 | WRONG ANSWER | 0.17 s | 3 | details |
Code
#include<bits/stdc++.h> using namespace std; int main() { long n, in; cin >> n >> in; if(in == 0) { for(long i = 1; i <= n; i++) { cout << i << " "; } return 0; } deque<long> s2; deque<long> s; for(int i = 1; i <= n; i++) { s.push_back(i); } long times = 0; long minus = n-1; while(true) { // cout << "IN " << in << " minus: " << minus << "\n"; if(in < minus) break; if(in == minus){in = 0; times++; break;} // cout << "IN: " << in << " minus: " << minus << "\n"; in = in - minus; times++; minus--; } for(long i = 0; i < times; i++) { long t; t = s.front(); s2.push_front(t); // cout << "POP" << "\n"; s.pop_front(); } long kiila = s.front(); s.pop_front(); // cout << "Kiila: " << kiila << "\n"; long counter = 0; cout << "IN == " << in << "\n"; if(in > 0) { for(long i = s.front(); i <= n; i++) { if(counter == in) { cout << kiila << " "; i--; in = 1e9; continue; } cout << i << " "; counter++; } } else { cout << n << " "; } while(!s2.empty()) { cout << s2.front() << " "; s2.pop_front(); } }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
5 0 |
correct output |
---|
1 2 3 4 5 |
user output |
---|
1 2 3 4 5 |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 1 |
correct output |
---|
2 1 3 4 5 |
user output |
---|
IN == 1 2 1 3 4 5 |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 2 |
correct output |
---|
3 1 2 4 5 |
user output |
---|
IN == 2 2 3 1 4 5 |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 4 |
correct output |
---|
5 1 2 3 4 |
user output |
---|
IN == 0 5 1 |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 10 |
correct output |
---|
5 4 3 2 1 |
user output |
---|
IN == 0 5 4 3 2 1 |
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
100 0 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 1 |
correct output |
---|
2 1 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
IN == 1 2 1 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 990 |
correct output |
---|
100 99 98 97 96 95 94 93 92 91... |
user output |
---|
IN == 45 12 13 14 15 16 17 18 19 20 21 ... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 1980 |
correct output |
---|
100 99 98 97 96 95 94 93 92 91... |
user output |
---|
IN == 33 24 25 26 27 28 29 30 31 32 33 ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 4950 |
correct output |
---|
100 99 98 97 96 95 94 93 92 91... |
user output |
---|
IN == 0 100 99 98 97 96 95 94 93 92 91... |
Test 11
Group: 3
Verdict: ACCEPTED
input |
---|
1000000 0 |
correct output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000000 1 |
correct output |
---|
2 1 3 4 5 6 7 8 9 10 11 12 13 ... |
user output |
---|
IN == 1 2 1 3 4 5 6 7 8 9 10 11 12 13 ... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000000 99999900000 |
correct output |
---|
1000000 999999 999998 999997 9... |
user output |
---|
IN == 676378 105574 105575 105576 105577 10... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000000 199999800000 |
correct output |
---|
1000000 999999 999998 999997 9... |
user output |
---|
IN == 168906 225405 225406 225407 225408 22... |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000000 499999500000 |
correct output |
---|
1000000 999999 999998 999997 9... |
user output |
---|
IN == 0 1000000 999999 999998 999997 9... |