Submission #849910

#TimeUsernameProblemLanguageResultExecution timeMemory
849910AndreyParrots (IOI11_parrots)C++14
81 / 100
5 ms1568 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void encode(int n, int m[])
{
    vector<int> bruh(0);
    for(int i = 0; i < n; i++) {
        for(int j = 7; j >= 0; j--) {
            if((1 << j)&m[i]) {
                bruh.push_back(1);
            }
            else {
                bruh.push_back(0);
            }
        }
    }
    int br = 0;
    for(int i = 0; i < bruh.size(); i++) {
        if(bruh[i] == 0 && br < 256) {
            send(br);
        }
        else {
            br++;
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;

void decode(int n, int l, int x[])
{
    vector<int> br(256);
    for(int i = 0; i < l; i++) {
        br[x[i]]++;
    }
    vector<int> bruh(0);
    for(int i = 0; i < 256; i++) {
        for(int j = 0; j < br[i]; j++) {
            bruh.push_back(0);
        }
        bruh.push_back(1);
    }
    for(int i = 0; i < 10000; i++) {
        bruh.push_back(0);
    }
    int sb = 0;
    for(int i = 0; i < n; i++) {
        sb = 0;
        for(int j = i*8; j < (i+1)*8; j++) {
            sb*=2;
            sb+=bruh[j];
        }
        output(sb);
    }
}

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i = 0; i < bruh.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
#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...