Submission #1084695

#TimeUsernameProblemLanguageResultExecution timeMemory
1084695erdemfurkanCombo (IOI18_combo)C++14
100 / 100
21 ms1268 KiB
#include "combo.h" using namespace std; string s; string guess_sequence(int N) { int a = 0; int b = 0; int x = 0; int y = 0; if(press("AB")) { if(press("A")) a = 1; else b = 1; } else { if(press("X")) x = 1; else y = 1; } if(a) { s += 'A'; if(N == 1) return s; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'B'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'B'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'X'; // 4N-8 string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'X'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(s.length() == N) return s; if(press(s+'B')==N) return s+'B'; else if(press(s+'X')==N) return s+'X'; else return s+'Y'; } if(b) { s += 'B'; if(N == 1) return s; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'X'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'X'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'A'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'X'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(s.length() == N) return s; if(press(s+'A')==N) return s+'A'; else if(press(s+'X')==N) return s+'X'; else return s+'Y'; } if(x) { s += 'X'; if(N == 1) return s; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'B'; string tmp2 = s; tmp2 += 'Y'; tmp2 += 'B'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'Y'; tmp2 += s; tmp2 += 'Y'; tmp2 += 'A'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'Y'; } } if(s.length() == N) return s; if(press(s+'A')==N) return s+'A'; else if(press(s+'B')==N) return s+'B'; else return s+'Y'; } if (y) { s += 'Y'; if(N == 1) return s; // a b y // a'yı yalnız bırak tek stringde p+b ve p+y+b p+y+p p+y+a'yı dene while(s.length() != N-1) { string tmp = s; tmp += 'B'; string tmp2 = s; tmp2 += 'X'; tmp2 += 'B'; tmp2 += s; tmp2 += 'X'; tmp2 += 'X'; tmp2 += s; tmp2 += 'X'; tmp2 += 'A'; string son = tmp + tmp2; int sonuc = press(son); if(sonuc == s.length()) { // son harf a'dır s += 'A'; } if(sonuc == s.length()+1) { // son harf b'dir s += 'B'; } if(sonuc == s.length()+2) { // son harf y'dir s += 'X'; } } if(s.length() == N) return s; if(press(s+'A')==N) return s+'A'; else if(press(s+'B')==N) return s+'B'; else return s+'X'; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:40:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:44:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:48:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:53:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |     if(s.length() == N) return s;
      |        ~~~~~~~~~~~^~~~
combo.cpp:63:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   63 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:77:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:81:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:85:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:90:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   90 |     if(s.length() == N) return s;
      |        ~~~~~~~~~~~^~~~
combo.cpp:100:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  100 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:114:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  114 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:118:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  118 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:122:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  122 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:127:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  127 |     if(s.length() == N) return s;
      |        ~~~~~~~~~~~^~~~
combo.cpp:137:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  137 |     while(s.length() != N-1) {
      |           ~~~~~~~~~~~^~~~~~
combo.cpp:152:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  152 |       if(sonuc == s.length()) {
      |          ~~~~~~^~~~~~~~~~~~~
combo.cpp:156:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  156 |       if(sonuc == s.length()+1) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:160:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  160 |       if(sonuc == s.length()+2) {
      |          ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:165:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  165 |     if(s.length() == N) return s;
      |        ~~~~~~~~~~~^~~~
combo.cpp:170:1: warning: control reaches end of non-void function [-Wreturn-type]
  170 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...