답안 #1069557

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069557 2024-08-22T05:52:37 Z Faisal_Saqib 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 KB
#include <vector>

std::vector<int> longest_trip(int n, int D)
{
	if(D==3)
	{
		vector<int> ans;
		for(int i=0;i<n;i++)
			ans.push_back(i);
		return ans;
	}
	else
	{
		
	}
}
bool are_connected(std::vector<int> A, std::vector<int> B);

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> ans;
      |   ^~~~~~
longesttrip.cpp:7:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from longesttrip.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from longesttrip.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
longesttrip.cpp:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> ans;
      |          ^~~
longesttrip.cpp:9:4: error: 'ans' was not declared in this scope
    9 |    ans.push_back(i);
      |    ^~~
longesttrip.cpp:10:10: error: 'ans' was not declared in this scope
   10 |   return ans;
      |          ^~~