### Sweet's blog

By Sweet, 2 months ago,

Editorial for read this blog.

Thank you for participating! This is my first time creating contest, and Phuocbua's second time so I'm sorry if the contest is unbalanced!

Author: Phuocbua

Hint 1
Hint 2
Hint 3
Solution
Code

Author: Sweet

Hint 1
Hint 2
Solution
Code

Author: Sweet

Hint 1
Hint 2
Solution
Code

Author: Sweet

Solution
Code

Author: Phuocbua

Hint 1
Hint 2
Hint 3
Solution
Code

Author: Sweet

Hint
Solution
Code

#### G- Right Triangles

Author: Sweet

Hint
Solution
Code
• +20

 » 7 weeks ago, # |   +9 Nice problemset!
 » 7 weeks ago, # | ← Rev. 2 →   +4 My 4n+2 solution to problem A Set $s$ to $\underbrace{\texttt{AAA}\cdots\texttt{A}}_{2n}$. For each $i$ from $1$ to $2n$: Set $t_{\texttt{A}}=s$, change $t_{\texttt{A}}(i)\gets\texttt{A}$, ask $^{\dagger}$ the string $t_{\texttt{A}}$ and get the similarity point $S_{\texttt{A}}$. Set $t_{\texttt{C}}=s$, change $t_{\texttt{C}}(i)\gets\texttt{C}$, ask $^{\dagger}$ the string $t_{\texttt{C}}$ and get the similarity point $S_{\texttt{C}}$. Set $t_{\texttt{G}}=s$, change $t_{\texttt{G}}(i)\gets\texttt{G}$, ask $^{\dagger}$ the string $t_{\texttt{G}}$ and get the similarity point $S_{\texttt{G}}$. If $\max\{S_{\texttt{A}},S_{\texttt{C}},S_{\texttt{G}}\}\ne\min\{S_{\texttt{A}},S_{\texttt{C}},S_{\texttt{G}}\}$, change $s(i)$ to the character $c$ which maximizes $S_c$. Otherwise, change $s(i)$ to $\texttt{T}$. (We also know $S_{\texttt{T}}=S_{\texttt{A/C/G}}+1$) $\dagger$ Only ask if we don't know the similarity point.This solution only need $4n+2$ queries, because: If $i=1$, it asks at most $3$ times. If $2\le i\le 2n$, it asks at most $2$ times, as $S_{\texttt{A}}$ is always known. If $i=2n$, it may need an additional query to answer if $s(2n)=\texttt{T}$. Codemap score; int ask(string s, bool chk = true) { if(chk && score.count(s)) return score[s]; cout << s << endl; string k; cin >> k; if(k == "Correct!") exit(0); return score[s] = stoi(k); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; n <<= 1; string ans(n, 'A'); rep(i, 0, n - 1) { string tmp = "ACGT"; ans[i] = tmp[0]; int sA = ask(ans); ans[i] = tmp[1]; int sC = ask(ans); if(sA != sC) { if(sA > sC) ans[i] = tmp[0]; else ans[i] = tmp[1]; } else { ans[i] = tmp[2]; int sG = ask(ans); if(sA != sG) ans[i] = tmp[2]; else ans[i] = tmp[3], score[ans] = sA + 1; } } ask(ans, false); return 0; }