QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#142765#6661. 야유회penguinmanCompile Error//C++171.3kb2023-08-19 20:44:512023-08-19 20:44:54

Judging History

你现在查看的是最新测评结果

  • [2023-08-19 20:44:54]
  • 评测
  • [2023-08-19 20:44:51]
  • 提交

answer

#include "workshop.h"

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using ll = int;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;

#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define mp std::make_pair
#define mtp std::make_tuple

constexpr ll max = 

void init() { }

int f(int x, int y){
    constexpr int LOG = 20;
    rep(i,0,LOG){
        ll a = (x & (1<<i));
        ll b = (y & (1<<i));
        if(a != b){
            int ret = i*2;
            if(a) ret++;
            return ret;
        }
    }
}

int morning(int my_num, int right_num) {
    return f(my_num, right_num);
}

int afternoon(int left_num, int my_num, int right_num) {
    return f(f(left_num, my_num), f(my_num, right_num));
}

int evening(int left_num, int my_num, int right_num) {
    int L = f(left_num, my_num), R = f(my_num, right_num);
    vector<string> S = {"0011", "0101", "0110", "1001", "1010", "1100"};
    rep(j,0,4){
        if(S[L][j] == '0' && S[R][j] == '1') return j;
    }
}

Details

answer.code:26:1: error: expected primary-expression before ‘void’
   26 | void init() { }
      | ^~~~
answer.code: In function ‘int morning(int, int)’:
answer.code:42:12: error: ‘f’ was not declared in this scope
   42 |     return f(my_num, right_num);
      |            ^
answer.code: In function ‘int afternoon(int, int, int)’:
answer.code:46:14: error: ‘f’ was not declared in this scope
   46 |     return f(f(left_num, my_num), f(my_num, right_num));
      |              ^
answer.code:46:12: error: ‘f’ was not declared in this scope
   46 |     return f(f(left_num, my_num), f(my_num, right_num));
      |            ^
answer.code: In function ‘int evening(int, int, int)’:
answer.code:50:13: error: ‘f’ was not declared in this scope
   50 |     int L = f(left_num, my_num), R = f(my_num, right_num);
      |             ^
answer.code:53:32: error: ‘R’ was not declared in this scope
   53 |         if(S[L][j] == '0' && S[R][j] == '1') return j;
      |                                ^
answer.code:55:1: warning: control reaches end of non-void function [-Wreturn-type]
   55 | }
      | ^