# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
915093 | quanlt206 | 앵무새 (IOI11_parrots) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#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 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));
}
}
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]);
}
}
#include "encoder.h"
#include "encoderlib.h"
#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 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));
}
}
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]);
}
}