Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
namespace Dango {
const int MAXN = 1005, INF = 0x3f3f3f3f;
struct number {
int num[MAXN], len;
void trans(string st) {
len = st.length();
for (int i = 1; i <= len; i++) num[i] = st[len - i] - '0';
}
} b[MAXN];
string a;
int n, len, c[15], num[MAXN], tmp[MAXN];... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rread(T& num) {
num = 0;
T f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getchar();
num *= f;
}
const lo... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e3 + 10;
const long long SGM = 10;
const long long INF = 1e15;
long long n, m, k;
long long P[MXN], t0[MXN], Sz[MXN];
long long dp[MXN][MXN], Ind[MXN][MXN], ps[MXN][MXN];
long long nxt[MXN][MXN][SGM], val[MXN][MXN][SGM];
string A, B[MXN], ext;
vector<... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
void out() {
cout.flush();
cerr << endl << "OUT" << endl;
int bred;
cin >> bred;
exit(0);
}
void updMax(int& x, int y) {
if (y > x) x = y;
}
int sum10(int x, int y) {
x += y;
if (x >= 10) x -= 10;
return x;
}
int cs[10];
int n, m;
string a, bs[1024];
int d... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int IN() {
int x = 0, f = 0, ch;
for (; (ch = getchar()) < '0' || ch > '9';) f = (ch == '-');
for (; ch >= '0' && ch <= '9'; (ch = getchar())) x = x * 10 + ch - '0';
return f ? -x : x;
}
int N, L, cost[15];
int A[1005], Len[1005], B[1005][1005];
int rk[1005], ID[100... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
pair<int, int> ord[1010];
int dp[1010][1010];
char a[1010], b[1010][1010];
int len[1010];
int val[1010], mxlen[1010];
int c[11];
int n, m, p = 1006;
int main() {
scanf("%s", a);
m = strlen(a);
reverse(a, a + m);
for (int i = m; i <= p; i++) a[i] = '0';
scanf("%d",... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 1000;
const int MAXN = 1000;
char s[MAXLEN + 1];
int slen;
int n;
char v[MAXN][MAXLEN + 1];
int vlen[MAXN];
int c[10];
int p[MAXLEN + 2][MAXN];
int dp[MAXLEN + 2][MAXN + 1];
bo... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
const int MAXN = 1010;
int C[10];
char buf[MAXN];
int arr[MAXN][MAXN], bse[MAXN];
int n, L;
int dp[MAXN][MAXN], rk[MAXN][MAXN];
int buc[10], cnt[10], suc[11];
int dig[MAXN];
void add(int x, int v) {
cnt[x] += v;
for (int i = 0; i < 10; ++i) buc[i] += v * C[(i + x) % 10];
}
void gma(int& x, ... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int iinf = 1e9 + 7;
const long long linf = 1ll << 60;
const double dinf = 1e60;
template <typename T>
inline void scf(T &x) {
bool f = 0;
x = 0;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') {
f = 1;
c = ge... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
char a[1100], b[1100][1100];
const int inf = 2000000000;
int c[1100], len[1100], f[1100][1100], sum[1100], ran[2][1100], to[1100],
d[1100], n, m, fr[1100];
int cal(int i) {
int j, res = 0;
for (j = len[i]; j > m; j--) res += c[b[i][j] - '0'];
return res;
}
void ad... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 7;
const int INF = (int)1e9;
void place(string &s, int len) {
while ((int)s.size() < len) {
s += "0";
}
assert((int)s.size() == len);
}
int len, n, cls[N][N], dp[N][N], ini, cost[11], kek[N];
string a, b[N];
vector<int> nums[N];
int what[N];
i... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int first = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar()) {
if (ch == '-') f = -1;
}
for (; isdigit(ch); ch = getchar()) {
first = first * 10 + ch - 48;
}
return first * f;
}
const int mxN = 1000;
int n, m, ic;... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int A[1002], LA;
int B[1000][1002], LB[1000];
int C[10];
int M, N;
int T[4][1002];
constexpr auto Z = sizeof(T[0]);
void Read(int *D, int &L) {
static char H[1001];
scanf("%s", H);
int m = (int)strlen(H);
for (int i = 0; i < m; ++i) D[m - i - 1] = H[i] == '?' ? -1 :... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
string S;
int N, M;
string sv[2020];
int sortpos[1010][1010];
long long best[2020][2020];
vector<int> sr[2020];
int SP;
int cif[22];
int getd(int x, int pos) {
--pos;
if (sv[x].size() <= pos) {
return 0;
}
return sv[x][pos] - '0';
}
int cmp(int x, int y) {
int... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 5000;
int n, c[20];
char a[N], str[N];
string b[N];
int add(int x, int y) {
if (x == -1) {
return y == 0 ? -1 : y;
} else {
return x + y;
}
}
string read() {
scanf("%s", str);
return str;
}
int main() {
scanf("%s %d", a, &n);
int l = strl... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int dp[N][N], n, m, k;
int f[N], g[N], a[N], len[N], b[N][N], cnt[10], val[10];
char s[N];
int main() {
scanf("%s", s);
n = k = strlen(s);
for (int i = 1; i <= n; i++) a[i] = s[n - i] - '0';
scanf("%d", &m);
for (int i = 1; i <= m; i++) {
s... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int const M = 1000 + 10, M2 = 1e3 + 10, mod = 1e9 + 7, inf = 1e9 + 10;
string y[M], x;
int dp[M][M], val[M], ran[M][M], now, st[M], f[M][10], ind[M], n, bad,
ind2[M][M], siz[M], carry[M];
int last[10], cnt[10];
bool cmp(int a, int b) {
if (y[a][now] != y[b][now]) retu... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int n;
std::string a;
std::cin >> a >> n;
auto maxlen = a.size();
std::vector<std::string> b(n);
for (auto& x : b) {
std::cin >> x;
maxlen = std::max(maxlen, x.size());
}
std::array<int, 10> cost;
for (aut... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
struct BigNumber {
int s[maxn], siz;
int &operator[](int x) { return s[x]; }
} A, B[maxn];
char str[maxn];
int n, m, c[maxn], g[maxn], ss[maxn];
int f[maxn][maxn], sa[maxn][maxn];
void get(BigNumber &A) {
scanf("%s", str);
while (str[A.siz]) +... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1100;
int n, dp[N][N], m, ord[N][N], sum[15], pos[15], vi[N];
int len[N], c[15];
char a[N], b[N][N];
pair<int, int> sh[N];
vector<int> t[10];
inline int read() {
int f = 1, x = 0;
char s = getchar();
while (s < '0' || s > '9') {
if (s == '-') f = -1;... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int IN() {
int c, f, x;
while (!isdigit(c = getchar()) && c != '-')
;
c == '-' ? (f = 1, x = 0) : (f = 0, x = c - '0');
while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - '0';
return !f ? x : -x;
}
const int N = 1000 + 19;
long long f[N][N], res;
int... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int rk[1015][1015];
int sa[1015][1015];
int tr[1015][1015], tl[1015];
int nx[1015][10];
int w[1015][10];
int ra[1015], rl;
char inp[1015];
int dp[1015][1015];
vector<int> read() {
scanf("%s", inp);
int l = strlen(inp);
vector<int> res(l);
for (int i = 0; i < l; i++)... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 3;
int a[N], m[N], b[N][N], v[10], id[N * 10], nxt[N * 10], sr[N * 10][10],
sl[N * 10][10], dp[N][N];
vector<int> vec[N], vec2[N * 10];
int main() {
static char s[N], t[N];
int n;
scanf("%s%d", s, &n);
int l = strlen(s);
for (int j = 1; j <... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1010;
string a, s[N];
int c[N], dp[N][N], ssz[N], n, mx, asz;
pair<int, int> rad[N];
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
memset(dp, -63, sizeof dp);
cin >> a >> n, asz = mx = a.size();
for (int i = 0; i < n; i+... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 7;
const int INF = (int)1e9;
void place(string &s, int len) {
while ((int)s.size() < len) {
s += "0";
}
assert((int)s.size() == len);
}
int len, n, cls[N][N], dp[N][N], ini, cost[11], kek[N];
string a, b[N];
vector<int> nums[N];
int what[N];
i... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
long long res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
return res;
}
const int N = 1010, M = 1002;
long long dp[N][N];
char a[N], b[N]... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1010;
char a[N], b[N][N];
int c[N], f[N][N], id[N], tot[N][11], len[N];
vector<int> tmp[10];
void upd(int &a, int b) {
if (b == -1) return;
a = (a == -1 || b > a) ? b : a;
}
int main() {
scanf("%s", a);
int al = strlen(a);
reverse(a, a + al);
int n... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1000 + 20;
const int N = 1000 + 6;
string b[MAXN], s;
int n, a[MAXN], cnt[MAXN], dp[MAXN], pre[MAXN], ord[MAXN], c[MAXN], A[MAXN];
char ch[MAXN];
void rad_sort(int sz) {
memset(c, 0, sizeof(c));
for (int i = 0; i < n; i++) {
ch[i] = (b[A[i]].siz... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 20;
string A, s[maxn];
int cost[maxn], dp[maxn][maxn], last[maxn];
pair<int, int> srt[maxn];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> A;
int n, m = A.size();
cin >> n;
for (int i = 0; i < maxn; i++)
... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int maxlen = 1005;
char temp[maxlen];
int a[maxlen], b[maxn][maxlen];
int n, c[maxn], f[2][maxn], lena, len[maxn], cur, sz[10], lenmax;
int rk[2][maxn], pos[2][maxn];
int main() {
int i, j, ans, num, jinwei;
scanf("%s%d", temp, &n);
for (i... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void in(T &x) {
x = 0;
char c = getchar();
bool f = 0;
while (!isdigit(c)) f |= (c == '-'), c = getchar();
while (isdigit(c)) x = x * 10 + (c ^ '0'), c = getchar();
f ? x = -x : 0;
}
template <class T>
inline void out(T x, const char c ... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1010;
int len_a, n, len_b[MAX], mx_len_b;
int c[10], cnt[10], pos[10];
int now[MAX], later[MAX], inv[MAX];
int add[MAX], f[MAX][MAX], res;
char a[MAX], b[MAX][MAX];
void read() {
scanf("%s %d", a, &n);
len_a = strlen(a);
a[len_a++] = '0';
reverse(a, ... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long dp[1010][1010], n, m, k;
long long f[1010], g[1010], a[1010], len[1010];
long long b[1010][1010], cnt[10], val[10];
char s[1010];
int main() {
scanf("%s", s);
n = k = strlen(s);
for (long long i = 1; i <= n; i++) a[i] = s[n - i] - 48;
scanf("%I64d", &m);
... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = (1LL << 62);
const int inf = (1 << 30);
const long long nmax = 1e3 + 50;
const int mod = 1e9 + 7;
using namespace std;
int n, sz, ... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
char p[1010];
int w[1010], L, n, P[1010][1010], m, Rank[1010], Len[1010];
int D[1010][1010], SS[10], CC[10];
struct A {
int a, num;
bool operator<(const A &p) const { return a < p.a; }
} ord[1010];
int score[10];
void Ins(int a, int pv, int b, int ck) {
int i;
for (... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int n, dim, i, j, global, d1;
char s[1024];
int patt[1024], dd[1024];
int nr[1024][1024];
int cost[11];
long long dp[1024][1024];
vector<int> radix[11], ord;
int cnt[11];
void rev(char* a, char* b) {
while (a < b) {
swap(*a, *b);
a++;
b--;
}
}
int main() {
... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int cost[12], N, M, INF = 1e9 + 10, oldDp[1009], dp[1009], cif[1009][1009],
cuT[1009], faraT[1009], l[1009], oldPos[1009], ap[1009][11];
char sir[1009], curr[1009];
pair<int, int> ord[1009], old[1009];
bool mtch(int i, int j) {
if (sir[i] == '?') {
... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
char s[maxn], tmp[maxn];
int x[maxn][maxn], f[maxn][maxn];
int len[maxn];
int rk[maxn][maxn], sa[maxn][maxn];
int v[maxn];
int c[11];
int n, m, l;
void sort() {
for (int i = 1; i <= n; ++i) sa[0][i] = i;
for (int i = 1; i <= m; ++i) {
mems... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int m, n[N], len[N], a[N][N], W[10], c[10], now[N], pre[N], f[N], dp[N][N], ans;
char s[N];
int main() {
scanf("%s%d", s, &m), len[0] = strlen(s);
for (int i = 1; i <= len[0]; i++)
n[i] = s[len[0] - i] == '?' ? -1 : s[len[0] - i] - '0';
for (in... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1005;
template <typename T>
inline void read(T &AKNOI) {
T x = 0, flag = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') flag = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = x * 10 + ch - '0';
ch = getchar();
}
AKN... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int n, len, cnt, rankk[2020], RANK[2020], h[2020], num[2020], dp[2020][2020],
c[15], ans;
char st[2020];
int a[2020], b[2020][2020], l[2020], S[2020];
inline void solve(int x, int val) {
int maxx = 0, sum = 0;
for (int i = 1; i <= n; i++) {
num[i] = b[i][x] + va... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1024;
char a0[N], a[N], b0[N][N], b[N][N];
int c[16], n, len, la, p0;
bool ban[N][N];
void init(char *s0, char *s, bool *ban) {
int x = strlen(s0 + 1), p = len - x + 1;
for (int i = 1; i <= p - 1; ++i) s[i] = 0, ban == NULL ? 0 : ban[i] = i < p0;
for (in... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
char s[1300];
char t[1300][1300];
int f[1300][1300];
int len[1300], maxx, n;
vector<int> v[1300][1300];
int a[13], pp[1300];
int nn[1300], ll;
int cc(char x, int d, int b, int c) {
if (x == '-' && d == 0 && b >= c)
return 0;
else if (x == '-')
return a[d % 10];
... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int L, n;
char s[1111];
int ls;
char a[1111][1111];
int l[1111];
int id[1111], id2[1111];
int dp[1111][1111];
int ct[11], pt[11];
int cst[11];
int tmp1[11], tmp2[11];
int get_dig(int i, int j) {
if (j >= l[i]) return 0;
return a[i][j] - '0';
}
int main() {
scanf("%s%d... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 1010;
char a[N], b[N][N];
int c[N], f[N][N], id[N], tot[N][11], len[N];
vector<int> tmp[10];
void upd(int &a, int b) {
if (b == -1) return;
a = (a == -1 || b > a) ? b : a;
}
int main() {
scanf("%s", a);
int al = strlen(a);
reverse(a, a + al);
int n... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int N = 1010;
char s[N][N], a[N];
int len[N], n, mx, len1;
inline void Max(int &a, int b) {
if (b > a) a = b;
}
inline void Max(long long &a, long long b) {
if (b > a) a = b;
}
int c[10], Rank[N], Rank2[N], h[N], C[10];
long long f[N], ... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 5;
const int MAXM = 1e3 + 5;
const int MAXL = MAXN * MAXM;
const int inf = 0x3f3f3f3f;
namespace SA {
int _rnk1[MAXL], _rnk2[MAXL];
int sa[MAXL], *rnk = _rnk1, *lst_rnk = _rnk2, sa_k;
inline bool sa_same(int x, int y) {
return lst_rnk[x] == lst_rnk[... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1005, maxD = 10, oo = 1e9;
int Len, dp[maxN][maxN];
int t[maxN][maxN], s[maxN], tool[maxN];
int n, perm[maxN], cost[maxD], cnt[maxN][maxD], lost[maxN];
bool flag = 0;
inline void solve(int i, int j, int d) {
int jp = 0, sum = 0;
for (int d2 = 0; d2 < ma... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
int n, m;
int len[(1010)], val[(1010)], mxl[(1010)], cost[(1010)], dp[(1010)][(1010)];
char a[(1010)], b[(1010)][(1010)];
std::pair<int, int> lab[(1010)];
int main() {
scanf("%s", a);
m = strlen(a);
std::reverse(a, m + a);
for (int i = m; i < (1002) + 1; ++i) {
a[i] = '0';
}
sca... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int kN = 2000;
const int kD = 10;
int add[kN];
int arr[kN][kN];
int dp[kN][kN];
int costs[kN];
int sizes[kN];
vector<int> orders[kN];
string inc;
void ComputeOrder(int n) {
vector<int> order(n);
for (int i = 0; i < n; ++i) {
order[i] = i;
}
reverse(order.b... | CPP |
778_E. Selling Numbers | Boris really likes numbers and even owns a small shop selling interesting numbers. He has n decimal numbers Bi. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values cd, where cd is the cost of the digit d. Of course, Boris is interested in that numbers he owns have the max... | 2 | 11 | #include <bits/stdc++.h>
const int maxn = 1002, maxm = 1003;
int n, m, C[10], dp[maxm][maxn], len[maxn], od[maxn];
char A[maxm], B[maxn][maxm];
void fillRev(char *k, int l) {
for (int i = 0; i * 2 < l; ++i) std::swap(k[i], k[l - i - 1]);
for (int i = 0; i < maxm; ++i)
if (!k[i]) k[i] = '0';
}
void init() {
m ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
struct Node {
Node() {}
Node(string s, string p) : s(s), p(p) {}
string s, p;
} a;
int i, j, k, n, m;
char c;
inline Node Solve(int n) {
Node Tmp;
if (n == 1) {
c = 'a';
return Node("a", "a");
}
if (n == 2) {
c = 'b';
return Node("abb", "ab");
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
cout << x << endl;
exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int dp[25][25];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
string s = "a... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
vector<int> v;
void build(int n) {
v.push_back(n);
if (n == 1) return;
n--;
if (n % 4 == 0) {
build(n / 4);
return;
}
if (n % 3 == 0) {
build(n / 3);
return;
}
if (n % 2 == 0) {
build(n / 2);
return;
}
build(n);
}
int build_exampl... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
string nxt(string x) {
string ans = "";
if (x.at(0) == 'z') {
ans.push_back('A');
return ans;
} else {
ans.push_back(1 + x.at(0));
return ans;
}
}
pair<string, string> fun(int n) {
if (n == 1) {
return make_pair("a", "a");
}
if (n == 2) {
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, tt = 0;
string a, b;
void cal(int n) {
if (n == 1) {
a = "", b = ('a' + tt), tt++;
return;
}
if (n == 2) {
char c = 'a' + tt;
tt++;
a = b = c;
return;
}
if (n % 2) {
cal((n - 1) / 2);
char c = 'a' + tt;... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(T &x) {
char c = getchar();
bool f = 0;
x = 0;
while (!isdigit(c)) f |= c == '-', c = getchar();
while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
if (f) x = -x;
return x;
}
template <typename T, typename... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
for (int i(0); i < N; i++) scanf("%d", A + i);
}
int C[(1000002)], N;
vector<int> v;
bool rec(int u) {
if (u >= N) return u == N;
if (C[u]++) return 0;
for (int k(1); k < 5; k++)
if (rec(u * 2 + k)) return v.push_back(k), 1;
return 0;
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int c[65][5];
int n;
int cnt[65];
int main() {
c[0][0] = 1;
for (int i = 1; i <= 60; i++) {
c[i][0] = 1;
for (int j = 1; j <= 4; j++) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
}
scanf("%d", &n);
for (int i = 60; i >= 4; i--) {
while (n >= c[i][4]) {
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
return x * x;
}
long double pi = 3.1415926535897932384626433832795;
long long mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long _gcd(long long a, long long b, long long& x, long long& y) {
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
string chars;
void A(string& s, int x) { s.insert(s.begin() + x, chars[x]); }
void B(string& s, int x) { s.push_back(chars[x]); }
pair<string, int> build(int n) {
if (n <= 3) {
string res = "";
for (int i = 0; i < n; i... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n;
char now;
string s, t;
inline void solve(int len) {
if (len == 1) {
s = "";
t = "a";
now = 'a';
return;
}
if (len == 2) {
s = "b";
t = "ab";
now = 'b';
return;
}
if (len & 1) {
solve(len / 2);
now++;
s = s +... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int n, m = 3, l, c[20000];
char s[500];
int main() {
cin >> n;
while (c[m] <= n) m++, c[m] = (long long)m * (m - 1) * (m - 2) * (m - 3) / 24;
for (int i = m - 1; i >= 1; i--) {
while (c[i] >= 1 && n >= c[i]) {
s[++l] = 'a';
n -= c[i];
}
s[++l] ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
string s1 = "a";
string s2 = "";
string s3 = "";
long long k = 1;
void f(long long n) {
if (n == 2) {
s3 = s3 + "a";
return;
}
if (n == 1) return;
if (n % 2 == 0) {
f((n - 2) / 2);
char p = k + 'a';
s1 = s1 + p;
s2 = p + s2;
s3 = s3 + p +... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n;
long long dp[57];
long long ile[57];
long long dwumian(long long a, long long b) {
long long res = 1;
for (long long i = a - b + 1; i <= a; ++i) {
res *= i;
}
for (long long i = 1; i <= b; ++i) {
res /= i;
}
return res;
}
int32_t main() {
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int getlen(int b) {
int ans = 0;
while (b) {
ans++;
b >>= 1;
}
return ans;
}
string p, s;
void slove(int now, int deep) {
string cnt;
cnt += ((char)('a' + deep));
if (now == 1) {
p = s = cnt;
return;
} else if (now ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int N, ch[190][10], num[55], cost[1100100], f[1100100];
bool ok(string a, string b, int req) {
int A = (int)a.size(), ans = 0;
for (int i = (0); i < (A); i++)
for (int j = (i + 1); j < (A); j++)
for (int k = (j + 1); k < (A); k++)
for (int l = (k + 1);... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
char nxt(char c) { return c == 'z' ? 'A' : c + 1; }
string roll(int len) {
if (len == 1) {
return "a";
} else if (len == 2) {
return "abb";
}
bool even = len % 2 == 0;
if (even) {
len--;
}
string s = roll(len / 2);
string p = "";
for (char c = ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
int C[1000][1000];
void init() {
for (int i = 0; i < 1000; ++i) C[i][0] = 1;
for (register int i = 1; i < 1000; ++i)
for (register int j = 1; j < 1000; ++j)
C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
int cnt = 0, mxneed;
for (int i = 3; i <= 100; ++i) {
cnt = 0, mxneed = 0;
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
ifstream in("cf.in");
ofstream out("cf.out");
int cnt[1010];
int main(void) {
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
int n;
cin >> n;
if (n == 0) {
cout << "a b";
return 0;
}
if (n == 1) {
cout << "a a";
return 0;
}
if (n == ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int jilu[12], n, i, j, cnt;
int main() {
scanf("%d", &n);
while (n >= 92378) {
jilu[10]++;
n -= 92378;
}
while (n >= 48620) {
jilu[9]++;
n -= 48620;
}
while (n >= 24310) {
jilu[8]++;
n -= 24310;
}
while (n >= 11440) {
jilu[7]++;
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
string gen(int n) {
if (n == 1) return "A";
string t;
if (n & 1) {
int m = n / 2;
string s = gen(m);
char c = *max_element(s.begin(), s.end());
int pos;
if (islower(c))
pos = 26 + c - 'a' + 1;... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n, k;
string s, p, mau = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
cin >> n;
if (n <= 200) {
for (int i = 0; i < n; i++) cout << 'a';
cout << " " << 'a' << endl;
} else {
k = 0;
while (--n) {
if (n % 2 != 0)
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const long long ool = (long long)1e18;
const int oo = (int)1e9 + 7;
const int N = (int)1e5 + 1;
const int N6 = (int)1e6 + 1;
const int N3 = (int)1e3 + 1;
const int N4 = (int)1e4 + 1;
const long double EPS = 1e-6;
int cntbit(int s) { return __builtin_popcount(s); }
int getbi... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | a="wertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
ans1="q"
ans2="q"
n=input()
s=[]
while n>2:
s.append(n&1)
n=(n-1)/2
s=s[::-1]
if n==2:
ans1="qww"
ans2="qw"
a=a[1:]
for i in s:
ans1 = ans2 + ("" if i else a[0]) + a[0] + ans1[len(ans2):] + a[0] + a[0]
ans2 += a[0]
a = a[1:]
print a... | PYTHON |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:160777216")
using namespace std;
FILE *inp, *out;
char *geolymp = "GEOLYabcdefghijkMP";
int d[10000];
int getcount(string &s) {
int n = s.size();
int i, j, k, m;
for (i = 0; i < s.size(); i++) d[i] = 0;
for (i = 0; i < s.size(); i++)
if (s[i] == 'G') ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
string ans1, ans2;
string get(string s, int n) {
if (n == 0) return "";
ans2 += s;
string tmp;
if (n == 1) return tmp + s;
if (n == 2) return tmp + s + s;
tmp += s + s;
string ss = s;
ss[0]++;
tmp += get(ss, (n >> 1) - 1);
if (n & 1) tmp += s;
return t... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int R;
vector<int> hv, use;
vector<char> ans;
int req[1000005];
int fr[1000005];
int main() {
int n;
scanf("%d", &n);
if (n >= 1389)
R = 4;
else if (n >= 232)
R = 3;
else if (n >= 199)
R = 2;
else if (n >= 2)
R = 1;
else {
printf("a a\n");
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int n;
string res;
string res2;
int bit[60];
int val[51];
int main(void) {
scanf("%d", &n);
if (n == 1) {
printf("a a\n");
return 0;
}
if (n == 2) {
printf("aa a\n");
return 0;
}
int i = 0;
int v = n;
while (v > 0) {
val[i] = v;
i++;
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
char newLetter = 'b';
string p = "a";
string u;
void calc(int n) {
if (n == 1) return;
if (n == 2) {
u = "a";
return;
}
if (n % 2 == 1) {
calc(n / 2);
p += newLetter;
u += newLetter;
u += newLetter;
newLetter == 'z' ? newLetter = 'A' : ne... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T>
inline void gmax(T &a, T b) {
if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T b) {
if (b < a) a = b;
}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647,
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int N = 205, M = 100005, mod = 1e9 + 7;
template <class T>
inline void gmin(T &x, const T &y) {
if (x > y) x = y;
}
template <class T>
inline void gmax(T &x, const T &y) {
if (x < y) x = y;
}
inline void ch(int &x, int y) { x = (x + y) % mod; }
template <class T>
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long c[710], f[710];
inline long long C(int x, int y) {
long double ret = 1;
for (int i = 1; i <= x - y; i++) ret = ret * (i + y) / i;
return (long long)(ret + 0.1);
}
int main() {
long long k;
cin >> k;
for (int i = 1; i <= 700; i++) f[i] = C(i + 6, 7);
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
inline int in() {
int x;
scanf("%d", &x);
return x;
}
inline void priv(vector<int> a) {
for (int i = 0; i < ((int)(a).size()); ++i)
printf("%d%c", a[i], i == (int)(a).size() - 1 ? '\n' : ' ');
}
template <typename T>
istream& operator>>(istream& i, vector<T>& v)... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n;
char aa;
string a, q;
inline long long read() {
long long x = 0;
bool f = 0;
char ch = getchar();
for (; !isdigit(ch); ch = getchar()) f ^= (ch == '-');
for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
return f ? -x : x;
}
in... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using LL = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename S>
using P = pair<T, S>;
using LD = long double;
template <typename T, typename S>
void check(T& a, const S& b) {
if (a >= b) {
a %= b;
}
}
tem... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
const int N = 80;
int cnt[N];
int main() {
int n;
scanf("%d", &n);
int k = N;
while (n) {
while (k * (k - 1) * (k - 2) * (k - 3) / 24 > n) k--;
n -= k * (k - 1) * (k - 2) * (k - 3) / 24;
cnt[k]++;
}
for (int i = 1; i < N; i++) {
printf("a");
while (cnt[i]--) prin... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int findHighest(int x) {
for (int bit = 25; bit >= 0; bit--) {
if (((x >> bit) & 1) == 1) return bit;
}
}
bool used[MAXN];
pair<string, string> ans[MAXN];
void update(int k, char c, string p, string u) {
ans[k] = {p, u};
if (2 * k + 1 <... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ptr = 0;
string s = "", p = "";
while (n > 1) {
--n;
if (n & 1) {
s += char('A' + ptr);
p += char('A' + ptr);
ptr++;
if (ptr == 26) ptr = 'a' - 'A';
} else {
s += char('A' + ptr);
s ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
uniform_int_distribution<long long> uid(l, r);
return uid(rng);
}
const int N = 1e6 + 5;
bitset<N> b[205];
signed main() {
ios::sync_with_stdio(0);
cin.ti... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | def rek(k):
if k == 1:
return ('a', 'a')
elif k == 2:
return ('aa', 'a')
s, p = rek((k - 1) // 2)
x = chr(ord(p[-1]) + 1)
return (p + x * (2 - k % 2) + s[len(p):] + 2 * x, p + x)
s, p = rek(int(input()))
print(s, p)
| PYTHON3 |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n;
char letter;
string q, w;
inline long long read() {
long long ret = 0, ff = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') ff = -ff;
ch = getchar();
}
while (isdigit(ch)) {
ret = ret * 10 + ch - '0';
ch = getchar();
}
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long n, cc[26], cnt[26];
int main() {
ios::sync_with_stdio(false);
cin >> n;
cc[8] = 1;
for (int i = (9); i <= (25); i++) cc[i] = cc[i - 1] * i / (i - 8);
for (int i = (25); i >= (8); i--) {
cnt[i] = n / cc[i];
n %= cc[i];
}
for (int i = (0); i <=... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 2e5 + 5, LG = 17, MOD = 998244353;
const int SQ = 450;
const long double EPS = 1e-7;
int get(int n) { return n * (n - 1) * ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
string p = "a", u = "";
char now = 'a';
inline void sol(int x) {
if (x == 1) return;
if (x == 2) {
u = "a";
return;
}
if (x & 1) {
sol((x - 1) >> 1);
++now;
u = u + now + now;
p = p + now;
} else {
sol((x - 2) >> 1);
++now;
u = ... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int n;
char t[11] = "aaaab";
int c[111];
int cnt[111];
int main() {
for (int i = 4; i < 111; i++) c[i] = i * (i - 1) * (i - 2) * (i - 3) / 24;
scanf("%d", &n);
while (n) {
int k = lower_bound(c + 1, c + 111 - 1, n + 1) - c;
k--;
n -= c[k];
cnt[k]++;
... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
const int INF = 1e9 + 10;
template <typename T>
using MinPQ = priority_queue<T, vector<T>, greater<T>>;
char Convert(int x) {
if (x < 26) return x + 'a';
return x - 26 + 'A';
}
void Solve() {
int n;
scanf("%d", &n);
vector<int> head, tail... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
int n;
char now;
string s1, s2;
void solve(int l) {
if (l == 1) {
s1 = "";
s2 = "a";
now = 'a';
return;
}
if (l == 2) {
s1 = "b";
s2 = "ab";
now = 'b';
return;
}
if (l % 2 == 0) {
solve(l / 2 - 1);
now++;
s1 = now + s1 +... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | #include <bits/stdc++.h>
using namespace std;
long long h[10], f[1010], n, c[1000];
int main() {
scanf("%lld", &n);
for (int i = 1; i <= 200; ++i) {
if (i % 5 == 1)
++h[1];
else
h[i % 5] += h[(i + 4) % 5];
if (i % 5 == 0) f[i / 5] = h[0];
}
for (int i = 40; i; --i) f[i] -= f[i - 1];
fo... | CPP |
802_H. Fake News (medium) | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 2 | 14 | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, Iβm sorry, but shit, I have no fcking inter... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.