제출 #116693

#제출 시각아이디문제언어결과실행 시간메모리
116693tselmegkh콤보 (IOI18_combo)C++14
0 / 100
29 ms328 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define INF 1e9 #define MAX 100005 #define xx first #define yy second #define pb push_back #define mp make_pair #define ull long long #define FOR(i,a,b) for(int i=a;i<=b;i++) #define nl '\n' #define zai <<' '<< #define all(a) a.begin(),a.end() #define pc __builtin_popcount #define debug(x) cerr << #x << " = " << (x) << ", " typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; template<class C> void mini(C &_a, C _b) { _a = min(_a, _b); } template<class C> void maxi(C &_a, C _b) { _a = max(_a, _b); } int press(string p); string guess_sequence(int n){ string ans; char cant; vector<char> v={'A','B','X','Y'}; int q1=press("AB"); if(q1){ if(press("A")){ ans+="A"; v.erase(v.begin()); } else{ ans+="B"; v.erase(v.begin()+1); } } else{ if(press("X")){ ans+="X"; v.erase(v.begin()+2); } else{ ans+="Y"; v.erase(v.begin()+3); } } for(int i=1;i<n-1;i++){ int q=press(ans+v[0]+v[0]+ans+v[0]+v[1]+ans+v[0]+v[2]+ans+v[1]); int sz=ans.size(); if(q==sz){ ans+=v[1]; } else if(q==sz+1){ ans+=v[2]; } else if(q==sz+2){ ans+=v[0]; } } if(n>1 && press(ans+v[0]+ans+v[1])==n){ if(press(ans+v[0])==n)ans+=v[0]; else ans+=v[1]; } else if(n>1) ans+=v[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:7: warning: unused variable 'cant' [-Wunused-variable]
   27 |  char cant;
      |       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...