답안 #31853

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31853 2017-09-11T07:44:21 Z YoLo Brunhilda’s Birthday (BOI13_brunhilda) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define pi acos(-1)
#define pque priority_queue
typedef pair < int, int > ii;
typedef vector < int > vi;
typedef vector < vi > vii;
int mod = 1000000007;
int n, m, a[100009], j, num[10000009], next, cur, t = 1, ans[10000009];
signed main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i <= n; i++)
	{
		j = 0;
		while(j <= 10000000)
		{
			num[j] = max(num[j], a[i]);
			j += a[i];
		}
	}
	next = num[0];
	num[1] = num[0] - 1;
	for(int i = 2; i <= 10; i++)
	{
		int k = 0;
		while(i >= next && cur < i)
		{
			cur ++;
			k = 1;
			next = num[cur] + cur;
		}
		if(cur == i)
			break;
		ans[i] = ans[cur] + 1;
	}
	while(m --)
	{
		int k;
		cin >> k;
		if(ans[k])
			cout << ans[k] << endl;
		else
			cout << "oo" << endl;
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:29:2: error: reference to 'next' is ambiguous
  next = num[0];
  ^
brunhilda.cpp:14:40: note: candidates are: int next
 int n, m, a[100009], j, num[10000009], next, cur, t = 1, ans[10000009];
                                        ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from brunhilda.cpp:1:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
brunhilda.cpp:34:14: error: reference to 'next' is ambiguous
   while(i >= next && cur < i)
              ^
brunhilda.cpp:14:40: note: candidates are: int next
 int n, m, a[100009], j, num[10000009], next, cur, t = 1, ans[10000009];
                                        ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from brunhilda.cpp:1:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^
brunhilda.cpp:38:4: error: reference to 'next' is ambiguous
    next = num[cur] + cur;
    ^
brunhilda.cpp:14:40: note: candidates are: int next
 int n, m, a[100009], j, num[10000009], next, cur, t = 1, ans[10000009];
                                        ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from brunhilda.cpp:1:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note:                 template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
     next(_ForwardIterator __x, typename
     ^