Task: | Hacker Cups and Balls |
Sender: | ollpu |
Submission time: | 2017-03-09 16:34:55 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.04 s | details |
#2 | WRONG ANSWER | 0.04 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | ACCEPTED | 0.03 s | details |
#5 | ACCEPTED | 0.03 s | details |
#6 | WRONG ANSWER | 0.04 s | details |
#7 | WRONG ANSWER | 0.04 s | details |
#8 | WRONG ANSWER | 0.03 s | details |
#9 | WRONG ANSWER | 0.04 s | details |
#10 | WRONG ANSWER | 0.04 s | details |
#11 | WRONG ANSWER | 0.04 s | details |
#12 | WRONG ANSWER | 0.11 s | details |
#13 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#14 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#15 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#16 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#17 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#18 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#19 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#20 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#21 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#22 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#23 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#24 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#25 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
#26 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:18:13: warning: unused variable 'sc' [-Wunused-variable] int t[n], sc[n]; ^
Code
// lol #include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; #define F first #define S second int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int t[n], sc[n]; map<int, int> srange; for (int i = 0; i < n; ++i) { cin >> t[i]; srange[i] = 0; } int lop = 0; pair<int, int> op[m]; int opt[m]; for (int i = 0; i < m; ++i) { cin >> op[i].F >> op[i].S; op[i].F--, op[i].S--; if (op[i].F > op[i].S) { opt[i] = 1; swap(op[i].F, op[i].S); } else opt[i] = 0; if (op[i].F <= n/2 && op[i].S >= n/2) lop = i+1; } for (int i = 0; i < lop; ++i) { auto it = --srange.upper_bound(op[i].S); pair<int, int> asd = *it; if (asd.F <= op[i].F) { if (asd.S == opt[i]) continue; else { reverse(t+op[i].F, t+op[i].S+1); srange[op[i].S+1] = asd.S; srange[op[i].F] = opt[i]; } } else { srange.erase(srange.lower_bound(op[i].F), srange.upper_bound(op[i].S)); srange[op[i].F] = opt[i]; srange[op[i].S+1] = asd.S; // if (op[i].S-op[i].F <= 1000) { sort(t+op[i].F, t+op[i].S+1); // } else { // for (int j = 1; j <= n; ++j) sc[j] = 0; // for (int j = op[i].F; j <= op[i].S; ++j) { // sc[t[j]]++; // } // int j = op[i].F; // for (int k = 1; k <= n; ++k) if (sc[j]) t[j++] = k; // } if (opt[i]) reverse(t+op[i].F, t+op[i].S+1); } for (int i = 0; i < n; ++i) cout << t[i] << " "; cout << endl; } cout << t[n/2] << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
3 2 1 3 2 1 3 3 1 |
correct output |
---|
2 |
user output |
---|
1 2 3 3 2 1 2 |
Test 2
Verdict: WRONG ANSWER
input |
---|
5 2 5 1 4 2 3 1 4 5 2 |
correct output |
---|
4 |
user output |
---|
1 2 4 5 3 1 5 4 3 2 4 |
Test 3
Verdict: ACCEPTED
input |
---|
1 0 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 4
Verdict: ACCEPTED
input |
---|
1 1 1 1 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 5
Verdict: ACCEPTED
input |
---|
1 10 1 1 1 1 1 1 1 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 10 2 3 1 1 1 2 3 2 3 ... |
correct output |
---|
2 |
user output |
---|
2 1 3 2 3 1 2 3 1 2 1 3 1 2 3 ... |
Test 7
Verdict: WRONG ANSWER
input |
---|
5 10 3 2 4 5 1 5 3 2 1 2 1 ... |
correct output |
---|
4 |
user output |
---|
3 2 5 4 1 3 2 5 4 1 2 3 5 4 1 2 5 4 3 1 5 4 3 2 1 ... |
Test 8
Verdict: WRONG ANSWER
input |
---|
7 10 1 5 3 6 4 2 7 3 1 4 5 7 2 ... |
correct output |
---|
3 |
user output |
---|
5 3 1 6 4 2 7 5 3 1 4 6 2 7 5 7 6 4 3 2 1 5 1 2 3 4 6 7 5 6 4 3 2 1 7 ... |
Test 9
Verdict: WRONG ANSWER
input |
---|
9 10 5 3 9 8 2 4 1 7 6 3 6 2 2 3 1 ... |
correct output |
---|
2 |
user output |
---|
5 3 2 4 8 9 1 7 6 5 3 2 4 8 9 1 7 6 5 3 2 9 8 7 6 4 1 5 9 8 3 2 7 6 4 1 5 2 3 4 6 7 8 9 1 ... |
Test 10
Verdict: WRONG ANSWER
input |
---|
9 10 4 6 8 3 1 2 5 7 9 5 9 9 3 1 7 ... |
correct output |
---|
5 |
user output |
---|
4 6 8 3 1 2 5 7 9 4 6 9 8 7 5 3 2 1 3 4 5 6 7 8 9 2 1 3 4 5 6 7 8 1 2 9 3 4 6 5 7 8 1 2 9 ... |
Test 11
Verdict: WRONG ANSWER
input |
---|
99 100 33 54 86 85 32 70 47 59 98 81 ... |
correct output |
---|
50 |
user output |
---|
33 54 86 85 32 70 2 7 8 10 11 ... |
Test 12
Verdict: WRONG ANSWER
input |
---|
999 1000 403 659 941 361 902 420 562 40... |
correct output |
---|
461 |
user output |
---|
403 659 941 361 902 420 562 40... |
Test 13
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
9999 10000 8825 6550 9856 4921 5469 7019 ... |
correct output |
---|
3680 |
user output |
---|
(empty) |
Test 14
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
51415 50216 42355 19584 12430 4886 21835 1... |
correct output |
---|
42640 |
user output |
---|
(empty) |
Test 15
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 86561 69211 10709 40653 63761 ... |
correct output |
---|
49166 |
user output |
---|
(empty) |
Test 16
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 50393 94271 27420 69389 62906 ... |
correct output |
---|
37388 |
user output |
---|
(empty) |
Test 17
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 55963 34569 33638 11733 14583 ... |
correct output |
---|
66896 |
user output |
---|
(empty) |
Test 18
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 23085 10457 5546 1569 42452 10... |
correct output |
---|
71234 |
user output |
---|
(empty) |
Test 19
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 90828 34481 10990 74758 89452 ... |
correct output |
---|
85498 |
user output |
---|
(empty) |
Test 20
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 72770 96635 93330 99517 50465 ... |
correct output |
---|
1 |
user output |
---|
(empty) |
Test 21
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 50747 54311 37637 60185 52083 ... |
correct output |
---|
99999 |
user output |
---|
(empty) |
Test 22
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 74605 62077 35821 90758 88963 ... |
correct output |
---|
39458 |
user output |
---|
(empty) |
Test 23
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 41714 10593 31139 16591 60872 ... |
correct output |
---|
50002 |
user output |
---|
(empty) |
Test 24
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 99998 34921 96615 61384 91011 31201 ... |
correct output |
---|
20597 |
user output |
---|
(empty) |
Test 25
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 72111 4249 26146 40294 35803 2... |
correct output |
---|
50000 |
user output |
---|
(empty) |
Test 26
Verdict: OUTPUT LIMIT EXCEEDED
input |
---|
99999 100000 28991 50696 14403 60081 49795 ... |
correct output |
---|
50000 |
user output |
---|
(empty) |