Submission #438034

#TimeUsernameProblemLanguageResultExecution timeMemory
438034Bom164Combo (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){ 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.size()<n){ int c = press(s+"B"+s+"XB"+s+"XX"+s+"XY"); if(c==s.size()) s+="Y"; else if(c==s.size()+1) s+="B"; else s+="X"; } }else if(s=="B"){ while(s.size()<n){ int c = press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if(c==s.size()) s+="Y"; else if(c==s.size()+1) s+="A"; else s+="X"; } }else if(s=="X"){ while(s.size()<n){ int c = press(s+"B"+s+"AB"+s+"AA"+s+"AY"); if(c==s.size()) s+="Y"; else if(c==s.size()+1) s+="B"; else s+="A"; } }else if(s=="Y"){ while(s.size()<n){ int c = press(s+"B"+s+"XB"+s+"XX"+s+"XA"); if(c==s.size()) s+="A"; else if(c==s.size()+1) s+="B"; else s+="X"; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         while(s.size()<n){
      |               ~~~~~~~~^~
combo.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             if(c==s.size()) s+="Y";
      |                ~^~~~~~~~~~
combo.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             else if(c==s.size()+1) s+="B";
      |                     ~^~~~~~~~~~~~
combo.cpp:39:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |         while(s.size()<n){
      |               ~~~~~~~~^~
combo.cpp:41:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             if(c==s.size()) s+="Y";
      |                ~^~~~~~~~~~
combo.cpp:42:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             else if(c==s.size()+1) s+="A";
      |                     ~^~~~~~~~~~~~
combo.cpp:46:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |         while(s.size()<n){
      |               ~~~~~~~~^~
combo.cpp:48:17: 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(c==s.size()) s+="Y";
      |                ~^~~~~~~~~~
combo.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             else if(c==s.size()+1) s+="B";
      |                     ~^~~~~~~~~~~~
combo.cpp:53:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |         while(s.size()<n){
      |               ~~~~~~~~^~
combo.cpp:55:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             if(c==s.size()) s+="A";
      |                ~^~~~~~~~~~
combo.cpp:56:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             else if(c==s.size()+1) s+="B";
      |                     ~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccPkehgM.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/ccHMK1TP.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status