Task: | Jonnesort |
Sender: | IOG |
Submission time: | 2017-05-27 12:24:43 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.07 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | WRONG ANSWER | 0.06 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.06 s | details |
#9 | ACCEPTED | 0.02 s | details |
#10 | WRONG ANSWER | 0.04 s | details |
#11 | ACCEPTED | 0.04 s | details |
#12 | WRONG ANSWER | 0.05 s | details |
#13 | WRONG ANSWER | 0.04 s | details |
#14 | ACCEPTED | 0.03 s | details |
#15 | ACCEPTED | 0.04 s | details |
#16 | WRONG ANSWER | 0.06 s | details |
#17 | ACCEPTED | 0.03 s | details |
#18 | ACCEPTED | 0.04 s | details |
#19 | ACCEPTED | 0.05 s | details |
#20 | ACCEPTED | 0.04 s | details |
#21 | ACCEPTED | 0.04 s | details |
#22 | WRONG ANSWER | 0.06 s | details |
#23 | WRONG ANSWER | 0.06 s | details |
#24 | ACCEPTED | 0.04 s | details |
#25 | ACCEPTED | 0.06 s | details |
#26 | ACCEPTED | 0.05 s | details |
#27 | ACCEPTED | 0.07 s | details |
#28 | ACCEPTED | 0.04 s | details |
#29 | ACCEPTED | 0.05 s | details |
#30 | ACCEPTED | 0.04 s | details |
#31 | ACCEPTED | 0.05 s | details |
#32 | ACCEPTED | 0.04 s | details |
Code
#include <bits/stdc++.h> using namespace std; int main(void) { cin.sync_with_stdio(0); cin.tie(0); int n = 0, k = 0; cin >> n >> k; vector<long> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } vector<long> arr2(arr); sort(arr2.begin(), arr2.end()); int maxdist = -1; for (unsigned int i = 0; i < arr.size(); ++i) { auto ptr = lower_bound(arr2.begin(), arr2.end(), arr[i]); //if (ptr) { int idx = ptr - arr2.begin(); //cout << "arr[i] " << arr[i] << "\n"; //cout << "idx " << idx << "\n"; int dist = abs(idx - (int)i); //cout << "dist " << dist << "\n"; if (dist > maxdist) maxdist = dist; //cout << "maxd " << maxdist << "\n\n"; } } // cout << "maxd " << maxdist << "\n"; float resf = (float) maxdist / (float) (k-1); int res = ceil(resf) + 1; cout << res << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 2 911338584 795590455 |
correct output |
---|
2 |
user output |
---|
2 |
Test 2
Verdict: ACCEPTED
input |
---|
5 2 793236043 906468936 436307784 ... |
correct output |
---|
5 |
user output |
---|
5 |
Test 3
Verdict: ACCEPTED
input |
---|
5 3 175391 301978480 278080154 556... |
correct output |
---|
2 |
user output |
---|
2 |
Test 4
Verdict: ACCEPTED
input |
---|
5 4 135097496 141787345 286485507 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 5
Verdict: ACCEPTED
input |
---|
2 2 807833454 357319853 |
correct output |
---|
2 |
user output |
---|
2 |
Test 6
Verdict: WRONG ANSWER
input |
---|
5 2 996284497 350656747 457308991 ... |
correct output |
---|
4 |
user output |
---|
5 |
Test 7
Verdict: ACCEPTED
input |
---|
5 3 425650400 627649597 507579568 ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 8
Verdict: ACCEPTED
input |
---|
5 4 220321392 396059465 984419076 ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 9
Verdict: ACCEPTED
input |
---|
2 2 154536640 992369170 |
correct output |
---|
1 |
user output |
---|
1 |
Test 10
Verdict: WRONG ANSWER
input |
---|
5 2 529605954 923422474 201326756 ... |
correct output |
---|
3 |
user output |
---|
4 |
Test 11
Verdict: ACCEPTED
input |
---|
5 3 576266534 744033388 496724405 ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 12
Verdict: WRONG ANSWER
input |
---|
5 4 834071670 478505412 812083191 ... |
correct output |
---|
2 |
user output |
---|
3 |
Test 13
Verdict: WRONG ANSWER
input |
---|
10 2 267520652 809884594 337238252 ... |
correct output |
---|
6 |
user output |
---|
9 |
Test 14
Verdict: ACCEPTED
input |
---|
10 10 691659885 769645778 522400483 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 15
Verdict: ACCEPTED
input |
---|
10 9 496062582 138374143 824827241 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 16
Verdict: WRONG ANSWER
input |
---|
10 9 962346225 344164325 546383748 ... |
correct output |
---|
2 |
user output |
---|
3 |
Test 17
Verdict: ACCEPTED
input |
---|
10 7 911172 834480158 332950221 217... |
correct output |
---|
3 |
user output |
---|
3 |
Test 18
Verdict: ACCEPTED
input |
---|
10 5 637278906 758810300 799221426 ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 19
Verdict: ACCEPTED
input |
---|
10 8 613663177 241419820 897995174 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 20
Verdict: ACCEPTED
input |
---|
10 9 301552142 105874609 117157673 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 21
Verdict: ACCEPTED
input |
---|
10 3 751769346 268818221 967321245 ... |
correct output |
---|
5 |
user output |
---|
5 |
Test 22
Verdict: WRONG ANSWER
input |
---|
10 4 818177078 80429597 70171159 43... |
correct output |
---|
3 |
user output |
---|
4 |
Test 23
Verdict: WRONG ANSWER
input |
---|
1000 2 892940198 569293722 587284851 ... |
correct output |
---|
924 |
user output |
---|
949 |
Test 24
Verdict: ACCEPTED
input |
---|
1000 1000 388348070 367903870 346031575 ... |
correct output |
---|
2 |
user output |
---|
2 |
Test 25
Verdict: ACCEPTED
input |
---|
1000 478 940740782 714381689 937823318 ... |
correct output |
---|
4 |
user output |
---|
4 |
Test 26
Verdict: ACCEPTED
input |
---|
1000 276 544213568 442831234 414847889 ... |
correct output |
---|
5 |
user output |
---|
5 |
Test 27
Verdict: ACCEPTED
input |
---|
1000 223 429632666 21178061 489096976 3... |
correct output |
---|
6 |
user output |
---|
6 |
Test 28
Verdict: ACCEPTED
input |
---|
1000 111 744098828 406171561 343811321 ... |
correct output |
---|
10 |
user output |
---|
10 |
Test 29
Verdict: ACCEPTED
input |
---|
1000 103 670737224 725487311 939213258 ... |
correct output |
---|
11 |
user output |
---|
11 |
Test 30
Verdict: ACCEPTED
input |
---|
1000 925 908985873 374431295 932008376 ... |
correct output |
---|
3 |
user output |
---|
3 |
Test 31
Verdict: ACCEPTED
input |
---|
1000 267 624861176 273000858 900365752 ... |
correct output |
---|
5 |
user output |
---|
5 |
Test 32
Verdict: ACCEPTED
input |
---|
1000 487 662518939 604995512 370723442 ... |
correct output |
---|
3 |
user output |
---|
3 |