Submission #760824

# Submission time Handle Problem Language Result Execution time Memory
760824 2023-06-18T15:30:58 Z asdfasdfasdfasdf Combo (IOI18_combo) C++14
94 / 100
23 ms 616 KB
#include "combo.h"
using namespace std;


string guess_sequence(int N) {
    int r = N + 2;
    string now, alp, bt = "ABXY";
    
    for (int i = 0; i < 3; i++) {
        string tmp = ""; tmp += bt[i], r--;
        if (press(tmp) == 1) { now += bt[i]; break; }
    }
    if (now.size() == 0) now += bt[3];

    for (int i = 0; i < 4; i++) if (now[0] != bt[i]) alp += bt[i];

    while (now.size() < N - 1) { // r 조건 추가 필요
        int sz = now.size();
        string tmp;
        tmp = tmp + now + alp[0] + alp[0];
        tmp = tmp + now + alp[1] + alp[0];
        tmp = tmp + now + alp[1] + alp[1];
        
        int ret = press(tmp); r--;

        if (ret == sz) now += alp[2];
        else if (ret == sz + 1) { // AB AX BX
            tmp = now + alp[0] + alp[1]; // AB press
            ret = press(tmp);
            if (ret == sz) now = now + alp[1] + alp[2]; // BX
            else if (ret == sz + 1) now = now + alp[0] + alp[2]; // AX
            else now = now + alp[0] + alp[1]; // AB
        }
        else { // AA BA BB
            tmp = now + alp[1] + alp[0]; // BA press
            ret = press(tmp);
            if (ret == sz) now = now + alp[0] + alp[0]; // AA
            else if (ret == sz + 1) now = now + alp[1] + alp[1]; // BB
            else now = now + alp[1] + alp[0]; // BA
        }

    }

    if (now.size() < N) {
        for (int i = 0; i < 3; i++) {
            if (press(now + alp[i]) == N) { now = now + alp[i]; break; } 
        }
        if (now.size() < N) now = now + alp[3];
    }
    return now;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while (now.size() < N - 1) { // r 조건 추가 필요
      |            ~~~~~~~~~~~^~~~~~~
combo.cpp:44:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if (now.size() < N) {
      |         ~~~~~~~~~~~^~~
combo.cpp:48:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |         if (now.size() < N) now = now + alp[3];
      |             ~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 0 ms 208 KB Output is correct
36 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Partially correct 0 ms 208 KB Output is partially correct
11 Correct 0 ms 208 KB Output is correct
12 Partially correct 0 ms 208 KB Output is partially correct
13 Partially correct 0 ms 208 KB Output is partially correct
14 Correct 0 ms 208 KB Output is correct
15 Partially correct 0 ms 208 KB Output is partially correct
16 Partially correct 0 ms 208 KB Output is partially correct
17 Correct 19 ms 596 KB Output is correct
18 Correct 20 ms 392 KB Output is correct
19 Correct 20 ms 388 KB Output is correct
20 Partially correct 9 ms 388 KB Output is partially correct
21 Partially correct 16 ms 396 KB Output is partially correct
22 Correct 0 ms 208 KB Output is correct
23 Partially correct 1 ms 208 KB Output is partially correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 2 ms 208 KB Output is correct
30 Partially correct 1 ms 208 KB Output is partially correct
31 Partially correct 2 ms 208 KB Output is partially correct
32 Partially correct 19 ms 388 KB Output is partially correct
33 Correct 16 ms 388 KB Output is correct
34 Correct 12 ms 392 KB Output is correct
35 Partially correct 16 ms 392 KB Output is partially correct
36 Correct 20 ms 388 KB Output is correct
37 Correct 18 ms 388 KB Output is correct
38 Partially correct 20 ms 396 KB Output is partially correct
39 Correct 18 ms 392 KB Output is correct
40 Correct 17 ms 516 KB Output is correct
41 Partially correct 11 ms 396 KB Output is partially correct
42 Correct 16 ms 392 KB Output is correct
43 Correct 14 ms 592 KB Output is correct
44 Correct 15 ms 392 KB Output is correct
45 Correct 19 ms 392 KB Output is correct
46 Correct 16 ms 396 KB Output is correct
47 Correct 18 ms 508 KB Output is correct
48 Partially correct 17 ms 392 KB Output is partially correct
49 Correct 14 ms 392 KB Output is correct
50 Correct 19 ms 376 KB Output is correct
51 Correct 13 ms 372 KB Output is correct
52 Partially correct 16 ms 376 KB Output is partially correct
53 Partially correct 19 ms 380 KB Output is partially correct
54 Correct 21 ms 408 KB Output is correct
55 Correct 15 ms 392 KB Output is correct
56 Correct 16 ms 392 KB Output is correct
57 Correct 16 ms 396 KB Output is correct
58 Correct 9 ms 396 KB Output is correct
59 Correct 14 ms 388 KB Output is correct
60 Partially correct 20 ms 392 KB Output is partially correct
61 Partially correct 17 ms 616 KB Output is partially correct
62 Correct 16 ms 360 KB Output is correct
63 Partially correct 20 ms 464 KB Output is partially correct
64 Partially correct 23 ms 364 KB Output is partially correct
65 Partially correct 17 ms 364 KB Output is partially correct
66 Correct 15 ms 396 KB Output is correct
67 Correct 17 ms 388 KB Output is correct
68 Correct 9 ms 480 KB Output is correct
69 Correct 15 ms 396 KB Output is correct
70 Correct 19 ms 388 KB Output is correct
71 Partially correct 19 ms 588 KB Output is partially correct
72 Correct 21 ms 396 KB Output is correct
73 Correct 21 ms 396 KB Output is correct
74 Correct 21 ms 392 KB Output is correct
75 Correct 15 ms 392 KB Output is correct
76 Correct 14 ms 396 KB Output is correct
77 Correct 21 ms 440 KB Output is correct
78 Correct 0 ms 208 KB Output is correct
79 Partially correct 0 ms 208 KB Output is partially correct
80 Correct 1 ms 208 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Partially correct 1 ms 208 KB Output is partially correct
83 Correct 1 ms 208 KB Output is correct
84 Correct 0 ms 208 KB Output is correct
85 Partially correct 1 ms 208 KB Output is partially correct
86 Correct 1 ms 208 KB Output is correct
87 Correct 1 ms 208 KB Output is correct
88 Correct 0 ms 208 KB Output is correct
89 Correct 0 ms 208 KB Output is correct
90 Correct 0 ms 208 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 1 ms 208 KB Output is correct
93 Correct 0 ms 208 KB Output is correct
94 Correct 1 ms 208 KB Output is correct
95 Partially correct 1 ms 208 KB Output is partially correct
96 Correct 1 ms 208 KB Output is correct
97 Partially correct 1 ms 248 KB Output is partially correct
98 Partially correct 1 ms 208 KB Output is partially correct
99 Partially correct 1 ms 208 KB Output is partially correct
100 Correct 1 ms 208 KB Output is correct
101 Correct 1 ms 208 KB Output is correct
102 Correct 0 ms 292 KB Output is correct
103 Correct 1 ms 208 KB Output is correct
104 Correct 1 ms 208 KB Output is correct
105 Correct 0 ms 208 KB Output is correct
106 Partially correct 0 ms 208 KB Output is partially correct
107 Correct 1 ms 208 KB Output is correct
108 Correct 0 ms 208 KB Output is correct
109 Partially correct 0 ms 208 KB Output is partially correct
110 Partially correct 0 ms 208 KB Output is partially correct
111 Partially correct 0 ms 208 KB Output is partially correct
112 Correct 0 ms 208 KB Output is correct
113 Correct 0 ms 208 KB Output is correct
114 Partially correct 0 ms 208 KB Output is partially correct
115 Partially correct 0 ms 208 KB Output is partially correct
116 Correct 0 ms 208 KB Output is correct
117 Partially correct 1 ms 208 KB Output is partially correct
118 Correct 1 ms 208 KB Output is correct
119 Partially correct 1 ms 208 KB Output is partially correct
120 Correct 1 ms 208 KB Output is correct
121 Correct 1 ms 208 KB Output is correct
122 Partially correct 0 ms 208 KB Output is partially correct
123 Partially correct 1 ms 208 KB Output is partially correct