제출 #1131269

#제출 시각아이디문제언어결과실행 시간메모리
1131269Wendidiask콤보 (IOI18_combo)C++20
100 / 100
12 ms524 KiB
/*
                                     :---:--:--::::::--:-:----:                                     
                               ::-:::.                         ::-:::                               
                       .*  -===..                                    :---                           
                     .-+*##=-------====-:                                :--:                       
                  :+##=.* -=            :=+-                                .-=:                    
               .+++-.  :-   -=.            .=+-                                .--.                 
             .++=-     +      -=              :*-                                 :-.               
            +*+-      :-        -=.             -*:                                 :=:             
           #*:        *           -=.             +-                                  .=            
        =:%+         -:             -=.            +-                                   --          
        -%:          *                -=.           *:                                    +.        
       :%-..        =.                  -=.          #                                     -:       
      :=#   ..      +                     -=.        ==                                     -=      
     ---+     .    =                        -=.      .#                                      .+     
    -: ==       .  =         :------::------:.-=.     %                                       .=    
   :-  ==        .=.     ---:.               :--#+.  .%                                        :-   
   =   .*        .+.. :=-                        :++ -+                                         =:  
  +     #.       +  -=:                            :*%-*:                                        *  
 :=     :#      :=:=   .                    :-----: =+-+                                         .+ 
 *       -*     *=-     . .-        :::::::.       :*  .#+.                                       + 
:-        -+   :#.        --::-----:              :*     ++=                                      .-
+          :*. *.    .:::::*%:                   ++       +.-=.                                    +
+           -#**----:       .=                 -*.         +  -=                                   =
*           +.#=+:           +  .           .=+:           =.   -=.                                =
=            -+  :++:         +   ..     .=+=              .=     -=.                              -
=            %-     :====-:.  =.  .:--===-                  *       -=.                            -
+           +--          .:--==#==-:.=                      +         -=.                          =
*           + *                =.    :                     .=           -=.                        =
+          =  *                 +                          =              -=.                      +
:-         =  .=                =:                         =                -=.                   .-
 *        +    =:                *                        *                   -=.                 + 
 :-      .+     =-               :-                     .+                      -=.              .+ 
  *      *       :=               *                    :=                         -=             *  
   =    :-         =:             .-                 .=:                            -=.         =:  
   -:   *           .=-            +               .=-                                -=       :-   
    =: -:              --:         :-           :--:                                    -=.   .=    
     =:+                  ----.     *       :---.                                         -= .+     
    --=*----------------------=*+=--=+--=+*+------------------------------------------------%+:.    
    :: :=                           +:-                                                    -- :.    
        .=.                                                                               =.        
          -=                                                                            -=          
           .=:                                                                        .=.           
             .=:                                                                    .+:             
               :--                                                                :-:               
                  --                                                            -=.                 
                    :--.                                                     --:                    
                       :--:                                              .--:                       
                          .-:-:                                      ::--.                          
                               :----.                          .:----                               
                                    .:::::::::-::::::--::::::::.                             
 */
 // Hello this is Tyx2019's clone
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << #x << " is " << x << "\n"
#define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repb(i, a, b) for (int i = b; i >= a; i--)
#define pii pair<int, int>
#define linebreak cout << "---------------------------------------------------------\n"
#define f first
#define s second
#define pb push_back
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// good luck
const int MS = 2e5+5, mod = 1e9+9, INF = INT_MAX, blk = 400;
string guess_sequence(int n) {
	string s, rem;
	if (press("AB") > 0) {
		if (press("A") > 0) s = "A";
		else s = "B";
	}
	else {
		if (press("X") > 0) s = "X";
		else s = "Y"; 
	}
	if (n == 1) return s;
	if (s == "A") {
		rem[0] = 'B'; rem[1] = 'X'; rem[2] = 'Y';
	}
	if (s == "B") {
		rem[0] = 'A'; rem[1] = 'X'; rem[2] = 'Y';
	}
	if (s == "X") {
		rem[0] = 'A'; rem[1] = 'B'; rem[2] = 'Y';
	}
	if (s == "Y") {
		rem[0] = 'A'; rem[1] = 'B'; rem[2] = 'X';
	}
	for (int i = 1; i <= n-2; i++) {
		string temp = s + rem[0] + rem[0] 
					+ s + rem[0] + rem[1] 
					+ s + rem[0] + rem[2] 
					+ s + rem[1];
		int res = press(temp);
		if (res == i) s = s + rem[2];
		else if (res == i+1) s = s + rem[1];
		else s = s + rem[0];
	}
	if (press(s+rem[0]) == n) s = s + rem[0];
	else if (press(s+rem[1]) == n) s = s + rem[1];
	else s = s + rem[2];
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...