CSES - HIIT Open 2017 - Results
Submission details
Task:Jonnesort
Sender:oispa opiskelupaikka tefyllä ;...;
Submission time:2017-05-27 11:29:13 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2ACCEPTED0.06 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.04 sdetails
#5ACCEPTED0.04 sdetails
#6ACCEPTED0.07 sdetails
#7ACCEPTED0.06 sdetails
#8ACCEPTED0.04 sdetails
#90.03 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.04 sdetails
#12ACCEPTED0.05 sdetails
#13ACCEPTED0.04 sdetails
#14ACCEPTED0.03 sdetails
#15ACCEPTED0.04 sdetails
#16ACCEPTED0.04 sdetails
#17ACCEPTED0.06 sdetails
#18ACCEPTED0.05 sdetails
#19ACCEPTED0.06 sdetails
#20ACCEPTED0.05 sdetails
#21ACCEPTED0.05 sdetails
#22ACCEPTED0.04 sdetails
#23ACCEPTED0.05 sdetails
#24ACCEPTED0.06 sdetails
#25ACCEPTED0.05 sdetails
#26ACCEPTED0.07 sdetails
#27ACCEPTED0.06 sdetails
#28ACCEPTED0.05 sdetails
#29ACCEPTED0.06 sdetails
#30ACCEPTED0.04 sdetails
#31ACCEPTED0.07 sdetails
#32ACCEPTED0.06 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

int main(){
    
    int n, k; cin >> n >> k;
    int a[1010], s[1010];
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        s[i] = a[i];
        
    }
    sort(s, s+n);
    
    int r = 1;
    while(true){
        for(int i = 0; i+k <= n; ++i){
            sort(a+i, a+i+k);
        }
        bool g = true;
        for(int i = 0; i < n; ++i){
            if(a[i] != s[i]){
                g = false;
                break;
            }
        }
        r++;
        if(g){
            break;
        }
    }
    cout << r << endl;
    return 0;
}

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: ACCEPTED

input
5 2
996284497 350656747 457308991 ...

correct output
4

user output
4

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:

input
2 2
154536640 992369170

correct output
1

user output
2

Test 10

Verdict: ACCEPTED

input
5 2
529605954 923422474 201326756 ...

correct output
3

user output
3

Test 11

Verdict: ACCEPTED

input
5 3
576266534 744033388 496724405 ...

correct output
3

user output
3

Test 12

Verdict: ACCEPTED

input
5 4
834071670 478505412 812083191 ...

correct output
2

user output
2

Test 13

Verdict: ACCEPTED

input
10 2
267520652 809884594 337238252 ...

correct output
6

user output
6

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: ACCEPTED

input
10 9
962346225 344164325 546383748 ...

correct output
2

user output
2

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: ACCEPTED

input
10 4
818177078 80429597 70171159 43...

correct output
3

user output
3

Test 23

Verdict: ACCEPTED

input
1000 2
892940198 569293722 587284851 ...

correct output
924

user output
924

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