CSES - Datatähti 2018 loppu - Results
Submission details
Task:Pinopeli
Sender:ollpu
Submission time:2018-01-18 12:45:43 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.04 s1details
#20.04 s1details
#30.05 s1details
#40.04 s1details
#50.05 s1details
#60.04 s1details
#70.05 s1details
#80.04 s1details
#90.04 s1details
#100.04 s1details
#110.05 s1details
#120.05 s1details
#130.05 s1details
#140.04 s1details
#150.04 s1details
#160.04 s1details
#170.04 s1details
#180.03 s1details
#190.05 s1details
#200.05 s1details
#210.04 s1details
#220.04 s1details
#230.05 s1details
#240.05 s1details
#250.04 s1details
#260.04 s1details
#270.04 s1details
#280.04 s1details
#290.05 s1details
#300.04 s1details
#310.04 s1details
#320.05 s1details
#330.04 s1details
#340.05 s1details
#350.04 s1details
#360.03 s1details
#370.05 s2details
#380.05 s2details
#390.04 s2details
#400.05 s2details
#410.05 s2details
#420.06 s2details
#430.05 s2details
#440.05 s2details
#450.04 s2details
#460.03 s2details
#470.04 s3details
#480.06 s3details
#490.04 s3details
#500.05 s3details
#510.04 s3details
#520.04 s3details
#530.04 s3details
#540.04 s3details
#550.06 s3details
#560.04 s3details
#570.05 s3details
#580.04 s3details
#590.05 s3details
#600.04 s3details
#610.03 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:19:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < s.size(); ++i) {
                       ^
input/code.cpp:33:12: warning: 'mni' may be used uninitialized in this function [-Wmaybe-uninitialized]
   while (o != mni) {
            ^

Code

#include <iostream>
#include <vector>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> r;
  int o = 0;
  char mnc = 'a';
  int mni;
  for (int i = 0; i < n; ++i) {
    if (s[i] < mnc) mnc = s[i], mni = i;
  }
  while (true) {
    bool f = 0;
    for (int i = 0; i < s.size(); ++i) {
      if ((n-i+o+1)%n == mni) continue;
      if (s[(n-i+o)%n] > s[(n-i+o+1)%n]) {
        f = 1;
        o += n-i;
        o %= n;
        for (int j = 0; j < i; ++j) r.push_back(0);
      }
    }
    if (f) {
      r.push_back(1);
      swap(s[o], s[(o+1)%n]);
    } else break;
  }
  while (o != mni) {
    r.push_back(0);
    o += n-1;
    o %= n;
  }
  cout << r.size() << endl;
  for (int rr : r) {
    if (rr) cout << "SWAP\n";
    else cout << "MOVE\n";
  }
}

Test details

Test 1

Group: 1

Verdict:

input
1 1
1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 2

Group: 1

Verdict:

input
2 1
1 1

correct output
NO

user output
0

Test 3

Group: 1

Verdict:

input
1 1
2

correct output
NO

user output
0

Test 4

Group: 1

Verdict:

input
3 1
1 1 1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 5

Group: 1

Verdict:

input
2 1
2 1

correct output
YES
TAKE 2 1
KEEP 1
END

user output
0

Test 6

Group: 1

Verdict:

input
1 1
3

correct output
YES
TAKE 3 1
KEEP 1
END

user output
0

Test 7

Group: 1

Verdict:

input
4 1
1 1 1 1

correct output
NO

user output
0

Test 8

Group: 1

Verdict:

input
3 1
2 1 1

correct output
NO

user output
0

Test 9

Group: 1

Verdict:

input
2 1
2 2

correct output
NO

user output
0

Test 10

Group: 1

Verdict:

input
2 1
3 1

correct output
NO

user output
0

Test 11

Group: 1

Verdict:

input
1 1
4

correct output
NO

user output
0

Test 12

Group: 1

Verdict:

input
5 1
1 1 1 1 1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 13

Group: 1

Verdict:

