Submission #60100

# Submission time Handle Problem Language Result Execution time Memory
60100 2018-07-23T16:23:55 Z theknife2001 Parrots (IOI11_parrots) C++17
Compilation error
0 ms 0 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*10);
                send(j+i*10);
            }
        }
    }
}


/*
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>

using namespace std;


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

using namespace std;

map < 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);
        }
    }

    for(int i=0;i<N;i++)
        output(a[i]);
}

Compilation message

decoder.cpp:8:1: error: 'map' does not name a type
 map < int > mp;
 ^~~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:17:9: error: 'mp' was not declared in this scope
         mp[X[i]]++;
         ^~
decoder.cpp:19:16: error: 'mp' was not declared in this scope
     for(auto m:mp)
                ^~
decoder.cpp:19:16: note: suggested alternative: 'm'
     for(auto m:mp)
                ^~
                m