제출 #647928

#제출 시각아이디문제언어결과실행 시간메모리
647928JANCARAPAN콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

const int dx[4]{1,0,-1,0}, dy[4]{0,1,0,-1};


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x);
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr <<__func__<<":"<<" [" << #x << "] = ["; _print(x); /*cerr << "\e[39m" << endl;*/
#else
#define dbg(x...)
#endif


#define ll long long;
#define ld long double;
//#define int long long

#define lwb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define upb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}

#define F first
#define S second
#define vi vector<ll>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define pb push_back
#define ii pair<ll,ll> 
#define vpi vector<ii> 
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define sz(x) (ll)size(x)
#define rs resize


const ll N = 2e5+5, INF = 1e18, MOD = 1e9+7;

string ch = "ABXY";



string guess_sequence(int n) {
    string s = "";

    int block = -1;

    if (press("A") == 1) block = 0;
    else if (press("B") == 1) block = 1;
    else if (press("X") == 1) block = 2;
    else block = 3;

    s += ch[block];

    for (int i=1; i<n-1; i++) {
        for (int j=0; j<4 && sz(s) < n; j++) {
            if (block == j) continue;
            if (press(s+ch[j]) > i) {
                s += ch[j];
                break;
            }
        }
    }




    return s;
}



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

combo.cpp:38:17: error: declaration does not declare anything [-fpermissive]
   38 | #define ll long long;
      |                 ^~~~
combo.cpp:62:7: note: in expansion of macro 'll'
   62 | const ll N = 2e5+5, INF = 1e18, MOD = 1e9+7;
      |       ^~
combo.cpp:62:10: error: 'N' does not name a type
   62 | const ll N = 2e5+5, INF = 1e18, MOD = 1e9+7;
      |          ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:12: error: expected primary-expression before 'long'
   38 | #define ll long long;
      |            ^~~~
combo.cpp:58:16: note: in expansion of macro 'll'
   58 | #define sz(x) (ll)size(x)
      |                ^~
combo.cpp:81:30: note: in expansion of macro 'sz'
   81 |         for (int j=0; j<4 && sz(s) < n; j++) {
      |                              ^~
combo.cpp:38:12: error: expected ')' before 'long'
   38 | #define ll long long;
      |            ^~~~
combo.cpp:58:16: note: in expansion of macro 'll'
   58 | #define sz(x) (ll)size(x)
      |                ^~
combo.cpp:81:30: note: in expansion of macro 'sz'
   81 |         for (int j=0; j<4 && sz(s) < n; j++) {
      |                              ^~
combo.cpp:58:15: note: to match this '('
   58 | #define sz(x) (ll)size(x)
      |               ^
combo.cpp:81:30: note: in expansion of macro 'sz'
   81 |         for (int j=0; j<4 && sz(s) < n; j++) {
      |                              ^~
combo.cpp:81:36: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   81 |         for (int j=0; j<4 && sz(s) < n; j++) {
      |                                    ^
combo.cpp:81:36: warning: value computed is not used [-Wunused-value]
combo.cpp:81:41: error: 'j' was not declared in this scope
   81 |         for (int j=0; j<4 && sz(s) < n; j++) {
      |                                         ^