답안 #417882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417882 2021-06-04T12:54:10 Z LouayFarah 콤보 (IOI18_combo) C++14
97 / 100
44 ms 712 KB
#include "bits/stdc++.h"
#include "combo.h"
using namespace std;
 
#define pb push_back
 
int press(string p);
 
string guess_sequence(int n)
{
    string res = "";
    string temp = "ABXY";
    for(int i = 0; i<3; i++)
    {
        string tr = "";
        tr.pb(temp[i]);
        if(press(tr)==1)
        {
            res.pb(temp[i]);
            break;
        }
    }
    if(res.length()==0)
        res.pb('Y');
 
    string used = "";
    for(int i = 0; i<4; i++)
    {
        if(res[0]==temp[i])
            continue;
        used.pb(temp[i]);
    }
 
    for(int i = 2; i<n; i++)
    {
        string s = "";
        s = s + res + used[0];
        s = s + res + used[1] + used[0];
        s = s + res + used[1] + used[1];
        s = s + res + used[1] + used[2];
 
        int k = press(s);
        if(k==(int)res.length())
            res.pb(used[2]);
        if(k==(int)res.length() + 1)
            res.pb(used[0]);
        if(k==(int)res.length()+2)
            res.pb(used[1]);
    }
 
    if((int)res.length()!=n)
    {
        string t = res + used[0];
        if(press(t)==n)
        {
            res = res + used[0];
            return res;
        }
        t = res + used[1];
        if(press(t)==n)
        {
            res = res + used[1];
            return res;
        }
 
        res = res + used[2];
        return res;
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 248 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 0 ms 200 KB Output is correct
12 Correct 0 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 0 ms 200 KB Output is correct
15 Correct 1 ms 200 KB Output is correct
16 Correct 1 ms 200 KB Output is correct
17 Correct 1 ms 200 KB Output is correct
18 Correct 1 ms 200 KB Output is correct
19 Correct 1 ms 200 KB Output is correct
20 Correct 1 ms 200 KB Output is correct
21 Correct 1 ms 200 KB Output is correct
22 Correct 1 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 0 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 1 ms 200 KB Output is correct
27 Correct 0 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 0 ms 200 KB Output is correct
30 Correct 1 ms 200 KB Output is correct
31 Correct 0 ms 200 KB Output is correct
32 Correct 1 ms 200 KB Output is correct
33 Correct 1 ms 200 KB Output is correct
34 Correct 1 ms 200 KB Output is correct
35 Correct 2 ms 200 KB Output is correct
36 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 1 ms 260 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 0 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Partially correct 1 ms 200 KB Output is partially correct
13 Partially correct 1 ms 200 KB Output is partially correct
14 Correct 1 ms 200 KB Output is correct
15 Partially correct 1 ms 200 KB Output is partially correct
16 Partially correct 1 ms 200 KB Output is partially correct
17 Correct 44 ms 376 KB Output is correct
18 Correct 26 ms 496 KB Output is correct
19 Correct 33 ms 592 KB Output is correct
20 Partially correct 25 ms 508 KB Output is partially correct
21 Partially correct 38 ms 388 KB Output is partially correct
22 Correct 1 ms 200 KB Output is correct
23 Partially correct 1 ms 200 KB Output is partially correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 2 ms 292 KB Output is correct
27 Correct 2 ms 200 KB Output is correct
28 Correct 2 ms 200 KB Output is correct
29 Partially correct 2 ms 328 KB Output is partially correct
30 Correct 3 ms 328 KB Output is correct
31 Partially correct 3 ms 328 KB Output is partially correct
32 Partially correct 28 ms 548 KB Output is partially correct
33 Correct 28 ms 504 KB Output is correct
34 Correct 20 ms 404 KB Output is correct
35 Partially correct 40 ms 472 KB Output is partially correct
36 Partially correct 37 ms 632 KB Output is partially correct
37 Correct 32 ms 480 KB Output is correct
38 Partially correct 22 ms 384 KB Output is partially correct
39 Correct 26 ms 476 KB Output is correct
40 Correct 34 ms 548 KB Output is correct
41 Partially correct 32 ms 636 KB Output is partially correct
42 Correct 34 ms 376 KB Output is correct
43 Correct 32 ms 512 KB Output is correct
44 Correct 34 ms 712 KB Output is correct
45 Correct 29 ms 468 KB Output is correct
46 Correct 24 ms 384 KB Output is correct
47 Correct 24 ms 500 KB Output is correct
48 Partially correct 29 ms 580 KB Output is partially correct
49 Partially correct 31 ms 384 KB Output is partially correct
50 Correct 30 ms 476 KB Output is correct
51 Correct 31 ms 524 KB Output is correct
52 Partially correct 31 ms 476 KB Output is partially correct
53 Partially correct 30 ms 428 KB Output is partially correct
54 Correct 32 ms 488 KB Output is correct
55 Correct 29 ms 408 KB Output is correct
56 Correct 30 ms 564 KB Output is correct
57 Correct 31 ms 536 KB Output is correct
58 Correct 30 ms 380 KB Output is correct
59 Correct 31 ms 552 KB Output is correct
60 Partially correct 30 ms 424 KB Output is partially correct
61 Partially correct 19 ms 380 KB Output is partially correct
62 Correct 31 ms 484 KB Output is correct
63 Correct 30 ms 464 KB Output is correct
64 Partially correct 29 ms 540 KB Output is partially correct
65 Partially correct 35 ms 416 KB Output is partially correct
66 Correct 19 ms 432 KB Output is correct
67 Correct 23 ms 388 KB Output is correct
68 Partially correct 30 ms 480 KB Output is partially correct
69 Correct 30 ms 488 KB Output is correct
70 Correct 32 ms 480 KB Output is correct
71 Correct 22 ms 480 KB Output is correct
72 Correct 31 ms 376 KB Output is correct
73 Partially correct 20 ms 376 KB Output is partially correct
74 Correct 31 ms 504 KB Output is correct
75 Correct 34 ms 472 KB Output is correct
76 Partially correct 32 ms 444 KB Output is partially correct
77 Correct 30 ms 576 KB Output is correct
78 Correct 1 ms 200 KB Output is correct
79 Partially correct 1 ms 200 KB Output is partially correct
80 Correct 1 ms 200 KB Output is correct
81 Partially correct 1 ms 200 KB Output is partially correct
82 Partially correct 1 ms 200 KB Output is partially correct
83 Correct 1 ms 200 KB Output is correct
84 Correct 1 ms 200 KB Output is correct
85 Partially correct 1 ms 200 KB Output is partially correct
86 Correct 1 ms 292 KB Output is correct
87 Partially correct 1 ms 200 KB Output is partially correct
88 Correct 0 ms 200 KB Output is correct
89 Correct 1 ms 200 KB Output is correct
90 Correct 1 ms 200 KB Output is correct
91 Correct 1 ms 200 KB Output is correct
92 Correct 1 ms 200 KB Output is correct
93 Correct 1 ms 200 KB Output is correct
94 Partially correct 1 ms 200 KB Output is partially correct
95 Partially correct 1 ms 200 KB Output is partially correct
96 Correct 1 ms 200 KB Output is correct
97 Correct 1 ms 200 KB Output is correct
98 Partially correct 1 ms 200 KB Output is partially correct
99 Partially correct 1 ms 200 KB Output is partially correct
100 Correct 1 ms 200 KB Output is correct
101 Correct 1 ms 200 KB Output is correct
102 Correct 1 ms 292 KB Output is correct
103 Correct 1 ms 200 KB Output is correct
104 Correct 1 ms 200 KB Output is correct
105 Correct 1 ms 200 KB Output is correct
106 Partially correct 1 ms 200 KB Output is partially correct
107 Partially correct 1 ms 200 KB Output is partially correct
108 Correct 1 ms 200 KB Output is correct
109 Correct 1 ms 200 KB Output is correct
110 Partially correct 1 ms 200 KB Output is partially correct
111 Partially correct 1 ms 200 KB Output is partially correct
112 Correct 1 ms 200 KB Output is correct
113 Correct 1 ms 200 KB Output is correct
114 Partially correct 1 ms 200 KB Output is partially correct
115 Partially correct 1 ms 200 KB Output is partially correct
116 Correct 1 ms 200 KB Output is correct
117 Correct 1 ms 200 KB Output is correct
118 Correct 1 ms 292 KB Output is correct
119 Partially correct 1 ms 200 KB Output is partially correct
120 Correct 1 ms 200 KB Output is correct
121 Correct 1 ms 292 KB Output is correct
122 Partially correct 1 ms 288 KB Output is partially correct
123 Partially correct 1 ms 288 KB Output is partially correct