제출 #918539

#제출 시각아이디문제언어결과실행 시간메모리
918539fuad27Coins (IOI17_coins)C++17
컴파일 에러
0 ms0 KiB
#include "coins.h" std::vector<int> coin_flips(std::vector<int> b, int c) { int x = c; for(int i = 0;i<b.size();i++) x^=(b[i]?i:0); vector<int> ans=vector<int>(63); ans[x]=1; return ans; } int find_coin(std::vector<int> b) { int x =0; for(int i = 0;i<b.size();i++) x^=(b[i]?i:0); return x; }

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

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:5:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |   for(int i = 0;i<b.size();i++)
      |                 ~^~~~~~~~~
coins.cpp:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> ans=vector<int>(63);
      |   ^~~~~~
coins.cpp:7:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from coins.h:1,
                 from coins.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 coins.h:1,
                 from coins.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
coins.cpp:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> ans=vector<int>(63);
      |          ^~~
coins.cpp:8:3: error: 'ans' was not declared in this scope
    8 |   ans[x]=1;
      |   ^~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:15:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i = 0;i<b.size();i++)
      |                   ~^~~~~~~~~