Submission #1007234

#TimeUsernameProblemLanguageResultExecution timeMemory
1007234christinelynnCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <string> #include "combo.h" #include <bits/stdc++.h> using namespace std; int press(string p) { } string guess_sequence(int N) { string ans; int val=press("AB"), find; if(val>0) { int cek=press("A"); if(cek==0) { ans+="B"; find=1; } else { ans+="A"; find=0; } } else { int cek=press("X"); if(cek==0) { ans+="Y"; find=3; } else { ans+="X"; find=2; } } if(find==0) { for(int i=2; i<N; i++) { string que=ans; que=que+ans+"YY"; que=que+ans+"YX"; que=que+ans+"YB"; que=que+ans+"X"; val=press(que); if(val==i)ans+="X"; else if(val==i-1)ans+="B"; else ans+="Y"; } string que; que=ans+"B"; if(val==N)return que; que=ans+"X"; if(val==N)return que; else return ans+"Y"; } else if(find==1) { for(int i=2; i<N; i++) { string que=ans; que=que+ans+"YY"; que=que+ans+"YX"; que=que+ans+"YA"; que=que+ans+"X"; val=press(que); if(val==i)ans+="X"; else if(val==i-1)ans+="A"; else ans+="Y"; } string que; que=ans+"A"; if(val==N)return que; que=ans+"X"; if(val==N)return que; else return ans+"Y"; } else if(find==2) { for(int i=2; i<N; i++) { string que=ans; que=que+ans+"YY"; que=que+ans+"YB"; que=que+ans+"YA"; que=que+ans+"B"; val=press(que); if(val==i)ans+="B"; else if(val==i-1)ans+="A"; else ans+="Y"; } string que; que=ans+"A"; if(val==N)return que; que=ans+"B"; if(val==N)return que; else return ans+"Y"; } else if(find==3) { for(int i=2; i<N; i++) { string que=ans; que=que+ans+"XX"; que=que+ans+"XB"; que=que+ans+"XA"; que=que+ans+"B"; val=press(que); if(val==i)ans+="B"; else if(val==i-1)ans+="A"; else ans+="X"; } string que; que=ans+"A"; if(val==N)return que; que=ans+"B"; if(val==N)return que; else return ans+"X"; } }

Compilation message (stderr)

combo.cpp: In function 'int press(std::string)':
combo.cpp:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
    8 | }
      | ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:10: warning: control reaches end of non-void function [-Wreturn-type]
   11 |   string ans;
      |          ^~~
/usr/bin/ld: /tmp/ccBWPc6N.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc1cOOCM.o:combo.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status