Submission #883471

# Submission time Handle Problem Language Result Execution time Memory
883471 2023-12-05T10:29:07 Z dejandenib Parrots (IOI11_parrots) C++17
81 / 100
847 ms 15016 KB
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
 
using namespace std;
 long long mapa2[92400];
 
int broj = 0;
map<long long ,int> mapa;
 
void rec(int posledno, int n, long long  s,int depth){
 
    if(depth==n)
    {
        mapa[s]=broj;
         //       mapa2[broj]=s;
 
        //cout<<s<<" "<<broj<<endl;
        broj++;
        return;
    }
    for(long long i =posledno;i<n;i++)
    {
 
        rec(i,n,s*10LL+i,depth+1);
 
    }
}
void rec2(int posledno, int n, long long  s,int depth){
 
    if(depth==n)
    {
        //mapa[s]=broj;
                mapa2[broj]=s;
 
        //cout<<s<<" "<<broj<<endl;
        broj++;
        return;
    }
    for(long long i =posledno;i<n;i++)
    {
 
        rec2(i,n,s*10LL+i,depth+1);
 
    }
}
 
void encode(int n, int a[])
{
   broj = 0;
    rec(0,10,0,0);
    for(int i =0;i<n;i++)
    {
 
        int k;
        k = 0;
        int  tosend = 0;
        int x = i;
        for (int j=0;j<5;j++)
        {
            if ((i & (1<<j))>0)
            {
 
                tosend+=1<<k;
 
            }
            k+=1;
 
        }
        tosend<<=3;
 
        for (int j=0;j<8;j++)
        {
            if ( (a[i] & (1<<j))>0)
            {
 
                send(tosend+j);
 
 
            }
 
 
        }
    }
 
 
}
 
#include <bits/stdc++.h>
 
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
 
 
 long long mapa2[92400];
 
int broj = 0;
map<long long ,int> mapa;
 
void rec(int posledno, int n, long long  s,int depth){
 
    if(depth==n)
    {
        mapa[s]=broj;
         //       mapa2[broj]=s;
 
        //cout<<s<<" "<<broj<<endl;
        broj++;
        return;
    }
    for(long long i =posledno;i<n;i++)
    {
 
        rec(i,n,s*10LL+i,depth+1);
 
    }
}
void rec2(int posledno, int n, long long  s,int depth){
 
    if(depth==n)
    {
        //mapa[s]=broj;
                mapa2[broj]=s;
 
        //cout<<s<<" "<<broj<<endl;
        broj++;
        return;
    }
    for(long long i =posledno;i<n;i++)
    {
 
        rec2(i,n,s*10LL+i,depth+1);
 
    }
}
 
void decode(int n,int howmany2,int a[]){
   broj = 0;
    rec(0,10,0,0);
    int to_be_output[321];
    for (int i =0;i<n;i++)
        to_be_output[i]=0;
    for(int i = 0;i<howmany2;i++)
    {
       int value = 0;
        int k = 0;
        for (int j = 0;j<3;j++)
        {
            if (a[i] %2==1)
                value+=1<<k;
            k+=1;
            a[i]=a[i]/2;
        }
        value = 1<<value;
        int position=0;
        k = 0;
        for (int j = 0;j<5;j++)
        {
            if (a[i] %2==1)
                position+=1<<k;
            k+=1;
            a[i]=a[i]/2;
        }
        to_be_output[position]+=value;
    }
 
    for(int i =0;i<n;i++)
        output(to_be_output[i]);
 
 
}

Compilation message

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:58:13: warning: unused variable 'x' [-Wunused-variable]
   58 |         int x = i;
      |             ^
# Verdict Execution time Memory Grader output
1 Correct 173 ms 14472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 826 ms 14500 KB Output is correct
2 Correct 823 ms 14256 KB Output is correct
3 Correct 832 ms 14564 KB Output is correct
4 Correct 833 ms 15016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 831 ms 14744 KB Output is correct
2 Correct 835 ms 14552 KB Output is correct
3 Correct 828 ms 14540 KB Output is correct
4 Correct 846 ms 14576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 826 ms 14512 KB Output is correct
2 Correct 837 ms 14532 KB Output is correct
3 Correct 836 ms 14512 KB Output is correct
4 Correct 828 ms 14552 KB Output is correct
5 Correct 825 ms 14764 KB Output is correct
6 Correct 831 ms 14544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 837 ms 14520 KB Output is partially correct - P = 8.000000
2 Partially correct 847 ms 14504 KB Output is partially correct - P = 8.000000
3 Incorrect 447 ms 14344 KB Error : Output is wrong
4 Incorrect 450 ms 14304 KB Error : Output is wrong
5 Incorrect 440 ms 14388 KB Error : Output is wrong
6 Incorrect 458 ms 14304 KB Error : Output is wrong
7 Incorrect 442 ms 14332 KB Error : Output is wrong