Submission #546521

#TimeUsernameProblemLanguageResultExecution timeMemory
546521srivatsav_kannanCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <numeric>
#include <stack>
#include <cstring>
#include <bitset>
#include <climits>
#include <valarray>
#include <list>
#include "combo.h"
//#define int long long
#define INF 1000000000
#define endl '\n'
#define mod 1000000007
using namespace std;
string ar[4] = {"A", "B", "X", "Y"};
string guess_sequence(signed n){
    string ans;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < 4; j++) {
            int temp = ans;
            ans += ar[j];
            if (press(temp) == ans.size()) {
                ans += ar[j];
                break;
            }
        }
    }
    return ans;
}
//signed main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);
//
//}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   27 |             int temp = ans;
      |                        ^~~
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
combo.cpp:29:23: error: could not convert 'temp' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   29 |             if (press(temp) == ans.size()) {
      |                       ^~~~
      |                       |
      |                       int