제출 #297048

#제출 시각아이디문제언어결과실행 시간메모리
297048Trickster커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define N 200010
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mod 1000000007
#define pii pair <int, int>
#define sz(a) int(a.size())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;}

pii p[N];
queue <pii> Q;

int find_best(int n)
{
    Q.push({0, n-1});

    while(!Q.empty()) {
        int l = Q.front().ff, r = Q.front().ss;
        Q.pop();

        if(p[l] == {0, 0}) p[l] = ask(l);
        if(p[r] == {0, 0}) p[r] = ask(r);

        if(p[l] == {0, 0}) return l;
        if(p[r] == {0, 0}) return r;

        if(p[l].ss == p[r].ss || p[r].ff == p[l].ff) continue;            

        md = (l+r)/2;

        Q.push({l, md});
        Q.push({md, r});
    }
}

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

prize.cpp:22: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   22 | #pragma GCC optimization ("O3")
      | 
prize.cpp:23: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
   23 | #pragma GCC optimization ("unroll-loops")
      | 
prize.cpp: In function 'int find_best(int)':
prize.cpp:37:20: error: expected primary-expression before '{' token
   37 |         if(p[l] == {0, 0}) p[l] = ask(l);
      |                    ^
prize.cpp:37:19: error: expected ')' before '{' token
   37 |         if(p[l] == {0, 0}) p[l] = ask(l);
      |           ~       ^~
      |                   )
prize.cpp:37:35: error: 'ask' was not declared in this scope
   37 |         if(p[l] == {0, 0}) p[l] = ask(l);
      |                                   ^~~
prize.cpp:38:20: error: expected primary-expression before '{' token
   38 |         if(p[r] == {0, 0}) p[r] = ask(r);
      |                    ^
prize.cpp:38:19: error: expected ')' before '{' token
   38 |         if(p[r] == {0, 0}) p[r] = ask(r);
      |           ~       ^~
      |                   )
prize.cpp:38:35: error: 'ask' was not declared in this scope
   38 |         if(p[r] == {0, 0}) p[r] = ask(r);
      |                                   ^~~
prize.cpp:40:20: error: expected primary-expression before '{' token
   40 |         if(p[l] == {0, 0}) return l;
      |                    ^
prize.cpp:40:19: error: expected ')' before '{' token
   40 |         if(p[l] == {0, 0}) return l;
      |           ~       ^~
      |                   )
prize.cpp:41:20: error: expected primary-expression before '{' token
   41 |         if(p[r] == {0, 0}) return r;
      |                    ^
prize.cpp:41:19: error: expected ')' before '{' token
   41 |         if(p[r] == {0, 0}) return r;
      |           ~       ^~
      |                   )
prize.cpp:45:9: error: 'md' was not declared in this scope; did you mean 'mod'?
   45 |         md = (l+r)/2;
      |         ^~
      |         mod
prize.cpp:47:23: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   47 |         Q.push({l, md});
      |                       ^
In file included from /usr/include/c++/9/queue:64,
                 from prize.cpp:6:
/usr/include/c++/9/bits/stl_queue.h:259:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  259 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:259:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  259 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:264:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  264 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:264:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  264 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
prize.cpp:48:23: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   48 |         Q.push({md, r});
      |                       ^
In file included from /usr/include/c++/9/queue:64,
                 from prize.cpp:6:
/usr/include/c++/9/bits/stl_queue.h:259:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  259 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:259:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  259 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:264:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  264 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:264:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  264 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
prize.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
   50 | }
      | ^