제출 #1308869

#제출 시각아이디문제언어결과실행 시간메모리
1308869thnhannCoins (IOI17_coins)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <string> #include <bits/stdc++.h> #define int long long using namespace std; int[] coin_flips(int[] b, int c) { int filp[1]; flip[0] = 4; if(c == 0) { if(b[0] == 1 && b[2] == 1) flip[0] = 2; } if(c == 1) { if(b[0] == 1 && b[2] == 1) { if(b[1] == 0) flip[0] = 1; } if(b[0] == 1 && b[2] == 0) flip[0] = 0; if(b[0] == 0 && b[2] == 1) flip[0] = 2; } if(c == 2) { if(b[0] == 1 && b[2] == 1) flip[0] = 0; } } int find_coin(int[] b) { int c; if(b[0] == 1 && b[2] == 0) return 0; if(b[0] == 0 && b[2] == 1) return 2; return 1; }

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

coins.cpp:9:4: error: structured binding declaration cannot have type 'long long int'
    9 | int[] coin_flips(int[] b, int c)
      |    ^~
coins.cpp:9:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
coins.cpp:9:4: error: empty structured binding declaration
coins.cpp:9:7: error: expected initializer before 'coin_flips'
    9 | int[] coin_flips(int[] b, int c)
      |       ^~~~~~~~~~
coins.cpp:38:21: error: expected ',' or '...' before 'b'
   38 | int find_coin(int[] b)
      |                     ^
coins.cpp: In function 'long long int find_coin(long long int*)':
coins.cpp:41:8: error: 'b' was not declared in this scope
   41 |     if(b[0] == 1 && b[2] == 0) return 0;
      |        ^
coins.cpp:42:8: error: 'b' was not declared in this scope
   42 |     if(b[0] == 0 && b[2] == 1) return 2;
      |        ^
grader.cpp: In function 'void shuffle(std::vector<int>&)':
grader.cpp:88:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   88 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:5:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~