# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104479 | M_W_13 | Parrots (IOI11_parrots) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int dp[11][5];
void preprocess() {
rep(j, 4) {
dp[10][j] = 4 - j;
}
for (int i = 9; i >= 1; i--) {
rep(j, 4){
dp[i][j] = 0;
for (int c = j; c < 4; c++) {
dp[i][j] += dp[i + 1][c];
}
// cout << "i = " << i << " j = " << j << " dp = " << dp[i][j] << '\n';
}
}
rep(i, 11) {
dp[i][4] = 0;
}
// cout << "KON" << endl;
}
void encode(int n, int T[])
{
preprocess();
rep(i, n) {
int pot = 1 << 6;
int it = 1;
while (it <= 10) {
int c = 3;
while (dp[it][c] <= T[i]) {
c--;
}
// cout << "c = " << c << " x = " << i + pot * c << endl;
T[i] -= dp[it][c + 1];
send(i + pot * c);
it++;
}
// cout << "WTH" << endl;
}
}