제출 #799463

#제출 시각아이디문제언어결과실행 시간메모리
799463Boomyday콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
// // Created by adavy on 2/11/2023. // #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using db = double; using str = string; // yay python! using ii = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vii = vector<ii>; using vpl = vector<pl>; using vpd = vector<pd>; #define tcT template<class T #define tcTU tcT, class U tcT> using V = vector<T>; tcT, size_t SZ> using AR = array<T,SZ>; tcT> using PR = pair<T,T>; // pairs #define mp make_pair #define f first #define s second #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define len(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) rbegin(x), rend(x) #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define eb emplace_back #define pf push_front const int MOD = 1e9+7; // 998244353; const int MX = 2e5+5; const ll INF = 1e18; // not too close to LLONG_MAX const ld PI = acos((ld)-1); const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!! #include <cstdio> #include <cstdlib> #include <algorithm> #include <string> #include "combo.h" // ABXY std::string guess_sequence(int N) { std::string cur = ""; // get the first letter char FL = ' '; bool isAB = (press("AB") > 0); if (isAB){ bool isA = (press("A") > 0); if (isA) FL = 'A'; else FL = 'B'; } else { bool isX = (press("X") > 0); if (isX) FL = 'X'; else FL = 'Y'; } vector<char> lets = {'A','B','X','Y'}; vector<char> ml; trav(i, lets) { if (i!=FL) ml.pb(i); } cur.pb(FL); F0R(i, N-2){ int cns = press(cur+ml[0]+cur+ml[1]+ml[0]+cur+ml[1]+ml[1]+cur+ml[1]+ml[2]); if (cns==cur.size()+2) cur.pb(ml[1]); else if (cns==cur.size()+1) cur.pb(ml[0]); else cur.pb(ml[2]); } if (press(cur + ml[0])==N) cur += ml[0]; else if (press(cur + ml[1])==N) cur += ml[1]; else cur += ml[2]; return cur; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:99:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   99 |         if (cns==cur.size()+2) cur.pb(ml[1]);
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:100:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  100 |         else if  (cns==cur.size()+1) cur.pb(ml[0]);
      |                   ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...