Submission #60125

# Submission time Handle Problem Language Result Execution time Memory
60125 2018-07-23T17:11:54 Z theknife2001 Parrots (IOI11_parrots) C++17
0 / 100
10 ms 2240 KB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>

using namespace std;


void encode(int N, int M[])
{
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<8;j++)
        {
            if(M[i]&(1<<j))
            {
                if(i>15)
                {
                    send(j+(i-16)*10);
                    send(j+(i-16)*10);
                }
                else
                {
                    send(j+i*10);
                }
            }
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

map < int , int > mp;

void decode(int N, int L, int X[])
{
    int a[260];
    for(int i=0;i<N;i++)
        a[i]=0;
    int x;
    for(int i=0;i<L;i++)
        mp[X[i]]++;
    int f,s;
    for(auto m:mp)
    {
        f=m.first;
        s=m.second;
        if(f!=0)
        {
            x=f%10;
            f/=10;
        }
        else
            f=0;
        if(s>1)
        {
           a[f+16]+=(1<<x);
           s-=2;
        }
        if(s==1)
        {
           a[f]+=(1<<x);
        }
    }
    mp.clear();
    for(int i=0;i<N;i++)
        output(a[i]);
}

Compilation message

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:33:23: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
            a[f+16]+=(1<<x);
                     ~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1008 KB Error : Output is wrong
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1752 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2128 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2128 KB Error : Output is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2176 KB Error : Output is wrong
2 Incorrect 10 ms 2208 KB Error : Output is wrong
3 Incorrect 8 ms 2240 KB Error : Output is wrong
4 Incorrect 5 ms 2240 KB Error : Bad encoded integer
5 Incorrect 5 ms 2240 KB Error : Bad encoded integer
6 Incorrect 4 ms 2240 KB Error : Bad encoded integer
7 Incorrect 7 ms 2240 KB Error : Bad encoded integer