Submission #915094

#TimeUsernameProblemLanguageResultExecution timeMemory
915094quanlt206Parrots (IOI11_parrots)C++17
34 / 100
1 ms1460 KiB
#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 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...