제출 #109003

#제출 시각아이디문제언어결과실행 시간메모리
109003davitmarg콤보 (IOI18_combo)C++17
100 / 100
67 ms628 KiB
/* DEATH-MATCH Davit-Marg */ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <stack> #include <iterator> #include <ctype.h> #include "combo.h" #define mod 1000000007 #define LL long long #define LD long double #define MP make_pair #define PB push_back using namespace std; // //int press(string p) //{ // int ans; // cout << p << endl; // cin >> ans; // return ans; //} string guess_sequence(int N) { string s[4] = {"A","B","X","Y"},ans,query; if (press("AB")>=1) { if (press("A") == 1) ans = "A"; else { ans = "B"; swap(s[0],s[1]); } } else { if (press("X") == 1) { ans = "X"; swap(s[0], s[2]); } else { ans = "Y"; swap(s[0], s[3]); } } while (ans.length() < N - 1) { query = ans + s[1]; for (int i = 1; i < 4; i++) query += ans + s[2] + s[i]; int p = press(query); if (p == ans.length() + 2) ans += s[2]; else if(p==ans.length()+1) ans += s[1]; else ans += s[3]; } while (ans.length() < N) { if (press(ans + s[1] + ans + s[2]) == ans.length() + 1) { if (press(ans + s[1]) == ans.length() + 1) ans += s[1]; else ans += s[2]; } else { ans += s[3]; } } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:62:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   62 |  while (ans.length() < N - 1)
      |         ~~~~~~~~~~~~~^~~~~~~
combo.cpp:70:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |   if (p == ans.length() + 2)
      |       ~~^~~~~~~~~~~~~~~~~~~
combo.cpp:72:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |   else if(p==ans.length()+1)
      |           ~^~~~~~~~~~~~~~~~
combo.cpp:80:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   80 |  while (ans.length() < N)
      |         ~~~~~~~~~~~~~^~~
combo.cpp:82:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |   if (press(ans + s[1] + ans + s[2]) == ans.length() + 1)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:84:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |    if (press(ans + s[1]) == ans.length() + 1)
      |        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...