제출 #587102

#제출 시각아이디문제언어결과실행 시간메모리
587102keta_tsimakuridze저울 (IOI15_scales)C++17
38.78 / 100
1 ms296 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } int A[55]; void orderCoins() { vector<int> x; vector<int> v; for(int i = 1; i < 7; i++) v.push_back(i); random_shuffle(v.begin(), v.end()); random_shuffle(v.begin(), v.end()); random_shuffle(v.begin(), v.end()); for(int i = 1; i < 7; i++) A[i] = v[i - 1]; int a = getLightest(A[1], A[2], A[3]), b = getHeaviest(A[1], A[2], A[3]); x.push_back(a); x.push_back(A[1] + A[2] + A[3] - a - b); x.push_back(b); // 4 a = getNextLightest(A[1], A[2], A[3], A[4]); if(a != x[0]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(A[4]); xn.push_back(x[i]); } x = xn; } else { if(getHeaviest(x[1], x[2], A[4]) == A[4]) x.push_back(A[4]); else { vector<int> xn; xn.push_back(A[4]); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; } } // 5 a = getNextLightest(x[0], x[1], x[2], A[5]); if(a != x[0]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(A[5]); xn.push_back(x[i]); } x = xn; } else { if(getHeaviest(x[1], x[2], A[5]) == A[5]) { if(getHeaviest(x[2], x[3], A[5]) == A[5]) { x.push_back(A[5]); } else { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(i == 3) xn.push_back(A[5]); xn.push_back(x[i]); } x = xn; } } else { vector<int> xn; xn.push_back(A[5]); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; } } // 6 a = getNextLightest(x[1], x[2], x[3], A[6]); if(a != x[1]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(A[6]); xn.push_back(x[i]); } x = xn; } else if(getHeaviest(x[2], x[3], A[6]) == A[6]) { if(getHeaviest(x[3], x[4], A[6]) == A[6]) { x.push_back(A[6]); } else { x.push_back(A[6]); swap(x[5], x[4]); } } else { vector<int> xn; xn.push_back(A[6]); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; if(getLightest(x[0], x[1], x[2]) != A[6]) swap(x[0], x[1]); } // for(int i = 0; i < 6; i++) cout << x[i] << " "; // cout << endl; int W[] = {x[0], x[1], x[2], x[3], x[4], x[5]}; answer(W); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i = 0; i < x.size(); i++) {
      |                        ~~^~~~~~~~~~
scales.cpp:31:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                            ~~^~~~~~~~~~
scales.cpp:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |          for(int i = 0; i < x.size(); i++) {
      |                         ~~^~~~~~~~~~
scales.cpp:51:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |                 for(int i = 0; i < x.size(); i++) {
      |                                ~~^~~~~~~~~~
scales.cpp:60:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |             for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                            ~~^~~~~~~~~~
scales.cpp:68:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |          for(int i = 0; i < x.size(); i++) {
      |                         ~~^~~~~~~~~~
scales.cpp:83:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |         for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...