제출 #139150

#제출 시각아이디문제언어결과실행 시간메모리
139150PedroBigMan콤보 (IOI18_combo)C++14
100 / 100
56 ms2076 KiB
#include "combo.h" #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> using namespace std; typedef int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} std::string guess_sequence(int N) { string p=""; char first; vector<char> c; ll d1 = press("AB"); ll d2; if(d1==0) { d2 = press("X"); if(d2==0) {first = 'Y';} else {first = 'X';} } else { d2 = press("A"); if(d2==0) {first = 'B';} else {first = 'A';} } p+=first; if(N==1) {return p;} if(first!='A') {c.pb('A');} if(first!='B') {c.pb('B');} if(first!='X') {c.pb('X');} if(first!='Y') {c.pb('Y');} string cur; ll coins; while(p.size()<=N-2) { cur= (string) (p+c[0]+c[0]+p+c[0]+c[1]+p+c[0]+c[2]+p+c[1]); coins = press(cur); if(coins==p.size()) {p+=c[2];} else if(coins==p.size()+1) {p+=c[1];} else if(coins==p.size()+2) {p+=c[0];} } coins = press(p+c[0]+p+c[1]); if(coins==N) { coins = press(p+c[0]); if(coins==N) {p+=c[0];} else {p+=c[1];} } else {p+=c[2];} return p; }

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

combo.cpp: In function 'void Out(std::vector<int>)':
combo.cpp:11:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define REP(i,a,b) for(ll i=a; i<b; i++)
......
   20 | void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
      |                             ~~~~~~~~~~~~
combo.cpp:20:25: note: in expansion of macro 'REP'
   20 | void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
      |                         ^~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |     while(p.size()<=N-2)
      |           ~~~~~~~~^~~~~
combo.cpp:49:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         if(coins==p.size()) {p+=c[2];}
      |            ~~~~~^~~~~~~~~~
combo.cpp:50:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         else if(coins==p.size()+1) {p+=c[1];}
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:51:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         else if(coins==p.size()+2) {p+=c[0];}
      |                 ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...