input
4 1
2 1 1 1

correct output
YES
TAKE 2 1
KEEP 1
END

user output
0

Test 14

Group: 1

Verdict:

input
3 1
2 2 1

correct output
YES
TAKE 2 1
KEEP 1
END

user output
0

Test 15

Group: 1

Verdict:

input
2 1
2 3

correct output
YES
TAKE 3 1
KEEP 1
END

user output
0

Test 16

Group: 1

Verdict:

input
3 1
3 1 1

correct output
YES
TAKE 3 1
KEEP 1
END

user output
0

Test 17

Group: 1

Verdict:

input
2 1
4 1

correct output
YES
TAKE 4 1
KEEP 1
END

user output
0

Test 18

Group: 1

Verdict:

input
1 1
5

correct output
YES
TAKE 5 1
KEEP 1
END

user output
0

Test 19

Group: 1

Verdict:

input
1 2
1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 20

Group: 1

Verdict:

input
2 2
1 1

correct output
NO

user output
0

Test 21

Group: 1

Verdict:

input
1 2
2

correct output
YES
TAKE 2 2
KEEP 2
END

user output
0

Test 22

Group: 1

Verdict:

input
3 2
1 1 1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 23

Group: 1

Verdict:

input
2 2
2 1

correct output
YES
TAKE 2 2
KEEP 1
ADD 0 1
END

user output
0

Test 24

Group: 1

Verdict:

input
1 2
3

correct output
YES
TAKE 3 3
KEEP 1
ADD 0 1
ADD 0 1
...

user output
0

Test 25

Group: 1

Verdict:

input
4 2
1 1 1 1

correct output
NO

user output
0

Test 26

Group: 1

Verdict:

input
3 2
2 1 1

correct output
YES
TAKE 2 2
KEEP 2
END

user output
0

Test 27

Group: 1

Verdict:

input
2 2
2 2

correct output
NO

user output
0

Test 28

Group: 1

Verdict:

input
2 2
3 1

correct output
YES
TAKE 3 3
KEEP 2
ADD 0 1
END

user output
0

Test 29

Group: 1

Verdict:

input
1 2
4

correct output
YES
TAKE 4 4
KEEP 2
ADD 0 1
ADD 0 1
...

user output
0

Test 30

Group: 1

Verdict:

input
5 2
1 1 1 1 1

correct output
YES
TAKE 1 1
KEEP 1
END

user output
0

Test 31

Group: 1

Verdict:

input
4 2
2 1 1 1

correct output
YES
TAKE 2 2
KEEP 1
ADD 0 1
END

user output
0

Test 32

Group: 1

Verdict:

input
3 2
2 2 1

correct output
YES
TAKE 2 2
KEEP 1
ADD 1 1
END

user output
0

Test 33

Group: 1

Verdict:

input
2 2
2 3

correct output
YES
TAKE 3 3
KEEP 1
ADD 0 2
END

user output
0

Test 34

Group: 1

Verdict:

input
3 2
3 1 1

correct output
YES
TAKE 3 3
KEEP 1
ADD 0 1
ADD 0 1
...

user output
0

Test 35

Group: 1

Verdict:

input
2 2
4 1

correct output
YES
TAKE 4 4
KEEP 1
ADD 0 1
ADD 0 1
...

user output
0

Test 36

Group: 1

Verdict:

input
1 2
5

correct output
YES
TAKE 5 5
KEEP 1
ADD 0 2
ADD 0 2
...

user output
0

Test 37

Group: 2

Verdict:

input
6 1
5 2 3 1 6 3

correct output
NO

user output
0

Test 38

Group: 2

Verdict:

input
5 1
1 2 3 4 5

correct output
YES
TAKE 5 1
KEEP 1
END

user output
0

Test 39

Group: 2

Verdict:

input
7 1
2 2 2 2 2 2 5

correct output
YES
TAKE 5 1
KEEP 1
END

user output
0

Test 40

Group: 2

Verdict:

input
20 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
NO

