제출 #484802

#제출 시각아이디문제언어결과실행 시간메모리
484802MohamedFaresNebili콤보 (IOI18_combo)C++14
10 / 100
70 ms272 KiB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "combo.h"
 
        using namespace std;
 
        using ll  = long long;
        using vi  = vector<int>;
 
        #define pb push_back
        #define ff first
        #define ss second
        #define lb lower_bound
        #define all(x) (x).begin() , (x).end()
 
        string guess_sequence(int N) {
            string lett = "ABXY";
            string p = ""; int first;
            for(int l = 0; l < 4; l++) {
              	p = "";
                for (int i = 0; i < N; ++i) p += lett[l];
                if(press(p)) {
                    first = l;
                    break;
                }
            }
            for(int i = 1; i < N; i++) {
                for(int l = 0; l < 4; l++) {
                    if(l == first) continue;
                    p[i] = lett[l];
                    if(press(p) == i+1) break;
                }
            }
            return p;
        }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:21: warning: 'first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |                     if(l == first) continue;
      |                     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...