Submission #1288915

#TimeUsernameProblemLanguageResultExecution timeMemory
1288915jxngyr콤보 (IOI18_combo)C++20
10 / 100
22 ms484 KiB
#include <bits/stdc++.h> using namespace std; // Bu funksiya test muhitida mavjud bo‘ladi. // Siz uni chaqirasiz, ammo uni o‘zingiz yozmaysiz. int press(string p); // Siz yozadigan asosiy funksiya. string guess_sequence(int N) { string ans = ""; // Tugmalar to‘plami vector<char> buttons = {'A', 'B', 'X', 'Y'}; // 1-qarakterni topish // Har bir tugmani sinab ko‘ramiz for (char c : buttons) { string t(1, c); if (press(t) > 0) { ans += c; break; } } // Qolgan belgilarni topish for (int i = 1; i < N; i++) { bool found = false; for (char c : buttons) { // Yangi nomzod string test = ans + c; // press() qaytargan qiymat i+1 bo‘lsa, // bu degani to‘liq mos keladi if (press(test) == i + 1) { ans += c; found = true; break; } } if (!found) { // Xatolikni oldini olish uchun // (teoretik holatda bo‘lmasligi kerak) ans += 'A'; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...