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 |
|---|---|---|---|---|---|
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, ans;
long long f[100100][111];
bool can[100100][111];
int m, a[111], vis[111];
long long doit(long long x, int st) {
if (x < 100100 && can[x][st]) {
return f[x][st];
}
long long rt = x;
for (int i = st; i <= m; i++) {
rt -= doit(x / a[i], i + 1)... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int Limit = 410000;
long long N;
int dp[111][Limit + 11];
int K, s[110];
long long go(int k, long long n) {
if (k == 0) return n;
if (n < Limit && dp[k][n] != -1) return dp[k][n];
long long res = go(k - 1, n) - go(k - 1, n / s[k - 1]);
if (n < Limit) dp[k][n] ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long f[101][50001];
int a[101];
long long solve(long long n, int k) {
if (k < 0 || !n) return n;
if (n < 50001 && f[k][n] != -1) return f[k][n];
long long ret = solve(n, k - 1) - solve(n / a[k], k - 1);
if (n < 50001) f[k][n] = ret;
return ret;
}
int main() {... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100, MAX_M = 100001;
int n;
int a[MAX_N];
long long m, dp[MAX_N][MAX_M];
long long dfs(int k, long long m) {
if (k >= n || m == 0) {
return m;
}
if (m < MAX_M && dp[k][m] != -1) {
return dp[k][m];
}
long long ret = dfs(k + 1, m) - dfs(k +... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
long long n, res = 0, val;
int k, nums[104];
int dp[101][500001];
long long calc(long long n, int k) {
if (k == -1 || n == 0) return n;
if (n <= 500000 && dp[k][n] != -1) return dp[k][n];
long long val = calc(n, k - 1) - calc... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 1e5 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
long long n;
int k;
int a[100];
int b[100][MAXN];
inline long long get_ans(int i, long long N) {
if (N == 0) return 0;
if (i >= k) return N;
if (N < MAXN && b[i][N] != -1) return b[i][N];
long long res = get_ans(i + 1, N) - get_ans(i + 1, N ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 500050;
const int INF = 500050;
long long n, m;
int ans;
long long ma[110];
int dp[110][N];
long long get(long long x, int y) {
long long t;
if (!x) {
return 0;
}
if (y == m) {
return x;
}
if (x < INF && dp[y][x] >= 0) {
return dp[y][x]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);
int as[110];
long long memo[100][50000];
long long calc(long long n, int pos) {
if (n < 50000 && memo[pos][n] != -1) {
return memo[pos][n];
}
long long v = n / as[pos];
long long ret = v;
if ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int maxN = 5000;
const int maxD = 100000;
long long n, m;
long long p[maxN];
long long res = 0;
long long dp[110][maxD];
long long rec(int index, long long n) {
if (index < 0) {
return n;
}
if (n < maxD) {
if (... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
long long list[500];
long long dp[50000][100];
long long calc(long long n, int k) {
if (n == 0) return 0;
if (k == 0) return n;
if (n < 50000)
return dp[n][k] == -1
? dp[n][k] = calc(n, k - 1) - calc(n / list[k - 1], k - 1)
: dp[n][k];
return calc(n, k ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, dp[110][200010];
int k, a[110];
inline long long solve(int m, long long n) {
if (m > k || n == 0) return n;
if (n <= 200000 && dp[m][n] != -1) return dp[m][n];
long long ans = solve(m + 1, n) - solve(m + 1, n / a[m]);
if (n <= 200000) dp[m][n] = ans;
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 500000;
long long n;
int k;
int a[100];
int b[100][MAXN];
long long get_ans(int i, long long N) {
if (N == 0) return 0;
if (i >= k) return N;
if (N < MAXN && b[i][N] != -1) return b[i][N];
long long res = get_ans(i + 1, N) - get_ans(i + 1, N / a[i])... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long ans = 0, n, zz[10111111];
int k, a[111], kk = 0;
long long rec(long long n, int l) {
if (!n) return 0;
if (l == k) return n;
long long t = n * 100 + l;
if (t < 1e7 && zz[t]) return zz[t];
long long r = rec(n, l + 1) - rec(n / a[l], l + 1);
if (t < 1e7)... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename TT>
ostream &operator<<(ostream &s, pair<T, TT> t) {
return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, vector<T> t) {
s << "{";
for (int i = 0; i < t.size(); i++)
s << t[i] ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int c = 128;
const int d = 10000;
long long r[c][d];
long long n;
int k;
int a[c];
long long ans;
long long get(long long n, long long k) {
if (k == 0) return n;
if (n < d && r[k][n] >= 0) return r[k][n];
long long res = get(n, k - 1) - get(n / a[k], k - 1);
i... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int prime[110];
int dp[300000][100];
int total;
long long solve(long long n, int dep) {
if (n == 0) return 0;
if (dep == -1) return n;
if (n < 300000 && dp[n][dep] != -1) return dp[n][dep];
long long val = solve(n, dep - 1) - solve(n / prime[dep], dep - 1);
if (n ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int a[124], ans;
int dp[124][500024], maxN = 500024;
long long get(long long nn, int ind) {
if (!nn) {
return 0;
}
if (ind == k) {
return nn;
}
if (nn < maxN && dp[ind][nn] >= 0) {
return dp[ind][nn];
}
long long crr = get(nn, ind +... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | import java.util.*;
import java.io.*;
public class Lostborn2 {
static int MAXL = 6000000;
long ans, n;
int k, lim;
int[] a = new int[1010];
int[] dp = new int[MAXL];
long calc(int dep, long n)
{
if(n==0) return 0;
if(dep == -1) return n;
if(n < lim) {
int nn = (int)n;
if(dp[dep*lim... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int k;
int a[1010];
int memo[101][300010];
long long go2(int pos, long long temp) {
if (pos < 0) {
return temp;
}
if (temp < 300000 && memo[pos][temp] != -1) return memo[pos][temp];
long long r = go2(pos - 1, temp) - go2(pos - 1, temp / a[pos]);
i... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
T inline sqr(T x) {
return x * x;
}
template <class T>
inline void relaxMin(T &a, T b) {
a = min(a, b);
}
template <class T>
inline void relaxMax(T &a, T b) {
a = max(a, b);
}
string str(int i) {
char s[100];
sprintf(s, "%d", i);
return string... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int k, i, a[111];
long long A[250002][102];
long long f(long long n, int k) {
if (k == 0 || n == 0) return n;
if (n <= 250000 && (~A[n][k])) return A[n][k];
long long R = f(n, k - 1) - f(n / a[k], k - 1);
if (n <= 250000) A[n][k] = R;
return R;
}
int ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int dp[110][50010];
int a[110], m;
long long go(int p, long long n) {
if (n == 0) return 0;
if (p == m) return n;
if (n < 50010) {
if (dp[p][n] != -1) return dp[p][n];
return dp[p][n] = go(p + 1, n) - go(p + 1, n / a[p]);
}
return go(p + 1, n) - go(p + 1, ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int r = 6e6;
long long int n, k, s, b[r], a[100];
long long int rq(int p, long long int q) {
if (p == -1)
return q;
else if (q < s) {
if (b[p * s + q] == -1) b[p * s + q] = rq(p - 1, q) - rq(p - 1, q / a[p]);
return b[p * s + q];
} else
return rq... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* 4 4 2
* 1 2
* 2 3
* 1 3
* 3 4
* 1 2 3
* 1 3 4
*
* @... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int k, i, a[111];
long long A[250001][101];
long long f(long long n, int k) {
if (k == 0 || n == 0) return n;
if (n <= 250000 && (~A[n][k])) return A[n][k];
long long R = f(n, k - 1) - f(n / a[k], k - 1);
if (n <= 250000) A[n][k] = R;
return R;
}
int ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int LIM = 111111;
const int K = 100;
long long mem[K][LIM];
int k, a[K];
long long dp(int ind, long long n) {
if (n == 0) return 0;
if (ind == k) return n;
if (n < LIM && ~mem[ind][n]) return mem[ind][n];
long long ret = dp(ind + 1, n) - dp(ind + 1, n / a[ind]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int k;
int s[111];
long long dp[101][222222];
const long long INF = 0x7f7f7f7f7f7f7f7fLL;
long long getAns(int pos, long long N) {
if (pos == -1) return N;
if (N < 222222) {
if (dp[pos][N] != -1) return dp[pos][N];
}
long long ans = getAns(pos - 1, ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
public static void main(String[] args) throws IOException {
new Thread(null, new Runnable() {
public voi... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long N;
int K, a[105];
long long dp[102][110005];
long long func(int pos, long long N) {
if (pos == 0) return N;
if (N < 110000 && dp[pos][N] != -1) return dp[pos][N];
long long ret = func(pos - 1, N) - func(pos - 1, N / (a[pos - 1]));
if (N < 110000) dp[pos][N... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long a[110], n, k, gl;
long long dp[110][50100];
bool b[110][50100];
long long rec(int t, long long x) {
if (x <= 50000)
if (b[t][x] == 1)
return dp[t][x];
else
b[t][x] = 1;
long long ans = 0;
if (k == t) {
ans = x / a[t];
} else {
i... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int K, a[110];
long long dp[102][300010];
long long func(int pos, long long N) {
if (pos == 0) return N;
if (N < 300000 && dp[pos][N] != -1) return dp[pos][N];
long long ans = func(pos - 1, N) - func(pos - 1, N / a[pos - 1]);
if (N < 300000) dp[pos][N] = ans;
retu... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long a[1000];
long long f[10002][102];
long long dp(long long n, int m) {
if (m == 0) return n;
if (n == 0) return 0;
if (n <= 10000 && f[n][m] > -1) return f[n][m];
long long res = dp(n, m - 1) - dp(n / a[m], m - 1);
if (n <= 10000) f[n][m] = res;
return r... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const double eps = 1e-6;
long long ans = 1, A[110], f[110][120010];
long long n, m;
long long dfs(int a, long long limit) {
if (limit == 0) return 0;
if (limit <= 120000 && f[a][limit] != -1) return f[a][limit];
if (a == m) {
if (li... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 100, M = 100000;
int k, a[N];
long long f[N][M];
inline long long dfs(int i, long long n) {
if (n == 0) return 0;
if (i >= k) return n;
if (n < M && f[i][n] != -1) return f[i][n];
long long rt = dfs(i + 1, n) - dfs(i + 1, n / a[i]);
if (n < M) f[i][n... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 101000;
long long int f[maxn][101];
int a[101];
long long int dp(long long int i, int j) {
if (i < maxn && f[i][j] != -1) return f[i][j];
if (j == 0) return i;
long long int t = dp(i, j - 1) - dp(i / a[j], j - 1);
if (i < maxn) f[i][j] = t;
return... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int dp[6000000], n;
int k;
long long int a[100];
int s;
long long int clac(long long int n, int t_k) {
if (t_k == -1) return n;
if (n == 0) return 0;
if (n < s) {
if (dp[t_k * s + n] != -1) return dp[t_k * s + n];
dp[t_k * s + n] = clac(n, t_k - 1) -... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXK = 101;
const int MAXF = 200001;
int a[MAXK];
long long f[MAXK][MAXF];
long long n;
int k;
long long rec(int m, long long n) {
if (n == 0) return 0;
if (m == k) return n;
if (MAXF <= n) return rec(m + 1, n) - rec(m + 1, n / a[m]);
if (f[m][n] == -1) f[... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int a[101];
long long d[100][10001];
long long get(long long n, int k) {
if (k == -1) return n;
if (k == 0) return n - n / (long long)a[0];
if (n <= 10000) {
if (d[k][n] != -1)
return d[k][n];
else
return d[k][n] = get(n, k - 1) - get(n / a[k], k -... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
return x * x;
}
template <class T>
T abs(T x) {
return x < 0 ? -x : x;
}
const int MAXK = 105;... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long dp[105][300000];
long long n, m;
long long a[105];
long long recur(long long pos, long long rem) {
if (rem == 0) return rem;
if (pos == m) return rem;
if (300000 <= rem) return recur(pos + 1, rem) - recur(pos + 1, rem / a[pos]);
long long &res = dp[pos][re... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
/**
* Created by hama_du on 15/09/08.
*/
public class E {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
Pri... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int countbit(int n) { return (n == 0) ? 0 : (1 + countbit(n & (n - 1))); }
int lowbit(int n) { return (n ^ (n - 1)) & n; }
const double pi = acos(-1.0);
const double eps = 1e-11;
template <class T>
T sqr(T x) {
return x * x;
}
template <class T>
void checkmin(T &a, T b) {... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
const int maxm = 300000 + 5;
long long dp[maxn][maxm], N;
int a[maxn], n;
long long dfs(int dep, long long num) {
if (dep == 0) {
return num;
}
if (num < maxm) {
if (dp[dep][num] == -1) {
return dp[dep][num] = dfs(dep - 1, num) ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int a[100];
int k;
long long N;
long long f[101][100000];
long long com(int i, long long p) {
if (p < 100000 && f[i][p] != -1) return f[i][p];
long long r = p;
for (int j = i; j < k; j++) r -= com(j + 1, p / a[j]);
if (p < 100000) f[i][p] = r;
return r;
}
int main... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int U = 80;
const int L = 20000;
long long n;
int m, a[111];
int F[U][L];
int f0(int n, int i) {
if (n == 0 || i < 0) return n;
int &res = F[i][n];
if (res < 0) {
res = n;
for (; i >= 0; --i) res -= f0(n / a[i], i - 1);
}
return res;
}
long long f(lo... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXK = 105, SAVE = 50000;
long long N;
int K, A[MAXK];
int save[MAXK][SAVE];
long long go(long long n, int num) {
if (n == 0) return 0;
if (num == K) return n;
if (n < SAVE && save[num][n] != -1) return save[num][n];
long long answer = go(n, num + 1) - go(... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int N, S[1005], dp[105][50000 + 5];
int K;
long long int rec(int x, long long int V) {
if (V == 0) return 0;
if (x == K) return V;
if (V < 50000) {
if (dp[x][V] != -1) return dp[x][V];
dp[x][V] = rec(x + 1, V) - rec(x + 1, V / S[x]);
return dp[x]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int n, m, a[105], dp[105][10005];
long long int recur(long long int pos, long long int rem) {
if (pos == m) return rem;
if (rem == 0) return rem;
if (10005 <= rem) return recur(pos + 1, rem) - recur(pos + 1, rem / a[pos]);
long long int &res = dp[pos][rem]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k, a[200], dp[110][200000];
long long calc(long long n, long long pos) {
if (pos > k) return n;
if (n == 0) return 0;
if (n < 200000) {
if (dp[pos][n] != -1) return dp[pos][n];
return dp[pos][n] = calc(n, pos + 1) - calc(n / a[pos], pos + 1);
};... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
int mem[30000][102];
std::vector<int> nums;
long long dp(long long n, int i) {
if (i >= (int)nums.size()) {
return n;
}
if (n < 30000 && mem[n][i] != -1) {
return mem[n][i];
}
auto ret = dp(n, i + 1) - dp(n / nums[i], i + 1);
if (n < 30000) {
mem[n][i] = ret;
}
retur... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
inline const int read() {
int r = 0, k = 1;
char c = getchar();
for (; c < '0' || c > '9'; c = getchar())
if (c == '-') k = -1;
for (; c >= '0' && c <= '9'; c = getchar()) r = r * 10 + c - '0';
return k * r;
}
long long n;
int k, a[110];
bool vis[1000010];
lon... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, ans;
int k, a[200], f[100000][100][3];
long long search(long long n, int k, int flag) {
if (n == 0) return 0;
if (n < 100000) {
if (f[n][k][flag] != -1) return f[n][k][flag];
}
if (k == 0)
return n * flag;
else {
ans = search(n / a[k], k -... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXK = 100 + 10;
const int MAXW = 10000 + 10;
int k;
int a[MAXK];
long long n;
long long dp[MAXK][MAXW][2];
long long IE(const int &pos, const long long &val, const int &sgn) {
if (val == 0) return 0;
if (pos == k + 1) return sgn * val;
if (val >= MAXW)
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, pa;
int m, i, j, k, p;
int a[100], b[1000000];
vector<int> c[100];
void rec(long long n, int ii, int t) {
if (ii == m) {
pa += n * t;
return;
}
if (n < 1000000) {
c[ii].push_back(n * t);
return;
}
rec(n, ii + 1, t);
rec(n / a[ii], ii... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int a[124], ans;
int dp[124][50024], maxN = 50024;
long long get(long long nn, int ind) {
if (!nn) {
return 0;
}
if (ind == k) {
return nn;
}
if (nn < maxN && dp[ind][nn] >= 0) {
return dp[ind][nn];
}
long long crr = get(nn, ind + 1... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int M = 100 + 10;
const int M1 = 302000;
long long int dp[101][M1 + 1];
int a[M];
long long int DFS(int pos, long long int num, int k) {
if (pos == k - 1) {
long long int ans =
num - num / a[pos] - num / a[pos + 1] + num / a[pos] / a[pos + 1];
return... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long dp[101][50001];
long long a[201];
long long dfs(int n, long long k) {
if (n == 1) return k / a[n];
if (k <= 50000) {
if (dp[n][k] != -1)
return dp[n][k];
else
return dp[n][k] = k / a[n] + dfs(n - 1, k) - dfs(n - 1, k / a[n]);
}
return d... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int M = 100000 + 10;
const int N = 100 + 10;
long long ans;
long long i;
long long m;
long long n;
long long a[N];
long long f[N][M];
long long dp(long long m, long long n) {
long long result;
if (n == 0) return m;
if (n < 100 && m < 100000 && f[n][m] != -1) ret... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int dp[200001 + 1][101], n, k, a[101];
long long int solve(long long int n, long long int ind) {
if (ind == k + 1) return n;
if (n == 0) return 0;
long long int ans;
if (n <= 200001) {
ans = dp[n][ind];
if (ans != -1) return ans;
}
ans = solve(... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int a[105];
int b[500005][105];
int xsolve(int n, int k) {
if (b[n][k] != -1) return b[n][k];
if (k == 0) return b[n][k] = n;
if (n == 0) return b[n][k] = 0;
b[n][k] = xsolve(n, k - 1) - xsolve(n / a[k - 1], k - 1);
retu... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N = 10005;
long long dp[N][101];
int a[101];
long long dfs(long long n, int pos) {
if (pos == -1) {
return n;
}
if (n < N && ~dp[n][pos]) {
return dp[n][pos];
}
long long ret = dfs(n, pos - 1) - dfs(n / a[pos], pos - 1);
if (n < N) {
dp[n][... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long up_k = 201;
const long long up_memorized = 60001;
vector<long long> a;
long long n, tmp;
long i, j, k;
vector<long long>::iterator it_i, it_j;
long long ans[up_k][up_memorized];
long long f(long t, long long x) {
if (x == 0) return 0;
if (t == k) return x;
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
template <class T>
void pv(T a, T b) {
for (T i = a; i != b; ++i) cout << *i << " ";
cout << endl;
}
template <class T>
void pvp(T a, T b) {
for (T i = a; i != b; ++i)
cout << "(" << i->first << ", " << i->second << ") ";
cout << endl;
}
template <class T>
void ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 |
import java.io.*;
import java.util.*;
public class Solution implements Runnable {
private StringTokenizer st;
private BufferedReader in;
private PrintWriter out;
private int[][] d;
public void solve() throws IOException {
long n = nextLong();
int k = nextInt();
int[] a = new int[k];
// a[0] = 2;
// l... | JAVA |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int K, a[110];
long long dp[102][300010];
long long func(int pos, long long N) {
if (pos == 0) return N;
if (N < 300000 && dp[pos][N] != -1) return dp[pos][N];
long long ans = func(pos - 1, N) - func(pos - 1, N / a[pos - 1]);
if (N < 300000) dp[pos][N] = ans;
retu... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
using namespace std;
const int MaxL = 300005, MaxN = 102, NA = -1, MaxC = 0x3F3F3F3F;
int a[MaxN];
long long n, res;
int k;
int f[MaxN][MaxL];
long long recur(int p, long long v) {
if (v < MaxL) {
return f[p][v];
} else {
long long res;
res = v;
int i;
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
inline int in() {
int32_t x;
scanf("%d", &x);
return x;
}
inline long long lin() {
long long x;
scanf("%lld", &x);
return x;
}
inline string get() {
char ch[2000010];
scanf("%s", ch);
return ch;
}
inline void read(int *a, int n) {
for (int i = 0; i < n; ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int v[101];
long long dp[101][300001];
long long calc_dp(long long n, int kmax);
int main() {
long long n;
int k;
cin >> n >> k;
for (int i(1); i <= k; i++) cin >> v[i];
sort(v + 1, v + k + 1);
for (int i(0); i <= k; i++)
for (int j(1); j <= 300000; j++) dp[... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 10000;
const int INF = ~0U >> 2;
int a[110];
long long f[maxn + 10][100];
long long dp(long long n, int m) {
if (n == 0) return 0;
if (m == -1) return n;
if (n <= maxn) return f[n][m];
long long h = n * 100 + m;
long long res = n;
for (int i = m... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int dp[110][50000];
int m, a[110];
long long go(int p, long long n) {
if (n == 0) return 0;
if (p == m) return n;
if (n < 50000) {
if (dp[p][n] != -1)
return dp[p][n];
else
return dp[p][n] = go(p + 1, n) - go(p + 1, n / a[p]);
}
return go(p + 1... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
inline long long getint() {
long long _x = 0, _tmp = 1;
char _tc = getchar();
while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
if (_tc == '-') _tc = getchar(), _tmp = -1;
while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
long long n, uns, dp[101][50001], m;
int a[101], i, k;
long long run(long long ss, int k) {
if (ss == 0) return 0;
if (k == 0) return ss;
if (ss <= m && dp[k][ss] >= 0) return dp[k][ss];
long long v = run(ss, k - 1) - run(ss / a[k], ... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:264777216")
int a[1000];
int k;
long long n;
const int size = 600000;
int dp[101][size];
long long rec(long long b, int i) {
if (i >= k) {
return b;
}
if (b < size) {
if (dp[i][b] != -1) {
return dp[i][b];
}
}
long... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 50000;
int a[100];
bool u[100][Maxn][2];
long long f[100][Maxn][2];
long long dfs(int dep, long long n, int flag) {
if (!n) return 0;
if (dep < 0) return flag ? n : -n;
if (n < Maxn && u[dep][n][flag]) return f[dep][n][flag];
long long tmp = dfs(dep... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int upper = 20000;
int k;
long long n, f[101][upper], a[101];
long long F(int i, long long now) {
if (i == k) return now;
if (now == 0) return 0;
if (now < upper && f[i][now] >= 0) return f[i][now];
long long ret = F(i + 1, now) - F(i + 1, now / a[i]);
if (n... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const double error = 1e-7;
const double PI = acos(-1);
mt19937 rng(
(unsigned int)chrono::system_clock::now().time_since_epoch().count());
inline long long int MOD(long long int x, long long int m = mod) {
long long int y = x % m;
return... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 998244353;
int a[105], dp[105][maxn];
long long dfs(int pos, long long x) {
if (!pos) return x;
if (x < maxn && dp[pos][x] != -1) return dp[pos][x];
long long res = dfs(pos - 1, x) - dfs(pos - 1, x / a[pos]);
if (x < maxn) d... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int a[110], ans;
long long dp[100010][110];
int maxN = 100010;
long long get(long long nn, int ind) {
if (ind == k) {
return nn;
}
if (nn < maxN && dp[nn][ind] >= 0) {
return dp[nn][ind];
}
long long crr = get(nn, ind + 1) - get(nn / a[ind]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 110, TOF = 550000;
long long n, m, k, u, v, x, y, t, a, b, ans;
long long A[MAXN];
int dp[MAXN][TO... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int N(100), M(300000);
long long dp[N][M], k;
int n, a[N];
long long get(int n, long long k) {
if (n == -1) return 1;
if (k < M) {
if (dp[n][k] != -1) return dp[n][k];
return dp[n][k] = k / a[n] + get(n - 1, k) - get(n - 1, k / a[n]);
}
return k / a[n]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int prime[103];
int dp[103][300003];
long long dfs(long long n, int m) {
if (prime[0] == 1 || n == 0) return 0;
if (n < 300001 && dp[m][n] > -1) return dp[m][n];
long long ans = 0;
if (m == 0)
ans = n;
else
ans = dfs(n, m - 1) - dfs(n / prime[m - 1], m - 1... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int bound = 100000;
long long f[110][bound];
int a[110];
long long solve(long long n, int k) {
if (k == 0) return n;
if (n < bound && f[k][n] >= 0) return f[k][n];
long long ans = solve(n, k - 1) - solve(n / a[k - 1], k - 1);
if (n < bound) f[k][n] = ans;
re... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long dp[100005][105];
int arr[105];
long long f(long long n, int m) {
if (m < 0) return n;
long long ans;
if (n < 100005 && dp[n][m] != -1) return dp[n][m];
ans = f(n, m - 1) - f(n / arr[m], m - 1);
if (n < 100005) dp[n][m] = ans;
return ans;
}
int main() {... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
return x * x;
}
template <class T>
T abs(T x) {
return x < 0 ? -x : x;
}
const int MAXK = 105;... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int k, p[101];
const int N = 2.8e5;
long long memo[101][N];
long long go(long long x, int from) {
if (x == 0 || from == k) return x;
if (x < N && memo[from][x] != -1) return memo[from][x];
long long res = go(x, from + 1) - go(x / p[from], from + 1);
if (x < N) memo[... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int k, p[101];
const int N = 3e5;
long long memo[N][101];
long long go(long long x, int from) {
if (x == 0 || from == k) return x;
if (x < N && memo[x][from] != -1) return memo[x][from];
long long res = go(x, from + 1) - go(x / p[from], from + 1);
if (x < N) memo[x]... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-7;
const int inf = (int)1e9;
const long long linf = (long long)1e18;
const long double pi = acos(-1.0);
const int prime = 748297;
inline void finclude() { srand(time(NULL)); }
long long a[101];
long long b[101][300000];
long long f(long long m, lo... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = 1 << 28;
template <class T>
void chmin(T &t, T f) {
if (t > f) t = f;
}
template <class T>
void chmax(T &t, T f) {
if (t < f) t = f;
}
int in() {
int x;
scanf("%d", &x);
return x;
}
long long In() {
long long x;
cin >>... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
long long n, res = 0, val;
int k, nums[104];
pair<long long, long long> v[2][3000000], v1[3000000];
int vsz[2], v1sz;
int main() {
cin >> n >> k;
for (int i = 0; i < k; i++) cin >> nums[i];
v[0][vsz[0]++] = make_pair(n, 1);
... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 500000;
int A[100], F[MAX][100];
long long DP(long long N, int K) {
if (K < 0 || !N) return N;
if (N < MAX && F[N][K] != -1) return F[N][K];
long long T = DP(N, K - 1) - DP(N / A[K], K - 1);
if (N < MAX) F[N][K] = T;
return T;
}
int main() {
long... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
int M[110][500100];
vector<int> v;
long long f(int k, long long n) {
if (n < 500000 && M[k][n] != -1) return M[k][n];
if (k == 0) {
if (n < 500000) M[k][n] = n;
return n;
}
long long tmp = f(k - 1, n) - f(k - 1, n / v[k - 1]);
if (n < 500000) M[k][n] = tmp... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const double eps = 0.00000001;
long long num[1001], dp[101][300001];
long long d(long long k, long long n) {
if (k == 0) return n;
if (n > 300000) return d(k - 1, n) - d(k - 1, n / num[k - 1]);
if (dp[k][n] != -1) return dp[k][n];
return dp[k][n] = d(k - 1, n) - d(k... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 110, TOF = 400000;
long long n, m, k, u, v, x, y, t, a, b, ans;
long long A[MAXN];
int dp[MAXN][TO... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long int dp[105][300005];
long long int n, k;
long long int a[105];
long long int recur(long long int pos, long long int rem) {
if (pos == k) return rem;
if (rem < 300005) {
long long int &res = dp[pos][rem];
if (res != -1) return res;
return res = recu... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int a[110];
long long ans;
int k;
long long f[300010][110];
long long dfs(long long n, int x) {
if (x == k) return n;
if (n < 300010) {
if (f[n][x] == -1) f[n][x] = dfs(n, x + 1) - dfs(n / a[x], x + 1);
return f[n][x];
} else {
return dfs(n, x... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long m, mem[((long long)101 * 1000)][((long long)102)];
long long k, a[((long long)102)];
long long calc(long long n, long long x) {
if (n < ((long long)101 * 1000) && mem[n][x] != -1) return mem[n][x];
if (x == -1) return n;
long long res = calc(n, x - 1) - calc... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
long long n;
int k;
int a[100];
int b[100][MAXN];
long long get_ans(int i, long long N) {
if (N == 0) return 0;
if (i >= k) return N;
if (N < MAXN && b[i][N] != -1) return b[i][N];
long long res = get_ans(i + 1, N) - get_ans(i + 1, N / a[i])... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n, k, g, ans;
long long a[105];
long long Map[102][300005];
long long goes(long long n, long long k) {
if (k == 0) return n;
if (n > 300000) return goes(n, k - 1) - goes(n / a[k - 1], k - 1);
if (Map[k][n] == -1) Map[k][n] = goes(n, k - 1) - goes(n / a[k - 1... | CPP |
93_E. Lostborn | Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible.
One day, as he was reading the game's forum ... | 2 | 11 | #include <bits/stdc++.h>
using namespace std;
long long n;
int k;
int a[105];
long long brut(long long p, int i) {
if (i == k || a[i] > p) return p;
return brut(p, i + 1) - brut(p / a[i], i + 1);
}
int main() {
ios::sync_with_stdio(!cin.tie(0));
cin >> n >> k;
for (int i = 0; i < k; i++) cin >> a[i];
if (co... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.