Submission #73066

#TimeUsernameProblemLanguageResultExecution timeMemory
73066MKopchevScales (IOI15_scales)C++14
0 / 100
4 ms676 KiB
#include<bits/stdc++.h>
#include "scales.h"
using namespace std;
vector< vector<int> > possible,help;
vector<int> all;
void init(int T)
{
    srand(time(0));
    for(int i=0;i<6;i++)
        all.push_back(i+1);
}
int big(int a1,int a2,int a3)
{
    return (a1>a2)+(a1>a3);
}
void orderCoins()
{
    possible={};
    help={};
    do
    {
        possible.push_back(all);
    }
    while(next_permutation(all.begin(),all.end()));

    while(possible.size()>1)
    {
        int a=rand()%6,b=rand()%6,c=rand()%6;
        if(a==b||b==c||c==a)continue;

        int which=rand()%3;

        if(which==0)
        {
            int ans=getHeaviest(a+1,b+1,c+1);
            ans--;
            help={};
            for(auto k:possible)
            {
                if(ans==a&&big(k[a],k[b],k[c])==2)help.push_back(k);
                if(ans==b&&big(k[b],k[c],k[a])==2)help.push_back(k);
                if(ans==c&&big(k[c],k[a],k[b])==2)help.push_back(k);
            }
            possible=help;
        }
        else if(which==2)
        {
            int ans=getLightest(a+1,b+1,c+1);
            ans--;
            help={};
            for(auto k:possible)
            {
                if(ans==a&&big(k[a],k[b],k[c])==0)help.push_back(k);
                if(ans==b&&big(k[b],k[c],k[a])==0)help.push_back(k);
                if(ans==c&&big(k[c],k[a],k[b])==0)help.push_back(k);
            }
            possible=help;
        }
        else
        {
            int ans=getMedian(a+1,b+1,c+1);
            ans--;
            help={};
            for(auto k:possible)
            {
                if(ans==a&&big(k[a],k[b],k[c])==1)help.push_back(k);
                if(ans==b&&big(k[b],k[c],k[a])==1)help.push_back(k);
                if(ans==c&&big(k[c],k[a],k[b])==1)help.push_back(k);
            }
            possible=help;
        }
    }
    assert(possible.size()==1);
    int W[6]={possible[0][0],possible[0][1],possible[0][2],possible[0][3],possible[0][4],possible[0][5]};
    answer(W);
}

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: conversion to 'unsigned int' from 'time_t {aka long int}' may alter its value [-Wconversion]
     srand(time(0));
           ~~~~^~~
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T)
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...