제출 #894206

#제출 시각아이디문제언어결과실행 시간메모리
894206ozner77Arranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> long long count_swaps(std::vector<int> s) { return 1; int a,b; vector<int> V; scanf("%d",&a); for(int i=0;i<a;i++){ scanf("%d",&b); V.push_back(b); } if(V[0]<0){ cout<<0; }else{ cout<<1; } }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:6:2: error: 'vector' was not declared in this scope
    6 |  vector<int> V;
      |  ^~~~~~
shoes.cpp:6:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from shoes.h:5,
                 from shoes.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 shoes.h:5,
                 from shoes.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
shoes.cpp:6:9: error: expected primary-expression before 'int'
    6 |  vector<int> V;
      |         ^~~
shoes.cpp:10:9: error: 'V' was not declared in this scope
   10 |         V.push_back(b);
      |         ^
shoes.cpp:12:5: error: 'V' was not declared in this scope
   12 |  if(V[0]<0){
      |     ^
shoes.cpp:13:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |         cout<<0;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from shoes.cpp:2:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
shoes.cpp:15:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |         cout<<1;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from shoes.cpp:2:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
shoes.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d",&a);
      |  ~~~~~^~~~~~~~~
shoes.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf("%d",&b);
      |         ~~~~~^~~~~~~~~