Submission #356661

#TimeUsernameProblemLanguageResultExecution timeMemory
356661urd05저울 (IOI15_scales)C++14
0 / 100
1 ms384 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

void init(int T) {
    /* ... */
}

int g(int a,int b) {
    for(int i=1;i<=6;i++) {
        if (i!=a&&i!=b) {
            return i;
        }
    }
}

int get(vector<int> v) {
    if (v.size()==1) {
        return v[0];
    }
    if (v.size()==6) {
        int a=getLightest(1,2,3);
        int b=getLightest(4,5,6);
        return getLightest(a,b,g(a,b));
    }
    int val=v[0];
    for(int i=1;i<v.size();i+=2) {
        if (i+1==v.size()) {
            val=getMedian(val,v[i],g(val,v[i]));
            continue;
        }
        val=getLightest(val,v[i],v[i+1]);
    }
    return val;
}

void orderCoins() {
    int W[6];
    vector<int> v;
    for(int i=1;i<=6;i++) {
        v.push_back(i);
    }
    for(int i=0;i<6;i++) {
        vector<int> nt;
        W[i]=get(v);
        for(int j=0;j<v.size();j++) {
            if (v[j]!=W[i]) {
                nt.push_back(v[j]);
            }
        }
        v.clear();
        for(int j=0;j<nt.size();j++) {
            v.push_back(nt[j]);
        }
    }
    answer(W);
    return;
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'int get(std::vector<int>)':
scales.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=1;i<v.size();i+=2) {
      |                 ~^~~~~~~~~
scales.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if (i+1==v.size()) {
      |             ~~~^~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for(int j=0;j<v.size();j++) {
      |                     ~^~~~~~~~~
scales.cpp:52:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         for(int j=0;j<nt.size();j++) {
      |                     ~^~~~~~~~~~
scales.cpp: In function 'int g(int, int)':
scales.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...