Submission #438039

#TimeUsernameProblemLanguageResultExecution timeMemory
438039Bom164Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<iostream> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define mii map<int,int> #define pqb priority_queue<int> #define pqs priority_queue<int,vi,greater<int> > #define mod 1000000007 #define inf 1e18 #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--) #define w(x) int x; cin>>x; while(x--) string s=""; int press(string p){ int a;cin>>a; return a; } string guess_sequence(int n){ int cc=n; if(press("A")==1) s+="A"; else if(press("B")==1) s+="B"; else if(press("X")==1) s+="X"; else s+="Y"; if(s=="A"){ while(s.length()!=cc){ int c = press(s+"B"+s+"XB"+s+"XX"+s+"XY"); if(c==s.length()) s+="Y"; else if(c==s.length()+1) s+="B"; else s+="X"; } }else if(s=="B"){ while(s.length()!=cc){ int c = press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if(c==s.length()) s+="Y"; else if(c==s.length()+1) s+="A"; else s+="X"; } }else if(s=="X"){ while(s.length()!=cc){ int c = press(s+"B"+s+"AB"+s+"AA"+s+"AY"); if(c==s.length()) s+="Y"; else if(c==s.length()+1) s+="B"; else s+="A"; } }else if(s=="Y"){ while(s.length()!=cc){ int c = press(s+"B"+s+"XB"+s+"XX"+s+"XA"); if(c==s.length()) s+="A"; else if(c==s.length()+1) s+="B"; else s+="X"; } } return s; } /*int main(){ //freopen("4.txt","r",stdin); //freopen("output.txt","w",stdout); solve(); }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |         while(s.length()!=cc){
      |               ~~~~~~~~~~^~~~
combo.cpp:35:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(c==s.length()) s+="Y";
      |                ~^~~~~~~~~~~~
combo.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             else if(c==s.length()+1) s+="B";
      |                     ~^~~~~~~~~~~~~~
combo.cpp:40:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |         while(s.length()!=cc){
      |               ~~~~~~~~~~^~~~
combo.cpp:42:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             if(c==s.length()) s+="Y";
      |                ~^~~~~~~~~~~~
combo.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             else if(c==s.length()+1) s+="A";
      |                     ~^~~~~~~~~~~~~~
combo.cpp:47:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |         while(s.length()!=cc){
      |               ~~~~~~~~~~^~~~
combo.cpp:49:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             if(c==s.length()) s+="Y";
      |                ~^~~~~~~~~~~~
combo.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             else if(c==s.length()+1) s+="B";
      |                     ~^~~~~~~~~~~~~~
combo.cpp:54:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   54 |         while(s.length()!=cc){
      |               ~~~~~~~~~~^~~~
combo.cpp:56:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             if(c==s.length()) s+="A";
      |                ~^~~~~~~~~~~~
combo.cpp:57:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             else if(c==s.length()+1) s+="B";
      |                     ~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cchx8tGX.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/ccV2sLOU.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status