제출 #534432

#제출 시각아이디문제언어결과실행 시간메모리
534432MrDebooCombo (IOI18_combo)C++17
0 / 100
38 ms296 KiB
#include "combo.h" #include <bits/stdc++.h> // #define int long long using namespace std; std::string guess_sequence(int n) { srand(time(NULL)); char f[]={'A','B','X','Y'}; string s; bool bl=0; for(auto &i:f){ string g; g+=i; if(press(g)!=0){bl=1;s+=i;break;} if(i=='X')break; } if(!bl)s+='Y'; vector<char>ve; for(auto &i:f)if(i!=s[0])ve.push_back(i); vector<char>v=ve; int cnt=0; while(s.size()!=n){ bool bl=0; vector<bool>pick(3); map<char,bool>mp; for(int w=0;w<v.size()-1;w++){ string G; G+=v[w]; // for(int i=0;i<min(20,(int)s.size()-1);i++)G+=ve[rand()%ve.size()]; int k=press(s+G); cnt++; if(k>s.size()){ for(int i=0;i<k-s.size();i++){ s+=G[i]; } if(k!=G.size()+s.size())mp[G[k-s.size()]]=1; bl=1; break; } } if(!bl)s+=v.back(); vector<char>V; for(auto i:ve)if(!mp[i])V.push_back(i); v=V; } return s; // std::string p = ""; // for (int i = 0; i < 4 * N; ++i) { // p += 'A'; // } // int coins = press(p); // std::string S = ""; // for (int i = 0; i < N; ++i) { // S += 'A'; // } // return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     while(s.size()!=n){
      |           ~~~~~~~~^~~
combo.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int w=0;w<v.size()-1;w++){
      |                     ~^~~~~~~~~~~
combo.cpp:31:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             if(k>s.size()){
      |                ~^~~~~~~~~
combo.cpp:32:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 for(int i=0;i<k-s.size();i++){
      |                             ~^~~~~~~~~~~
combo.cpp:35:21: 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(k!=G.size()+s.size())mp[G[k-s.size()]]=1;
      |                    ~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...