제출 #1094241

#제출 시각아이디문제언어결과실행 시간메모리
1094241guymmk콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("popcnt") #define int long long #define ll long long #define endl '\n' #define pii pair<int,int> #define debug(...) printf(__VA_ARGS__) //#define debug(...) #define trace(x) cout<<#x<<"="<<x<<endl; //#define trace(x) #define vi vector<int> #define vpii vector<pii > #define vvi vector<vector<int> #define umap unordered_map #define uset unordered_set #define mk make_pair #define pb push_back #define pob pop_back #define _ <<' '<< #define all(x) x.begin(),x.end() #define allr(x) x.rbegin(),x.rend() #define read(x) for (auto& zu: (x)) cin >> zu; static inline void print(const int &x) { if (x > 9)print(x / 10); putchar('0' + x % 10); } #define F first #define S second template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define mustawa ios::sync_with_stdio(false);cin.tie(nullptr); #define mishari main const int inf=1e9+7; void fa(bool ok){ cout << (ok ? "YES": "NO") << endl;} int pw(ll a, ll b, ll mod= 1e9 + 7){ ll result = 1; while(b) { if(b&1) { result = (result*a)%mod; } a = (a * a) % mod; b>>=1; } return result; } inline void usaco(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }int gcd(int a,int b){ if (b == 0)return a; return gcd(b, a % b); } int lcm(int a, int b){ return (a / gcd(a, b)) * b; } //long double log(int base,int x){ // return log2(x)/log(base); //} int log(int base,int x){ return ceil(log2(x)/log(base)); } string guess_sequence(int n){ string g="ABXY"; int x=press("A"); if(x){ string ret="A"; while(x!=n){ for(int i=0;i<4;i++){ if(g[i]!=ret[0]){ x= press(ret+g[i]); if(x>g.size()){ ret+=g[i]; break; } } } }cout<<ret<<endl; }int x=press("B"); if(x){ string ret="B"; while(x!=n){ for(int i=0;i<4;i++){ if(g[i]!=ret[0]){ x= press(ret+g[i]); if(x>g.size()){ ret+=g[i]; break; } } } }cout<<ret<<endl; }int x=press("X"); if(x){ string ret="X"; while(x!=n){ for(int i=0;i<4;i++){ if(g[i]!=ret[0]){ x= press(ret+g[i]); if(x>g.size()){ ret+=g[i]; break; } } } }cout<<ret<<endl; }int x=press("Y"); if(x){ string ret="Y"; while(x!=n){ for(int i=0;i<4;i++){ if(g[i]!=ret[0]){ x= press(ret+g[i]); if(x>g.size()){ ret+=g[i]; break; } } } }cout<<ret<<endl; } }

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

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:73:11: error: 'press' was not declared in this scope
   73 |     int x=press("A");
      |           ^~~~~
combo.cpp:80:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |                     if(x>g.size()){
      |                        ~^~~~~~~~~
combo.cpp:87:10: error: redeclaration of 'long long int x'
   87 |     }int x=press("B");
      |          ^
combo.cpp:73:9: note: 'long long int x' previously declared here
   73 |     int x=press("A");
      |         ^
combo.cpp:94:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |                     if(x>g.size()){
      |                        ~^~~~~~~~~
combo.cpp:101:10: error: redeclaration of 'long long int x'
  101 |     }int x=press("X");
      |          ^
combo.cpp:73:9: note: 'long long int x' previously declared here
   73 |     int x=press("A");
      |         ^
combo.cpp:108:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  108 |                     if(x>g.size()){
      |                        ~^~~~~~~~~
combo.cpp:115:10: error: redeclaration of 'long long int x'
  115 |     }int x=press("Y");
      |          ^
combo.cpp:73:9: note: 'long long int x' previously declared here
   73 |     int x=press("A");
      |         ^
combo.cpp:122:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  122 |                     if(x>g.size()){
      |                        ~^~~~~~~~~
combo.cpp:130:1: warning: no return statement in function returning non-void [-Wreturn-type]
  130 | }
      | ^