제출 #424729

#제출 시각아이디문제언어결과실행 시간메모리
424729ollel저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> #include "scales.h" using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; int t; // int getLightest(vi x) { // cout << "lightest:"; // rep(i,0,3) cout << x[i] << " ";cout<<endl; // int ans; cin >> ans; return ans; // } // int getNextLightest(vi x) { // cout << "next lightest:"; // rep(i,0,4) cout << x[i] << " ";cout<<endl; // int ans; cin >> ans; return ans; // } // int getMedian(vi x) { // cout << "Median:"; // rep(i,0,3) cout << x[i] << " ";cout<<endl; // int ans; cin >> ans; return ans; // } void init(int T) {t = T;} // void answer(vi x) {rep(i,0,6) cout << x[i] << " ";} void orderCoins() { vi first(3), second(3); first[0] = getLightest({1, 2, 3}); first[1] = getMedian({1, 2, 3}); rep(i, 1, 4) if (i != first[0] && i != first[1]) first[2] = i; second[0] = getLightest({4, 5, 6}); second[1] = getMedian({4, 5, 6}); rep(i, 4, 7) if (i != second[0] && i != second[1]) second[2] = i; vi ordered; int fi = 0, si = 0; ordered.pb(getLightest({first[0], first[1], second[0]})); if (ordered[0] == first[0]) fi = 1;//ordered.pb(getLightest({first[1], first[2], second[0]})); else si = 1;//ordered.pb(getLightest({first[0], first[1], second[1]})); while (ordered.size() < 6) { if (si < 3 && fi < 3) { if (si != 2) ordered.pb(getLightest({first[fi], second[si], second[si + 1]})); else if (fi != 2) ordered.pb(getLightest({first[fi], first[fi + 1], second[si]})); else ordered.pb(getNextLightest({first[0], first[fi], second[si], ordered[ordered.size() - 1]})); if (ordered[ordered.size() - 1] == first[fi]) fi++; else si++; } else if (si < 3) { ordered.pb(second[si]); si++; } else { ordered.pb(first[fi]); fi++; } } answer(ordered); } // int main(){ // orderCoins(); // }

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:38:35: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   38 |   first[0] = getLightest({1, 2, 3});
      |                                   ^
      |                                   |
      |                                   <brace-enclosed initializer list>
In file included from scales.cpp:3:
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:39:33: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   39 |   first[1] = getMedian({1, 2, 3});
      |                                 ^
      |                                 |
      |                                 <brace-enclosed initializer list>
In file included from scales.cpp:3:
scales.h:12:19: note:   initializing argument 1 of 'int getMedian(int, int, int)'
   12 | int getMedian(int A, int B, int C);
      |               ~~~~^
scales.cpp:42:36: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   42 |   second[0] = getLightest({4, 5, 6});
      |                                    ^
      |                                    |
      |                                    <brace-enclosed initializer list>
In file included from scales.cpp:3:
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:43:34: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   43 |   second[1] = getMedian({4, 5, 6});
      |                                  ^
      |                                  |
      |                                  <brace-enclosed initializer list>
In file included from scales.cpp:3:
scales.h:12:19: note:   initializing argument 1 of 'int getMedian(int, int, int)'
   12 | int getMedian(int A, int B, int C);
      |               ~~~~^
scales.cpp:48:57: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   48 |   ordered.pb(getLightest({first[0], first[1], second[0]}));
      |                                                         ^
      |                                                         |
      |                                                         <brace-enclosed initializer list>
In file included from scales.cpp:3:
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:54:82: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   54 |       if (si != 2) ordered.pb(getLightest({first[fi], second[si], second[si + 1]}));
      |                                                                                  ^
      |                                                                                  |
      |                                                                                  <brace-enclosed initializer list>
In file included from scales.cpp:3:
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:55:86: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   55 |       else if (fi != 2) ordered.pb(getLightest({first[fi], first[fi + 1], second[si]}));
      |                                                                                      ^
      |                                                                                      |
      |                                                                                      <brace-enclosed initializer list>
In file included from scales.cpp:3:
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:56:101: error: cannot convert '<brace-enclosed initializer list>' to 'int'
   56 |       else ordered.pb(getNextLightest({first[0], first[fi], second[si], ordered[ordered.size() - 1]}));
      |                                                                                                     ^
      |                                                                                                     |
      |                                                                                                     <brace-enclosed initializer list>
In file included from scales.cpp:3:
scales.h:15:25: note:   initializing argument 1 of 'int getNextLightest(int, int, int, int)'
   15 | int getNextLightest(int A, int B, int C, int D);
      |                     ~~~~^
scales.cpp:68:10: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   68 |   answer(ordered);
      |          ^~~~~~~
      |          |
      |          vi {aka std::vector<int>}
In file included from scales.cpp:3:
scales.h:10:17: note:   initializing argument 1 of 'void answer(int*)'
   10 | void answer(int W[]);
      |             ~~~~^~~