Submission #14059

# Submission time Handle Problem Language Result Execution time Memory
14059 2015-04-26T02:31:03 Z pl0892029 이상한 수열 (OJUZ10_bizarre) C++
Compilation error
0 ms 0 KB
#include <cstdio>
#include <unordered_set>

int arr[50505];

int main()
{
	int n, m;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", &arr[i]);
	}
	scanf("%d", &m);

	if (m <= n)
	{
		printf("%d", arr[m]);
	}
	else
	{
		std::unordered_set<int> nSet;
		for (int i = 1; i <= n; ++i)
		{
			nSet.insert(arr[i]);
		}
		for (int i = n + 1; i < m; ++i)
		{
			nSet.insert(nSet.size());
		}

		printf("%d", nSet.size());
	}
}

Compilation message

In file included from /usr/include/c++/4.9/unordered_set:35:0,
                 from bizarre.cpp:2:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
bizarre.cpp: In function ‘int main()’:
bizarre.cpp:22:3: error: ‘unordered_set’ is not a member of ‘std’
   std::unordered_set<int> nSet;
   ^
bizarre.cpp:22:22: error: expected primary-expression before ‘int’
   std::unordered_set<int> nSet;
                      ^
bizarre.cpp:25:4: error: ‘nSet’ was not declared in this scope
    nSet.insert(arr[i]);
    ^
bizarre.cpp:29:4: error: ‘nSet’ was not declared in this scope
    nSet.insert(nSet.size());
    ^
bizarre.cpp:32:16: error: ‘nSet’ was not declared in this scope
   printf("%d", nSet.size());
                ^
bizarre.cpp:9:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
bizarre.cpp:12:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &arr[i]);
                       ^
bizarre.cpp:14:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
                 ^