Submission #938559

# Submission time Handle Problem Language Result Execution time Memory
938559 2024-03-05T10:15:20 Z Zero_OP Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include<combo.h>

using namespace std;
using int64 = int64_t;

#define     REP(i, n) for(int i = 0, _n = n; i < _n; ++i)
#define    REPD(i, n) for(int i = n - 1; i >= 0; --i)
#define  FOR(i, l, r) for(int i = l, _r = r; i <= _r; ++i)
#define FORD(i, r, l) for(int i = r, _l = l; i >= _l; --i)
#define          left __left
#define         right __right
#define          prev __prev
#define          next __next
#define           div __div
#define            pb push_back
#define            pf push_front
#define         sz(v) (int)v.size()
#define      range(v) begin(v), end(v)
#define    compact(v) v.erase(unique(range(v)), end(v))
#define      debug(v) "[" #v " = " << (v) << "]"

template<typename T>
    bool minimize(T& a, const T& b){
        if(a > b){
            a = b;
            return true;
        }
        return false;
    }

template<typename T>
    bool maximize(T& a, const T& b){
        if(a < b){
            a = b;
            return true;
        }
        return false;
    }

template<int dimension, class T>
struct vec : public vector<vec<dimension - 1, T>> {
    static_assert(dimension > 0, "Dimension must be positive !\n");
    template<typename... Args>
    vec(int n = 0, Args... args) : vector<vec<dimension - 1, T>>(n, vec<dimension - 1, T>(args...)) {}
};

template<class T>
struct vec<1, T> : public vector<T> {
    vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};

void init(void);
void process(void);

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    #define task "antuvu"
    if(fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }

    int T = 1; //cin >> T;
    while(T--) {
        init();
        process();
    }

    return 0;
}

string guess_sequence(int N){
    string s = "", p = "";
    p = "AB";
    if(press(p)){
        p = "A";
        if(press(p)){
            s += "A";
        }
        else{
            s += "B";
        }
    }
    else{
        p = "X";
        if(press(p)){
            s += "X";
        }
        else{
            s += "Y";
        }
    }

    int corrected = 1;
    REP(i, N - 1){
        if(press(s + "A") > corrected){
            s += "A";
        }
        else if(press(s + "B") > corrected){
            s += "B";
        }
        else if(press(s + "X") > corrected){
            s += "X";
        }
        else s += "Y";
        ++corrected;
    }

    return s;
}

Compilation message

combo.cpp: In function 'int main()':
combo.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp:62:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |         freopen(task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc1xlWrY.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccB1Jh8W.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccB1Jh8W.o: in function `main':
combo.cpp:(.text.startup+0x67): undefined reference to `init()'
/usr/bin/ld: combo.cpp:(.text.startup+0x6c): undefined reference to `process()'
collect2: error: ld returned 1 exit status