제출 #438042

#제출 시각아이디문제언어결과실행 시간메모리
438042Bom164콤보 (IOI18_combo)C++14
컴파일 에러
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"; int ss = s.size(); if(s=="A"){ while(ss!=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"; ss=s.size(); } }else if(s=="B"){ while(ss!=cc){ int c = press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if(c==ss) s+="Y"; else if(c==ss+1) s+="A"; else s+="X"; ss=s.size(); } }else if(s=="X"){ while(ss!=cc){ int c = press(s+"B"+s+"AB"+s+"AA"+s+"AY"); if(c==ss) s+="Y"; else if(c==ss+1) s+="B"; else s+="A"; ss=s.size(); } }else if(s=="Y"){ while(ss!=cc){ int c = press(s+"B"+s+"XB"+s+"XX"+s+"XA"); if(c==ss) s+="A"; else if(c==ss+1) s+="B"; else s+="X"; ss=s.size(); } } return s; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             if(c==s.length()) s+="Y";
      |                ~^~~~~~~~~~~~
combo.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             else if(c==s.length()+1) s+="B";
      |                     ~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccGnBGtl.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/ccdYOL4j.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status