user output
1
MOVE

Test 41

Group: 2

Verdict:

input
4 1
7 7 2 2

correct output
NO

user output
0

Test 42

Group: 2

Verdict:

input
6 2
5 2 3 1 6 3

correct output
YES
TAKE 6 6
KEEP 2
ADD 3 2
ADD 2 1
...

user output
0

Test 43

Group: 2

Verdict:

input
5 3
1 2 3 4 5

correct output
YES
TAKE 5 5
KEEP 1
ADD 3 1
ADD 1 1
...

user output
0

Test 44

Group: 2

Verdict:

input
7 5
2 2 2 2 2 2 5

correct output
YES
TAKE 5 5
KEEP 1
ADD 0 2
ADD 0 2
...

user output
0

Test 45

Group: 2

Verdict:

input
20 5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
NO

user output
1
MOVE

Test 46

Group: 2

Verdict:

input
4 4
7 7 2 2

correct output
NO

user output
0

Test 47

Group: 3

Verdict:

input
500 1
489 402 131 79 196 338 319 1 2...

correct output
YES
TAKE 500 1
KEEP 1
END

user output
2
MOVE
MOVE

Test 48

Group: 3

Verdict:

input
500 1
222 9 263 104 241 286 306 4 35...

correct output
YES
TAKE 498 1
KEEP 1
END

user output
2
MOVE
MOVE

Test 49

Group: 3

Verdict:

input
500 1
102 275 66 352 310 448 152 19 ...

correct output
NO

user output
2
MOVE
MOVE

Test 50

Group: 3

Verdict:

input
500 1
62 458 377 166 75 238 345 76 1...

correct output
YES
TAKE 500 1
KEEP 1
END

user output
2
MOVE
MOVE

Test 51

Group: 3

Verdict:

input
500 1
206 409 99 306 53 351 188 463 ...

correct output
YES
TAKE 498 1
KEEP 1
END

user output
2
MOVE
MOVE

Test 52

Group: 3

Verdict:

input
500 468
280 36 405 277 160 440 276 63 ...

correct output
YES
TAKE 498 498
KEEP 2
ADD 494 2
ADD 492 2
...

user output
2
MOVE
MOVE

Test 53

Group: 3

Verdict:

input
500 298
32 22 455 427 85 483 397 391 2...

correct output
YES
TAKE 500 500
KEEP 2
ADD 496 4
ADD 493 1
...

user output
2
MOVE
MOVE

Test 54

Group: 3

Verdict:

input
500 294
162 263 109 294 201 81 66 278 ...

correct output
YES
TAKE 500 500
KEEP 2
ADD 499 1
ADD 495 2
...

user output
2
MOVE
MOVE

Test 55

Group: 3

Verdict:

input
500 102
15 57 414 4 390 362 236 250 98...

correct output
YES
TAKE 499 499
KEEP 2
ADD 492 3
ADD 491 1
...

user output
2
MOVE
MOVE

Test 56

Group: 3

Verdict:

input
500 336
170 375 337 6 248 262 286 304 ...

correct output
YES
TAKE 498 498
KEEP 2
ADD 494 2
ADD 490 4
...

user output
2
MOVE
MOVE

Test 57

Group: 3

Verdict:

input
500 209
5 390 188 108 124 385 390 380 ...

correct output
NO

user output
2
MOVE
MOVE

Test 58

Group: 3

Verdict:

input
500 217
102 116 309 329 245 174 94 358...

correct output
NO

user output
2
MOVE
MOVE

Test 59

Group: 3

Verdict:

input
500 218
366 422 444 234 247 152 122 44...

correct output
NO

user output
2
MOVE
MOVE

Test 60

Group: 3

Verdict:

input
500 207
275 384 115 426 47 451 426 272...

correct output
NO

user output
2
MOVE
MOVE

Test 61

Group: 3

Verdict:

input
500 400
33 243 65 284 436 139 334 284 ...

correct output
NO

user output
2
MOVE
MOVE