Submission #333727

# Submission time Handle Problem Language Result Execution time Memory
333727 2020-12-07T14:44:32 Z bigDuck Combo (IOI18_combo) C++14
5 / 100
1 ms 264 KB
#include<bits/stdc++.h>
using namespace std;
#include "combo.h"
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount



string a="A", b="B", c="X", d="Y";

string guess_1(){
char a='A', b='B', c='X', d='Y';

int l1=0, l2=0, l3=0;
string s0="a"; s0[0]=a;
l1=press(s0);
s0[0]=b;
l2=press(s0);
s0[0]=c;
l2=press(s0);

if(l1){
        s0[0]=a;
    return s0;
}
if(l2){
    s0[0]=b; return s0;
}
if(l3){
    s0[0]=c; return s0;
}
s0[0]=d;
return s0;
}


string guess_3(){
int l=press(a+b);
if(l>0){
    l=press(a);
    if(l){
        return a;
    }
    else{
        return b;
    }
}
else{
    l=press(c);
    if(l){
        return c;
    }
    else{
        return d;
    }
}

//return s0;
}


string guess_2(){


int l=press(a+b);

if(l){
l=press(a+b+a+c);
if(l==1){
    return a+d;
}
if(l==2){
    l=press(a+b);
    if(l==2){
        return a+b;
    }
    else{
        return a+c;
    }
}


 l=press(b+a+b+c);
if(l==1){
    return b+d;
}
if(l==2){
    l=press(b+a);
    if(l==2){
        return b+a;
    }
    else{
        return b+c;
    }
}

}
else{
 l=press(c+a+c+b);
if(l==1){
    return c+d;
}
if(l==2){
    l=press(c+a);
    if(l==2){
        return c+a;
    }
    else{
        return c+b;
    }
}

l=press(d+a+d+b);
if(l==1){
    return d+c;
}
if(l==2){
    l=press(d+a);
    if(l==2){
        return d+a;
    }
    else{
        return d+b;
    }
}

}


}



string guess_next(string p, string ft ){
if(ft==a){
    int l=(press(p+b+p+c+b+p+c+d+p+c+c))-((int)p.length());
    if(l==0){
        return p+d;
    }
    if(l==1){
        return p+b;
    }
    if(l==2){
        return p+c;
    }
}

if(ft==b){
    int l=(press(p+a+p+c+a+p+c+d+p+c+c))-((int)p.length());
    if(l==0){
        return p+d;
    }
    if(l==1){
        return p+a;
    }
    if(l==2){
        return p+c;
    }
}

if(ft==c){
        int l=(press(p+a+p+b+b+p+b+d+p+b+a))-((int)p.length());
    if(l==0){
        return p+d;
    }
    if(l==1){
        return p+a;
    }
    if(l==2){
        return p+b;
    }
}

if(ft==d){
    int l=(press(p+b+p+c+b+p+c+a+p+c+c))-((int)p.length());
    if(l==0){
        return p+a;
    }
    if(l==1){
        return p+b;
    }
    if(l==2){
        return p+c;
    }
}


}



string guess_lt(string p, string ft){

if(ft==a){
    int l=press(p+b+p+c)-((int)p.length());
    if(l==1){
        l=press(p+b)-((int)p.length());
        if(l==1){
            return p+b;
        }
        else{
            return p+c;
        }
    }
    else{
        return p+d;
    }

}
if(ft==b){
    int l=press(p+d+p+c)-((int)p.length());
    if(l==1){
        l=press(p+d)-((int)p.length());
        if(l==1){
            return p+d;
        }
        else{
            return p+c;
        }
    }
    else{
        return p+a;
    }

}
if(ft==c){

    int l=press(p+b+p+d)-((int)p.length());
    if(l==1){
        l=press(p+b)-((int)p.length());
        if(l==1){
            return p+b;
        }
        else{
            return p+d;
        }
    }
    else{
        return p+a;
    }


}
if(ft==d){
    int l=press(p+b+p+c)-((int)p.length());
    if(l==1){
        l=press(p+b)-((int)p.length());
        if(l==1){
            return p+b;
        }
        else{
            return p+c;
        }
    }
    else{
        return p+a;
    }

}


}




string guess_sequence(int N){
int n=N;
if(n==1){
return guess_1();
}
if(n==2){
    return guess_2();
}


string p=guess_3();

while(p.length()<(n-1) ){
        string ft="a";
    ft[0]=p[0];
    p=guess_next(p, ft);
}
string ft="a"; ft[0]=p[0];
p=guess_lt(p, ft);
return p;


}



Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:285:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  285 | while(p.length()<(n-1) ){
      |       ~~~~~~~~~~^~~~~~
combo.cpp: In function 'std::string guess_2()':
combo.cpp:136:1: warning: control reaches end of non-void function [-Wreturn-type]
  136 | }
      | ^
combo.cpp: In function 'std::string guess_next(std::string, std::string)':
combo.cpp:194:1: warning: control reaches end of non-void function [-Wreturn-type]
  194 | }
      | ^
combo.cpp: In function 'std::string guess_lt(std::string, std::string)':
combo.cpp:268:1: warning: control reaches end of non-void function [-Wreturn-type]
  268 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 0 ms 200 KB Output is correct
15 Correct 1 ms 200 KB Output is correct
16 Correct 1 ms 200 KB Output is correct
17 Correct 1 ms 200 KB Output is correct
18 Correct 0 ms 200 KB Output is correct
19 Correct 1 ms 200 KB Output is correct
20 Correct 1 ms 200 KB Output is correct
21 Correct 1 ms 200 KB Output is correct
22 Correct 1 ms 200 KB Output is correct
23 Correct 0 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 264 KB Output is correct
26 Correct 1 ms 200 KB Output is correct
27 Correct 1 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 0 ms 200 KB Output is correct
30 Correct 1 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 1 ms 200 KB Output is correct
33 Correct 0 ms 200 KB Output is correct
34 Correct 1 ms 200 KB Output is correct
35 Correct 1 ms 200 KB Output is correct
36 Correct 0 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 0 ms 200 KB Wrong Answer: wrong guess.
3 Halted 0 ms 0 KB -