Submission #261093

#TimeUsernameProblemLanguageResultExecution timeMemory
261093Toirov_SadiParrots (IOI11_parrots)C++17
17 / 100
2 ms1536 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 ++){
        string s = to_string(i + 1);
        string t = to_string(M[i]);
        reverse(t.begin(), t.end());
        while((int)t.size() < 3) t += '0';
        reverse(t.begin(), t.end());
        reverse(s.begin(), s.end());
        while((int)s.size() < 2) s += '0';
        reverse(s.begin(), s.end());
        s += t;
        int x = 0;
        for(int j = 0; j < (int)s.size(); j ++){
            x = x * 10 + (s[j] - '0');
        }
        send(x);
    }
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"

using namespace std;

void decode(int N, int L, int X[]){
    vector<string> a;
    for(int i = 0; i < L; i ++){
        a.push_back(to_string(X[i]));
    }
    sort(a.begin(), a.end());
    for(int i = 0; i < L; i ++){
        string s =  a[i];
        while((int)s.size() > 3) s.erase(s.begin());
        int x = 0;
        for(int j = 0; j < (int)s.size(); j ++){
            x = x * 10 + (s[j] - '0');
        }
        output(x);
    }
}
#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...