Submission #915094

# Submission time Handle Problem Language Result Execution time Memory
915094 2024-01-23T10:33:27 Z quanlt206 Parrots (IOI11_parrots) C++17
34 / 100
1 ms 1460 KB
#include "encoder.h"
#include "encoderlib.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, b, a) for (int i = (b); i >= (a); i--)
#define all(x) begin(x), end(x)
#define MASK(x) (1LL << (x))
#define SQR(x) (1LL * (x) * (x))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;

template<class A, class B>
    bool maximize(A& x, B y) {
        if (x < y) return x = y, true; else return false;
    }
template<class A, class B>
    bool minimize(A& x, B y) {
        if (x > y) return x = y, true; else return false;
    }
/* END OF TEMPLATE */

string Convert(int x, int len) {
    string res = "";
    if (x == 0) res = "0"; else
        while (x > 0) {
            res+=char(x % 10 + '0');
            x/=10;
        }
    while ((int)res.size() < len) res+="0";
    reverse(all(res));
    return res;
}

int Convert(string s) {
    int res = 0;
    for (auto x : s) res = res * 10 + x - '0';
    return res;
}

void encode(int n, int m[]) {
    REP(i, 0, n) {
        string idx = "";
        string code = "";
        if (i <= 9) idx = "3" + Convert(i, 1); else idx = Convert(i, 2);
        code = idx + Convert(m[i], 3);
        send(Convert(code));
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, b, a) for (int i = (b); i >= (a); i--)
#define all(x) begin(x), end(x)
#define MASK(x) (1LL << (x))
#define SQR(x) (1LL * (x) * (x))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;

template<class A, class B>
    bool maximize(A& x, B y) {
        if (x < y) return x = y, true; else return false;
    }
template<class A, class B>
    bool minimize(A& x, B y) {
        if (x > y) return x = y, true; else return false;
    }
/* END OF TEMPLATE */

string Convert(int x, int len) {
    string res = "";
    if (x == 0) res = "0"; else
        while (x > 0) {
            res+=char(x % 10 + '0');
            x/=10;
        }
    while ((int)res.size() < len) res+="0";
    reverse(all(res));
    return res;
}

int Convert(string s) {
    int res = 0;
    for (auto x : s) res = res * 10 + x - '0';
    return res;
}

void decode(int n, int L, int x[]) {
    int res[30];
    REP(i, 0, n) {
        string a = Convert(x[i], 5);
        if (a[0] == '3') res[a[1] - '0'] = Convert(a.substr(2, 3)); else
        res[Convert(a.substr(0, 2))] = Convert(a.substr(2, 3));
    }
    REP(i, 0, n) {
      output(res[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1308 KB Output is correct
2 Correct 1 ms 1316 KB Output is correct
3 Correct 1 ms 1460 KB Output is correct
4 Correct 1 ms 1308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 784 KB Error : Bad encoded integer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 784 KB Error : Bad encoded integer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 784 KB Error : Bad encoded integer
2 Incorrect 1 ms 824 KB Error : Bad encoded integer
3 Incorrect 0 ms 796 KB Error : Bad encoded integer
4 Incorrect 1 ms 780 KB Error : Bad encoded integer
5 Incorrect 1 ms 792 KB Error : Bad encoded integer
6 Incorrect 0 ms 792 KB Error : Bad encoded integer
7 Incorrect 1 ms 784 KB Error : Bad encoded integer