Submission #601424

#TimeUsernameProblemLanguageResultExecution timeMemory
601424vh50Parrots (IOI11_parrots)C++17
0 / 100
2 ms1052 KiB
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int N, int M[])
{
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < 4; j++)
        {
            int aux;
            if(i > 15)  i -= 16;   
            aux = (i << 4) + (j << 2);
            i += 16;
            aux += (M[i] & (3 << (2 * j))) >> (2 * j); 
            send(aux);
            if(i > 15) send(aux);
        }
    }
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[])
{
    int marc[300];
    vector <int> a, b;
    for(int i = 0; i < L; i++)  marc[X[i]]++;
    for(int i = 0; i < L; i++)
    {
        if(marc[X[i]] == 1) a.push_back(X[i]);
        if(marc[X[i]] == 2) b.push_back(X[i]); 
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    for(int i = 0; i < a.size(); i += 4)
    {
        int aux = 0, c = 0;
        for(int j = 0; j < 4; j++)
        {
            if(a[i + j] & 1)    aux += (1 << (2 * j)); 
            if(a[i + j] & 2)    aux += (1 << (2 * j + 1));
        }   
        output(aux); 
    }
    for(int i = 0; i < b.size(); i += 4)
    {
        int aux = 0, c = 0;
        for(int j = 0; j < 4; j++)
        {
            if(b[i + j] & 1)    aux += (1 << (2 * j)); 
            if(b[i + j] & 2)    aux += (1 << (2 * j + 1));
        }   
        output(aux); 
    }
}

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i = 0; i < a.size(); i += 4)
      |                    ~~^~~~~~~~~~
decoder.cpp:19:22: warning: unused variable 'c' [-Wunused-variable]
   19 |         int aux = 0, c = 0;
      |                      ^
decoder.cpp:27:22: 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 = 0; i < b.size(); i += 4)
      |                    ~~^~~~~~~~~~
decoder.cpp:29:22: warning: unused variable 'c' [-Wunused-variable]
   29 |         int aux = 0, c = 0;
      |                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...