제출 #717635

#제출 시각아이디문제언어결과실행 시간메모리
717635lukatasevMemory (IOI10_memory)C++14
컴파일 에러
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <algorithm> void play() { char niza[25] = {'0'}, niza2[25]; char current; for(int i=1; i<=50; i++) { current = faceup(i); if(niza[current] == '0') { niza[current] = i; } else { niza2[current] = i; } } sort(niza, niza+25); sort(niza2, niza2+25); for(auto x: niza) { for(auto y: niza2) { faceup(x); faceup(y); } } // int i; // char a, b; // for (i=0; i<10; ++i) { // a = faceup(42); // b = faceup(47); // } }

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

memory.cpp: In function 'void play()':
memory.cpp:10:15: warning: array subscript has type 'char' [-Wchar-subscripts]
   10 |       if(niza[current] == '0') {
      |               ^~~~~~~
memory.cpp:11:15: warning: array subscript has type 'char' [-Wchar-subscripts]
   11 |          niza[current] = i;
      |               ^~~~~~~
memory.cpp:13:16: warning: array subscript has type 'char' [-Wchar-subscripts]
   13 |          niza2[current] = i;
      |                ^~~~~~~
memory.cpp:16:4: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   16 |    sort(niza, niza+25);
      |    ^~~~
      |    std::sort
In file included from /usr/include/c++/10/algorithm:62,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: 'std::sort' declared here
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~