description stringlengths 35 9.39k | solution stringlengths 7 465k |
|---|---|
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import ja... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Tmin(const T &lch, const T &rch) {
if (lch < rch) return lch;
return rch;
}
template <class T>
inline T Tmax(const T &lch, const T &rch) {
if (lch < rch) return rch;
return lch;
}
template <class T>
inline T Tabs(const T &ch) {
if (ch <... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
struct data {
int x, y;
long long val;
};
long long read() {
long long tmp = 0;
char c = getchar();
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9') {
tmp = tmp * 10 + c - '0';
c = getchar();
}
return tmp;
}
data change[2000000]... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
using li = long long;
using ld = long double;
void solve(bool);
void precalc();
clock_t start;
int main() {
start = clock();
int t = 1;
cout.sync_with_stdio(0);
cin.tie(0);
cout.precision(20);
cout << fixed;
precalc(... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = (x << 1) + (x << 3) + ch - '0';
ch = getchar();
}
return x * f;
}
const int maxn = ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 10;
const int maxn = 1000020;
namespace Prime {
const int N = 2000005;
int p[N], h[N], mn[N], cnt;
void init() {
for (int i = 2; i <= N; i++) {
if (!h[i]) p[++cnt] = i;
for (int j = 1; j <= cnt; j++) {
if (p[j] * i > N) break;
h[i *... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0;
int f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = -1;
for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
return x * f;
}
void print(long long x) {
if (x < 0) putchar(... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = 2048;
int n;
long long kk, gcdd;
pair<long long, int> juds[N];
vector<int> msk[M], nmsk[M];
int cnt[M];
void init();
int actv_num;
vector<int> actv_conf[14];
bool dp_flg[M][14];
long long dp_res[M][14];
vector<long long> fac;
vector... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, tick;
long long k;
long long a[N], e[N];
vector<long long> dv_id[N], costs[N];
vector<int> ok_masks[N];
map<long long, int> M;
long long gcd(long long a, long long b) {
while (b) {
a %= b;
swap(a, b);
}
return a;
}
int main() {
... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
i >> p.first >> p.second;
return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
for (auto& v : t) {
i >> v;
}
return i;
}
templat... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
long long int A[1000005], memo[1 << 12];
int E[1000005];
long long int dp[12][1 << 12];
long long int gcd(long long int x, long long int y) {
if (x == 0) return y;
return gcd(y % x, x);
}
int main() {
int n;
long long int lim;
scanf("%d %lld", &n, &lim);
long lo... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
const long long INF = 0x3f3f3f3f3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
long long r = 1 % P;
for (a %= P; n; a = a * a % P, n >>= 1)
if (n & 1) r = r * a % ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
namespace io {
const int L = (1 << 20) + 1;
char buf[L], *S, *T, c;
char getchar() {
if (__builtin_expect(S == T, 0)) {
T = (S = buf) + fread(buf, 1, L, stdin);
return (S == T ? EOF : *S++);
}
return *S++;
}
int inp() {
int x = 0, f = 1;
char ch;
for (ch... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class t, class u>
void chmax(t& first, u second) {
if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
if (second < first) first = second;
}
template <class t>
using vc = vector<t>;
template ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = 2048;
int sp[20];
vector<int> msk[M], nmsk[M];
bool gathered[M];
int n;
long long kk, gcdd;
pair<long long, long long> juds[N];
vector<long long> fac;
set<int> candi_maxl_v;
unordered_map<long long, int> jud_map;
vector<int> v_adj[M... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const long long infll = (long long)1.01e18;
const long double eps = 1e-9;
const long double pi = acos((long double)-1);
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
void precalc() ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
inline long long in() {
long long k = 0;
char ch = getchar();
bool p = 1;
while (ch < '-') ch = getchar();
if (ch == '-') p = 0, ch = getchar();
while (ch > '-') k = k * 10 + ch - '0', ch = getchar();
return p ? k : -k;
}
const int N = 1e6 + 5;
const long long inf = 1ll << 60;
lon... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
const long long INF = (long long)1e16;
const int N = (int)1e6 + 55;
const int K = 11;
const int M = (1 << K) + 5;
int n;
pair<... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
using li = long long;
using ld = long double;
void solve(bool);
void precalc();
clock_t start;
int main() {
start = clock();
int t = 1;
cout.sync_with_stdio(0);
cin.tie(0);
cout.precision(20);
cout << fixed;
precalc(... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = 2048;
int n;
long long kk, gcdd;
pair<long long, int> juds[N];
int sp[20];
vector<int> msk[M], nmsk[M];
int cnt[M];
void init();
int actv_num;
vector<int> actv_conf[14];
bool dp_flg[M][14];
long long dp_res[M][14];
vector<long long>... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
impo... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
s = s * 10 + ch - '0';
ch = getchar();
}
return s * w;
}
long long g... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using std::cerr;
using std::endl;
inline long long read() {
long long x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
const int MAXN = ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long a = 0;
char c = getchar();
while (!isdigit(c)) c = getchar();
while (isdigit(c)) {
a = a * 10 + c - 48;
c = getchar();
}
return a;
}
inline long long gcd(long long a, long long b) {
long long r = a % b;
while (r) {... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
namespace IO {
const int maxn(1 << 21 | 1);
char ibuf[maxn], *iS, *iT, c;
int f;
inline char Getc() {
return iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, maxn, stdin),
(iS == iT ? EOF : *iS++))
: *iS++;
}
template <class Int>
void I... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N1 = (int)(1e6 + 0.5);
const long long N2 = (long long)(1e12 + 0.5);
struct emt {
long long a, cost;
};
bool cmp(emt u, emt v) { return u.cost < v.cost; }
emt e[N1 + 5];
unordered_map<long long, int> CNT;
long long gcd(long long x, long long y) { return !x ? y :... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | //package round534;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class D {
InputStream is;
FastWriter out;
long Q = 2L*3*5*7*11*13*17*19*23*29*31*37;
// String INPUT = "3 " + (114514) + " " + Q + " " + Q + " " + Q + ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, M = (1 << 11) + 10;
inline long long rd() {
long long x = 0, w = 1;
char ch = 0;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
c... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N1 = (int)(1e6 + 0.5);
const long long N2 = (long long)(1e12 + 0.5);
struct emt {
long long a, cost;
};
bool cmp(emt u, emt v) { return u.cost < v.cost; }
emt e[N1 + 5];
unordered_map<long long, int> CNT;
long long gcd(long long x, long long y) { return !x ? y :... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 1e6 + 1, PC = 11, Q = 2048;
int n;
long long k, g;
long long a[N], e[N];
long long deg[N][PC];
bool die[N];
long lo... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
const int N = 1000010;
struct dat {
long long u, e;
inline bool operator<(const dat &b) const { return e < b.e; }
} a[N];
long long n, k, num = 0;
long long dp[12][1 << 11], dp1[12][1 << 11];
long long had1[1 << 11], part[1 << 11], p[20], pk[... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0, f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return x * f;
}
const long long MAXN = 1000010;
const long long INF = 1e15;
l... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 16;
const int M = 22;
const long long inf = 1e18;
long long gcd(long long x, long long y) {
if (!y) return x;
return gcd(y, x % y);
}
long long Q(long long x, long long y) {
long long t = x;
while (t % y == 0) {
t /= y;
}
return x / t;
}
... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
using namespace std;
inline long long read() {
long long s = 0, f = 1;
char c = getchar();
;
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
;
}
... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const int SITO_MAX = 1000000;
int f[SITO_MAX + 1];
vector<int> prosti;
template <class T>
T gcd(T a, T b) {
T t;
while (a) {
t = a;
a = b % a;
b = t;
}
return b;
}
struct sito {
sito() {
for (in... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const long long infll = (long long)1.01e18;
const long double eps = 1e-9;
const long double pi = acos((long double)-1);
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
void precalc() ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline int gi() {
int f = 1, sum = 0;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
sum = (sum << 3) + (sum << 1) + ch - '0';
ch = getchar();
}
return f * sum;
}
in... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long data = 0, w = 1;
char ch = 0;
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();
return data * w;
}
lo... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
namespace mine {
long long qread() {
long long ans = 0, f = 1;
char c = getchar();
while (c < '0' or c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
return ans * f;
}
void write(lon... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
int n;
long long k;
long long p[1100];
long long dp[1 << 12][13];
long long dp1[1 << 12][13];
long long ff[1 << 12];
int used[1 << 12];
int len;
long long a[1100000];
long long b[1100000];
long long mul[1100000];
int id[1100000];
int e[1100000];
unordered_map<long long, int... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
int main() {
start = clock();
int t = 1;
cout.sync_with_stdio(0);
cin.tie(0);
precalc();
cout.precision(10);
cout << fixed;
int testNum = 1;
... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = (x << 1) + (x << 3) + ch - '0';
ch = getchar();
}
return x * f;
}
const int maxn = ... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
int n, m;
long long k, G;
long long A[1000006];
int E[1000006];
vector<long long> fac;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
map<long long, vector<int> > M;
int ok[1000006];
inline void FWTand(int* A, int len) {
for (int mid = 2;... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
int const N = 1000000;
long long const inf = 1e18;
int const infs = 1e9;
int n;
long long k, x[N];
map<long long, vector<long long> > fc, c;
vector<vector<char> > cn;
vector<vector<vector<long long> > > dp;
vector<vector<int> > fr, mn;
long long gcd(long long a, long long b... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
s = s * 10 + ch - '0';
ch = getchar();
}
return s * w;
}
const int N... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &data) {
data = 0;
int w = 1;
register char ch = 0;
while (!isdigit(ch) && ch != '-') ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while (isdigit(ch)) data = data * 10 + ch - '0', ch = getchar();
data *= w;
}
... |
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are n judges now in the layer and you are trying to pass the entrance exam. You have a number k β your skill in Cardbluff.
Each judge has a number a_i β an indicator of uncertainty about ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, M = (1 << 11) + 10;
int n, cot, S;
long long ans, g, K, inf, dp[12][M], ys[12], xs[12];
pair<long long, long long> p[N];
map<long long, vector<long long>> ex;
vector<long long> cn;
bool vs[M];
char cp;
template <class T>
inline void rd(T &x) {
cp =... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int maxn = 2005;
long long n, m;
long long d[maxn];
int vis[maxn];
vector<long long> g[maxn], w[maxn];
char s[maxn][maxn];
void dfs(int x) {
vis[x] = 1;
for (int i = 0; i < g[x].size(); i++) {
int nxt = g[x][i];
int wgt = w[x][i];
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
im... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>
"""
from __future__ import division, print_function
import itertools
import os
import sys
from atexit import register
from io import BytesIO
class dict(dict):
"""dict() ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | // package CodeForces;
// /
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.LinkedList;
public class Round541D {
public static int[... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
string inttostr(long long a) {
string ans = "";
if (a == 0) return "0";
stringstream ss;
while (a > 0) {
string ch;
ss << a % 10;
ss >> ch;
ss.clear();
ans = ch + ans;
a /= 10;
}
return ans;
}
long long strtoint(string s) {
long long an... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> graph[2005];
int ans[2005];
int father[2005];
int inedge[2005];
char inputs[1005][1005];
int avai;
int find(int a) {
if (a != father[a]) father[a] = find(father[a]);
return father[a];
}
int que[2005], head, tail;
int main() {
cin >> n >> m;
ava... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int n, m, tot, totcol, cnt[100005], val[100005], vis[100005];
int col[5555], head[2000005], nxt[2000005], point[2000005];
int a[2005][2005], con[2005][2005];
vector<int> v[100005];
set<pair<int, int> > all;
char s[1005][1005];
void gotohell() {
puts("No");
exit(0);
}
vo... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
long long qpow(long long a, long long b) {
long long res = 1;
while (b) {
if (b & 1) res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
long long qpow(long long a, long long b, long long mod) {
long long res =... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
vector<int> G[maxn];
int n, m, d[maxn], par[maxn], a[maxn], vis[maxn], flag = 1;
char s[1005][1005];
int find(int u) {
if (par[u] != u) par[u] = find(par[u]);
return par[u];
}
struct node {
int u, w;
node(int a, int b) { u = a, w = b; }
};
voi... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
work();
out.flush();
}
long mod=1000000007;
long gcd(long a,long b) {
return a==0?b:b>=a?gcd(b%... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static int mod = 1000000007;
static long inf = (long) 1e16;
static int[][] ad;
static int n, m;
static long[][][] memo;
static HashSet<Integer> h;
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> g, gr, mat;
void add_edge(int u, int v) {
g[u].push_back(v);
gr[v].push_back(u);
mat[u][v] = 1;
}
vector<bool> used;
vector<int> order, component;
vector<vector<int>> components;
void dfs1(int v) {
used[v] = true;
for (auto u : g[v])
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const long long N = 2010;
struct DSU {
long long connected;
long long par[N], sz[N];
void init(long long n) {
for (long long i = 1; i <= n; i++) {
par[i] = i;
sz[i] = 1;
}
connected = n;
}
long long getPar(long long k) {
while (k != par... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void read(_T &f) {
f = 0;
_T fu = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') fu = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
f = (f << 3) + (f << 1) + (c & 15);
c = getchar();
}
f ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int dir4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
long double eps = 1e-7;
const int N = 1e3 + 5;
int a[N][N];
long long dsu[2 * N], h[2 * N], num[2 * N], fath[2 * N];
pair<long long, long long> dp[2 * N];
vector<int> v[2 * N];
int vis[2 * N];
int root(int x) {
if (x ==... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1000100;
inline int read() {
char ch = getchar();
int x = 0, f = 0;
while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
return f ? -x : x;
}
int n, m, el, head[2020], t... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
namespace atcoder {
struct dsu {
public:
dsu() : _n(0) {}
dsu(int n) : _n(n), parent_or_size(n, -1) {}
int merge(int a, int b) {
assert(0 <= a && a < _n);
assert(0 <= b && b < _n);
int x = leader(a), y = leader(b);
if (x == y) return x;
if (-paren... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.*;
import java.util.*;
public class Main {
static long mod=1000000007;
public static void main(String[] args){
int n=ni(),m=ni();
int[][] ta=new int[n][m];
int[][] ta2=new int[m][n];
for(int i=0;i<n;i++){
String str=next();
for(int j=0;j<m;j++){
char ch=str.charAt(j);
if(ch=='>')... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.*;
import java.util.*;
public class Task {
public static void main(String[] args) throws IOException {
new Task().go();
}
PrintWriter out;
Reader in;
BufferedReader br;
Task() throws IOException {
try {
//br = new BufferedReader( new FileReader("... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
inline long long readl() {
lon... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.util.*;
import java.io.*;
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
//SOLUTION BEGIN
void pre() throws Exception{}
void solve(int TC) throws Exception{
int n = ni(), m = ni(), xx = 0;
int[] set = new int[n+m];
for(int i = 0; i< n+m; i++)s... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
void fun() {}
int md = 1e9 + 7;
int __gcd(int a, int b) {
if (b == 0) return a;
return __gcd(b, a % b);
}
int poww(int a, int b, int md) {
if (b < 0) return 0;
if (a == 0) return 0;
int res = 1;
while (b) {
if (b & 1) {
res = (1ll * res * a) % md;
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 2005;
int pre[N];
int find(int x) { return (x == pre[x]) ? x : pre[x] = find(pre[x]); }
void join(int x, int y) {
int rx = find(x), ry = find(y);
if (rx == ry) return;
pre[rx] = ry;
}
int in[N];
vector<int> G[N];
char mp[1005]... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int n, m, f[100005], mp[2005][2005], in[2005], vis[2005], q[200005],
dis[200005], head = 0, tail = 0, cnt = 0;
char a[1005][1005];
int find(int x) {
if (f[x] == x) return x;
return f[x] = find(f[x]);
}
void link(int x, int y) {
x = find(x), y = find(y);
if (x ==... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | r,c = map(int, input().split())
m = []
p = [i for i in range(0,r+c)]
tree = [[] for i in range(0, r+c)]
for i in range(0,r):
s = input().split('\n')[0]
m.append(list(s))
def find(i):
if p[i] ==i:
return i
par = find(p[i])
p[i] = par
return p[i]
def join(i,j):
p[find(i)] = find(... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1000010;
int n, m, r, h = 1;
char mp[1010][1010];
bool vis[2020];
int pre[2020], deg[2020], q[2020], val[1000010];
int head[2020], tot = 0;
struct node {
int v, next, w;
node(int _v = 0, int _next = 0, int _w = 0) : v(_v), ne... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int fa[maxn];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
vector<string> s(n);
for (auto& x : s) cin >> x;
for (int i = 0; ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import time
debug = False
n1, m2 = map(int, input().split())
tests = []
for i in range(n1):
tests.append(list(input()))
if debug:
print (tests)
begin = time.time()
if debug:
print("---")
marks1 = []
result1 = []
for i in range(n1):
marks1.append([i,0.0])
result1.append(0)
marks2 = []
result2 = []
for j in ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int N = 2010;
int n, m;
char s[N][N];
int fa[N], deg[N], vis[N], len[N];
vector<int> g[N];
int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); }
void dfs(int u) {
vis[u] = 1;
len[u] = 1;
for (int i = 0; i < (int)g[u].size(); i++) {
int v = g[u][... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, m, par[2010], gx[2010][2010], ans[2010], num[2010], dg[2010];
string s[1010];
vector<int> g[2010], topo;
bool vis[2010];
int FIND(int pos) {
if (par[pos] != pos) par[pos] = FIND(par[pos]);
return par[pos];
}
void UNION(int pos1, int... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
set<int> polaczenia[5005];
int lider[5005];
int war[5005];
int wch[5005];
int f(int a) {
if (lider[a] != a) lider[a] = f(lider[a]);
return lider[a];
}
void u(int a, int b) { lider[f(a)] = f(b); }
void pre(int a) {
for (int x = 1; x <= a; x++) lider[x] = x;
}
bool czy ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
char mm[10005][10005];
vector<int> vc[10005];
int in[10005];
int vis[10005];
int reword[10005 << 2];
int n, m;
int f[10005];
void init() {
for (int i = 0; i < 10005; i++)
f[i] = i, vc[i].clear(), in[i] = reword[i] = 0;
}
int get(int x) { return x == f[x] ? x : f[x] = ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
void execution();
int main() {
ios_base::sync_with_stdio(0);
execution();
return 0;
}
char in[1001][1001];
long long komp[2002], us[2002], ans[2002], raz[2002];
vector<long long> g[2002];
void konec() {
cout << "No";
exit(0);
}
long long pol(long long v) {
if (k... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
public static void main(String[] args) throws Exception {
new template().run();
}
int[] par, sz;
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(Syste... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;
public class Main {
void solve() {
n=ni(); m=ni();
s=new char[n][m];
for(int i=0;i<n;i++)s[i]=ns().toCharArray();
g=new ArrayList[n+m+1];
g2=new ArrayList[n+m+1];
for(int i=1;i<=n+m;i++) g[... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2222;
int size[MAXN], link[MAXN];
int numbers[MAXN], inDegree[MAXN];
vector<int> conn[MAXN];
char c[1005][1005];
int find(int a) { return a == link[a] ? a : link[a] = find(link[a]); }
void unite(int a, int b) {
a = find(a);
b = find(b);
if (a == b) re... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
class dsu {
vector<long long int> parent, rank;
long long int totalComponents;
public:
dsu(long long int n) {
parent.resize(n);
rank.resize(n);
for (long long int i = 0; i < n; i++) parent[i] = i, rank[i] = 0;
totalComponents = n;
}
long long int... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.util.*;
import java.io.*;
public class D541 {
static Map<Integer, ArrayList<Integer>> adj = new HashMap<>();
static int [] rank;
static int [] vis;
static boolean ok;
static ArrayList<Integer> top;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 50;
int fa[maxn];
string s[maxn];
vector<int> v[maxn];
int ans[maxn];
int in[maxn];
int vis[maxn];
int fin(int f) { return f == fa[f] ? f : fa[f] = fin(fa[f]); }
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n + m; ++i) fa[i] = i;
... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Solver solver = new Solver();
solver.solve(in, out);
out.close();
}
private s... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 5;
int p[N], indeg[N], ans[N];
char c[N][N];
vector<int> edge[N];
int findx(int x) { return x == p[x] ? x : findx(p[x]); }
void unite(int x, int y) {
x = findx(x);
y = findx(y);
p[x] = y;
}
int main() {
ios_base::sync_with_stdio(false);
cin.ti... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int n, m;
char x[1011][1022];
int biga[1001], smla[1001], bigb[1001], smlb[1001];
bool cmpa(int i, int j) {
if (biga[i] != biga[j]) return biga[i] > biga[j];
return smla[i] < smla[j];
}
bool cmpb(int i, int j) {
if (bigb[i] != bigb[j]) return bigb[i] > bigb[j];
retu... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
if (x < y) x = y;
}
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;
const int INF = 0x3f3f3f3f;
const int MOD = ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
const int N = 1005, M = N * 2, L = 1e6 + 5;
int n, m, fa[M], ecnt, nxt[L], adj[M], go[L], d[M], H, T, Q[M], f[M];
char s[N][N];
void add_edge(int u, int v) {
nxt[++ecnt] = adj[u];
adj[u] = ecnt;
go[ecnt] = v;
d[v]++;
}
int cx(int x) {
if (fa[x] != x) fa[x] = cx(fa[x]);
return fa[x];... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
return ((a) / gcd((a), (b)) * (b));
}
template <class T>
inline T BigMod(T Base, T power, T M = 1000000007) {
if (power == 0) retur... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
vector<int> e[2010];
int v[2010], in[2010], d[2020], n, m, i, j, k;
char s[2010][2010];
int f(int x) { return x == v[x] ? x : (v[x] = f(v[x])); }
bool ch() {
for (int i = 1; i <= n + m; i++) {
v[i] = i;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; ... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
try (PrintWriter out = new PrintWriter(System.out)) {
Solution solution = new Solution();
solution.in = new InputReader(getInput());
solu... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int power(int x, unsigned int y, int p) {
int res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
int mI(int a, int m) { return power(a, m - 2, m); }
class ds {
vector<int> v1;
unordered_... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
int roots[2001];
int heights[2001];
bool in_stack[2001];
int nums[2001];
bool visited[2001];
vector<vector<int>> adj_list(2001);
vector<pair<int, int>> lesser;
int root(int a) {
while (a != roots[a]) a = roots[a];
return a;
}
void join(int a, int b) {
a = root(a);
b... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | #include <bits/stdc++.h>
using namespace std;
const long long int MAXN = 2e5 + 10;
const long long int MINN = 1e5 + 10;
const long long int inf = 1e9 + 7;
int n, m, ans[2005], vis[2005], col[2005], visdfs[2005], par[2005], ran[2005];
char a[1005][1005];
vector<int> gr[2005], inc[2005];
stack<int> topo;
map<int, int> fi... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | n, m = map(int, input().split())
dishes = [0 for _ in range(n + m)]
father = [-1 for _ in range(n + m)]
e_out = dict()
v_in = [0 for _ in range(n + m)]
def get_father(n):
if father[n] == -1:
return n
else:
father[n] = get_father(father[n])
return father[n]
compare_matrix = []
for i... |
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review β in each restaurant Mr. Apple orders two sets of dishes on two different days. All the di... | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class A{
static PrintWriter out;
static InputReader in;
public static void main(String args[]){
out = new PrintWriter(System.out);
in = new InputReader();
new A();
out.flush(); out.close();
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.