QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#142764#6661. 야유회penguinmanCompile Error//C++171.3kb2023-08-19 20:44:172023-08-19 20:44:21

Judging History

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

  • [2023-08-19 20:44:21]
  • 评测
  • [2023-08-19 20:44:17]
  • 提交

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] == '0' && S[R] == '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:17: error: no match for ‘operator==’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} and ‘char’)
   53 |         if(S[L] == '0' && S[R] == '1') return j;
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_iterator.h:1118:5: note: candidate: ‘template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)’
 1118 |     operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1118:5: note:   template argument deduction/substitution failed:
answer.code:53:20: note:   ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} is not derived from ‘const __gnu_cxx::__normal_iterator<_IteratorL, _Container>’
   53 |         if(S[L] == '0' && S[R] == '1') return j;
      |                    ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_iterator.h:1126:5: note: candidate: ‘template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)’
 1126 |     operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1126:5: note:   template argument deduction/substitution failed:
answer.code:53:20: note:   ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type’ {aka ‘std::__cxx11::basic_string<char>’} is not derived from ‘const __gnu_cxx::__normal_iterator<_Iterator, _Container>’
   53 |         if(S[L] == '0' && S[R] == '1') return j;
      |                    ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/c++allocator.h:33,
                 from /usr/include/c++/11/bits/allocator.h:46,
                 from /usr/include/c++/11/string:41,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:3:
/usr/include/c++/11/ext/new_allocator.h:177:9: note: candidate: ‘template<class _Up> bool __gnu_cxx::operator==(const __gnu_cxx::new_allocator<char>&, const __gnu_cxx::new_allocator<_Tp>&)’
  177 |         operator==(const new_allocator&, const new_allocator<_Up>&)
      |         ^~~~~~~~
/usr/include/c++/11/ext/new_allocator.h:177:9: note:   template argument deduction/substitution failed:
answer.code:53:20: note:   mismatched types ‘const __gnu_cxx::new_allocator<_Tp>’ and ‘char’
   53 |         if(S[L] == '0' && S[R] == '1') return j;
      |                    ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++...