제출 #783370

#제출 시각아이디문제언어결과실행 시간메모리
783370shezitt저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <scales.h> using namespace std; #define sz(x) (int) x.size() #define dbg(x) cout << #x << ": " << x << endl; using ll = long long; void orderCoins(){ set<int> lista = {1, 2, 3, 4, 5, 6}; int a, b, c, d, e, z; // encontrando a int x = getLightest(1, 2, 3); int y = getLightest(4, 5, 6); int aux; for(auto xx : lista){ if(xx != x && xx != y){ aux = xx; break; } } a = getLightest({x, y, aux}); lista.erase(a); // encontrando b // 2 3 4 5 6 auto it = st.begin(); x = getLightest(*it, *(++it), *(++it)); b = getLightest(x, *(++it), *(++it)); lista.erase(b); // encontrando z // 3 4 5 6 it = st.begin(); x = getHeaviest(*it, *(++it), *(++it)); z = getHeaviest(x, *(++it), a); lista.erase(z); // encontrando c // 4 5 6 it = st.begin(); c = getLightest(*it, *(++it), *(++it)); lista.erase(c); // encontrando d // 5 6 it = st.begin(); d = getLightest(*it, *(++it), z); lista.erase(d); // sobra e // 6 e = *st.begin(); answer(a, b, c, d, e, z); } void init(int T){ while(T--){ orderCoins(); } }

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:23:29: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   23 |  a = getLightest({x, y, aux});
      |                             ^
      |                             |
      |                             <brace-enclosed initializer list>
In file included from scales.cpp:2:
scales.h:14:21: note:   initializing argument 1 of 'int getLightest(int, int, int)'
   14 | int getLightest(int A, int B, int C);
      |                 ~~~~^
scales.cpp:29:12: error: 'st' was not declared in this scope; did you mean 'it'?
   29 |  auto it = st.begin();
      |            ^~
      |            it
scales.cpp:59:9: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   59 |  answer(a, b, c, d, e, z);
      |         ^
      |         |
      |         int
scales.cpp:59:25: error: too many arguments to function 'void answer(int*)'
   59 |  answer(a, b, c, d, e, z);
      |                         ^
In file included from scales.cpp:2:
scales.h:10:6: note: declared here
   10 | void answer(int W[]);
      |      ^~~~~~