aboutsummaryrefslogtreecommitdiff
path: root/17/day4/tuning.cpp
diff options
context:
space:
mode:
Diffstat (limited to '17/day4/tuning.cpp')
-rw-r--r--17/day4/tuning.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/17/day4/tuning.cpp b/17/day4/tuning.cpp
new file mode 100644
index 0000000..d2bddd9
--- /dev/null
+++ b/17/day4/tuning.cpp
@@ -0,0 +1,22 @@
+#include <bits/stdc++.h>
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
+
+ int N;
+ cin >> N;
+ int ans = 1, cnt = 1;
+ for (int i = 2; i < N; ++i) {
+ if (cnt) {
+ cout << ans << ' ' << i << endl;
+ string s; cin >> s;
+ s[0] == 'S' ? ++cnt : --cnt;
+ }
+ else {
+ ans = i;
+ ++cnt;
+ }
+ }
+ cout << (cnt ? ans : N) << endl;
+} \ No newline at end of file