Skip to content

Commit c1635ec

Browse files
authored
Create Problem B[Power Arrangers].cpp
1 parent d67a061 commit c1635ec

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int i, j, tt, n, f, F;
6+
char p;
7+
cin >> tt >> F;
8+
while(tt--) {
9+
map<string, int> cnt;
10+
map<string, int> pos;
11+
cnt.clear();
12+
pos.clear();
13+
14+
f = F;
15+
//1 to 595 abcde,badce,
16+
//ask first three chars of 119 nos //357
17+
vector<string> my(119, "");
18+
for(i=0; i<119; i++){
19+
my[i] = "";
20+
int x = (i*5)+1;
21+
cout << x << "\n" << flush;
22+
cin >> p;
23+
my[i] += p;
24+
25+
cout << x+1 << "\n" << flush;
26+
cin >> p;
27+
my[i] += p;
28+
29+
cout << x+2 << "\n" << flush;
30+
cin >> p;
31+
my[i] += p;
32+
33+
cnt[my[i]]++;
34+
pos[my[i]] = i;
35+
}
36+
int cx = 0;
37+
for(i=0; i<119; i++) if(cnt[my[i]] == 1) cx = i;
38+
39+
int ign = 0;
40+
if(cx == ign) ign = 1;
41+
42+
string ans = my[cx];
43+
i = cx;
44+
int x = (i*5)+4;
45+
cout << x << "\n" << flush;
46+
cin >> p;
47+
my[i] += p;
48+
49+
set<char> xx = {'A', 'B', 'C', 'D', 'E'};
50+
for(char cc: my[cx]) xx.erase(cc);
51+
char fin = *xx.begin();
52+
ans = ans + fin + p;
53+
cout << ans << "\n" << flush;
54+
cin >> p;
55+
if(p != 'Y') exit(0);
56+
57+
}
58+
return 0;
59+
}

0 commit comments

Comments
 (0)