제출 #493067

#제출 시각아이디문제언어결과실행 시간메모리
493067_adis콤보 (IOI18_combo)C++14
5 / 100
1 ms276 KiB
/*input */ /*inhuman strength #pragma GCC optimize("O2,unroll-loops") #pragma GCC target("avx,avx2") */ #include<bits/stdc++.h> #include "combo.h" #define foR(i,a,b) for(int i=a;i<=b;i++) #define roF(i,a,b) for(int i=a;i>=b;i--) #define _ff exit(0); #define Sort(i,a,b) sort(i+a,i+a+b) #define SORT(i,a,b) sort(i+a,i+a+b,greater<int>()) #define code_chef for(int i=1,x=0;i<=100000;i++){x++;cerr<<x;} #define TLE cerr<<"\n" << 1.0*clock()/CLOCKS_PER_SEC << "\n"; #define F first #define S second #define sperm(a) next_permutation(a.begin(),a.end()); #define all(a) a.begin(),a.end() #define nxhieu_speed cin.tie(0)->sync_with_stdio(false); #define i2 pair<int,int> #define getbit(x,i) ((x>>(i))&1) #define batbit(x,i) (x|(1ll<<(i))) #define tatbit(x,i) (x&~(1<<(i))) #define RTE cout<<-1;_ff using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int l, int r) {return l + rng() % (r - l + 1);} int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; struct Triple { int Fi; int Se; int Th; }; bool operator >(Triple A, Triple B) { if (A.Fi == B.Fi && A.Se == B.Se) return (A.Th > B.Th); if (A.Fi == B.Fi && A.Se != B.Se) return (A.Se > B.Se); return (A.Fi > B.Fi); } bool operator <(Triple A, Triple B) { if (A.Fi == B.Fi && A.Se == B.Se) return (A.Th < B.Th); if (A.Fi == B.Fi && A.Se != B.Se) return (A.Se < B.Se); return (A.Fi < B.Fi); } bool operator ==(Triple A, Triple B) { return (A.Fi == B.Fi && A.Se == B.Se && A.Th == B.Th); } int Money; string guess_sequence(int n) { string s; Money = press("AB"); vector<char> S; if (Money >= 1) { Money = press("A"); if (Money == 1) { S.push_back('B'); S.push_back('X'); S.push_back('Y'); s = s + 'A'; } else { S.push_back('A'); S.push_back('X'); S.push_back('Y'); s = s + 'B'; } } else { Money = press("X"); if (Money == 1) { s = s + 'X'; S.push_back('B'); S.push_back('A'); S.push_back('Y'); } else { s = s + 'Y'; S.push_back('B'); S.push_back('X'); S.push_back('A'); } } for (int i = 2; i < n; ++i) { Money = press( s + S[0] + s + S[1] + S[0] + s + S[1] + S[1] + s + S[1] + S[2] ); if (Money == s.size() + 1) s = s + S[0]; else if (Money == s.size() + 2) s = s + S[1]; else s = s + S[2]; } Money=press(s+S[0]); if(Money==n) s=s+S[0]; else { Money=press(s+S[1]); if(Money==n) s=s+S[1]; else s=s+S[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:104:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |   if (Money == s.size() + 1) s = s + S[0];
      |       ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:105:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |   else if (Money == s.size() + 2) s = s + S[1];
      |            ~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...