Search is not available for this dataset
name stringlengths 2 88 | description stringlengths 31 8.62k | public_tests dict | private_tests dict | solution_type stringclasses 2
values | programming_language stringclasses 5
values | solution stringlengths 1 983k |
|---|---|---|---|---|---|---|
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long INFLL = 4e18L;
const int MOD = 0;
const int N = 3e5 + 3;
const int BLUE = 1, RED = 2;
int n, k;
char init_state[N];
vector<int> has[N];
int color[N];
vector<int> adj_same[N], adj_diff[N];
struct DSU {
vector<int> _leader, _size, _force... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 998244353;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 998244353;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, inf = 1e9;
int n, kk, s, x, k[N][2];
char ch[N];
int fa[N << 1], val[N << 1];
int find(int u) { return fa[u] ? fa[u] = find(fa[u]) : u; }
void uni(int a, int b) {
if (find(a) == find(b)) return;
val[find(b)] += val[find(a)];
fa[find(a)] = find(b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int N, K, a[MAXN];
vector<int> V[MAXN];
char S[MAXN];
int f1[MAXN], v1[MAXN], f2[MAXN], chs[MAXN], ans;
int get1(int x) {
if (f1[x] != x) f1[x] = get1(f1[x]);
return f1[x];
}
void merge1(int x, int y) {
x = get1(x), y = get1(y);
if (x != y) ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
char s[630000];
int fa[630000];
int val[630000];
vector<int> belong[630000];
int Push(int x) { return x; }
int Unpush(int x) { return m + x; }
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
int u = find(x), v = find(y... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long sz[300009], par[300009];
long long res;
long long n, k;
std::vector<long long> pos[300009];
long long getparent(long long x) {
if (par[x] == x) return x;
return par[x] = getparent(par[x]);
}
void merge(long long x, long long y) {
long long p1 = getparent(x);... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
x = 0;
int fl = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') fl = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0';
ch = getchar();
}
x ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int test = 0;
const int MAXN = 300009;
const long long MOD = 119 << 23 | 1;
class {
public:
vector<int> V[MAXN];
int fa[MAXN], cnt[MAXN];
int n, m;
int findfa(int x) {
if (fa[x] == x) return x;
return fa[x] = findfa(fa[x]);
}
void merge(int x, int y) {
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long llINF = 2e18, llMOD = 1e9 + 7;
const int INF = 2e9, MOD = 1e9 + 7, P = 179, N = 2e3 + 1, K = 23000, L = 18;
const long double EPS = 1e-6, ldINF = 1e18, PI = acos(-1);
template <typename T>
inline void sort_uniq(vector<T>& v) {
sort(v.begin(), v.end());
v... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long maxn = 300005;
const long long inf = 1ll << 50;
int ans = 0;
bool init[maxn];
int par[maxn], sz[maxn], cnt[maxn][2], col[maxn];
vector<int> vec[maxn];
int find(int x) {
if (par[x] == x) {
return x;
}
par[x] = find(... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long llINF = 2e18, llMOD = 1e9 + 7;
const int INF = 2e9, MOD = 1e9 + 7, P = 179, N = 2e3 + 1, K = 23000, L = 18;
const long double EPS = 1e-6, ldINF = 1e18, PI = acos(-1);
template <typename T>
inline void sort_uniq(vector<T>& v) {
sort(v.begin(), v.end());
v... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
a = find(a);
b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct perem {
int t = 0, l = 1, p = -1, q = 0;
};
ifstream fin("AAtest.in.txt");
long long n, k, m, c, vas, cc = 300000;
vector<long long> vv;
string s;
vector<vector<long long>> la;
vector<perem> pr;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
a = find(a);
b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct UF {
vector<int> e;
UF(int n) : e(n, -1) {}
int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
bool join(int a, int b) {
a = find(a), b = find(b);
if (a == b) return false;
if (e[a] > e[b]) swap(a, b);
e[a] += e[b];
e[b] = a;
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long n, k, pa[600010], ct[600010], siz[600010], ans = 0;
vector<long long> g[300010];
string s;
long long find(long long x) {
if (x == pa[x]) return x;
pa[x] = find(pa[x]);
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long maxn = 300005;
const long long inf = 1ll << 50;
int ans = 0;
bool init[maxn];
int par[maxn], sz[maxn], cnt[maxn][2], col[maxn];
vector<int> vec[maxn];
int find(int x) {
if (par[x] == x) {
return x;
}
par[x] = find(... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
char s[630000];
int fa[630000];
int val[630000];
vector<int> belong[630000];
int Push(int x) { return x; }
int Unpush(int x) { return m + x; }
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
int u = find(x), v = find(y... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int inf = 1e9;
int d[maxn], fa[maxn];
int n, k;
char s[maxn];
vector<int> vec[maxn];
int get(int x) {
if (x == fa[x]) return x;
return fa[x] = get(fa[x]);
}
void merge(int x, int y) {
int fx = get(x), fy = get(y);
if (fx != fy) {
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int val[300000 + 100], sum[300000 + 100][2], head[300000 + 100];
int f[300000 + 100];
vector<int> V[300000 + 100];
int n, k;
int ans;
int findd(int x) {
if (f[x] == x) return x;
int F = f[x];
f[x] = findd(f[x]);
val[x] = val[x] ^ val[F];
return f[x];
}
char s[3000... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct perem {
int t = 0, l = 1, p = -1, q = 0;
};
ifstream fin("AAtest.in.txt");
int n, k, m, c, vas, cc = 1000000;
vector<int> vv;
string s;
vector<vector<int>> la;
vector<perem> pr;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cerr.tie(0);
c... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int ans = 0;
int val[600010], fa[600010];
int have[600010][2];
char str[600010];
int n, k;
int find(int x) { return x == fa[x] ? x : (fa[x] = find(fa[x])); }
int other(int u) { return u <= k ? u + k : u - k; }
void update(int u, int x, int y) {
ans -= min(val[u], val[othe... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, inf = 1e9;
int n, kk, s, x, k[N][2];
char ch[N];
int fa[N << 1], val[N << 1];
int find(int u) { return fa[u] ? fa[u] = find(fa[u]) : u; }
void uni(int a, int b) {
if (find(a) == find(b)) return;
val[find(b)] += val[find(a)];
fa[find(a)] = find(b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <class V>
int get_p(V& p, int j) {
if (p[j] == j) return j;
if (p[j] < 0) return p[j] = -get_p(p, -p[j]);
return p[j] = get_p(p, p[j]);
}
int get_min(bool a_j, int S_j, bool coa_j, int coS_j) {
if (!coa_j) return S_j;
if (!a_j) return coS_j;
return std::min(S_j, coS_j);
}
t... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> vec[300005];
int par[300005], sz[300005], bit[300005], sister[300005], ans;
int find(int node) {
if (par[node] == node) return node;
par[node] = par[par[node]];
return find(par[node]);
}
int Union(int a, int b) {
if (!b) return a;
if (sz[a] < sz[b]) sw... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9 + 5;
const int N = 600010;
class DSU {
public:
int p[N], cost[N];
int n;
int ans = 0;
DSU(int _n) : n(_n) {
for (int i = 0; i < n; i++) {
cost[2 * i + 1] = 1;
cost[2 * i] = 0;
}
cost[2 * n] = inf;
cost[2 * n + 1]... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
template<typename T>void read(T&x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')
fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T,typename...Args>i... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
char op[300005];
int n, k, fa[300005], v[300005], num[300005], sz[300005], ans, gx[300005];
vector<int> vec[300005];
int ff(int x) {
if (fa[x] == x) return x;
int f = ff(fa[x]);
v[x] ^= v[fa[x]];
return fa[x] = f;
}
inline void merge(int x, int y, int p) {
if (ff(... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
a = find(a);
b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int N, K, a[MAXN];
vector<int> V[MAXN];
char S[MAXN];
int f1[MAXN], v1[MAXN], f2[MAXN], chs[MAXN], ans;
int get1(int x) {
if (f1[x] != x) f1[x] = get1(f1[x]);
return f1[x];
}
void merge1(int x, int y) {
x = get1(x), y = get1(y);
if (x != y) ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int val[300000 + 100], sum[300000 + 100][2], head[300000 + 100];
int f[300000 + 100];
vector<int> V[300000 + 100];
int n, k;
int ans;
int findd(int x) {
if (f[x] == x) return x;
int F = f[x];
f[x] = findd(f[x]);
val[x] = val[x] ^ val[F];
return f[x];
}
char s[3000... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 6e5 + 10;
int n, k, l[maxn][2];
int fa[maxn], sz[maxn];
string s;
int get_fa(int x) {
if (x == fa[x]) return x;
return fa[x] = get_fa(fa[x]);
}
int calc(int x) {
int y;
if (x <= k)
y = x + k;
else
y = x - k;
x = get_fa(x), y = get_fa(y);... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <class V>
int get_p(V& p, int j) {
if (p[j] == j) return j;
if (p[j] < 0) return p[j] = -get_p(p, -p[j]);
return p[j] = get_p(p, p[j]);
}
int get_min(bool a_j, int S_j, bool coa_j, int coS_j) {
if (!coa_j) return S_j;
if (!a_j) return coS_j;
return std::min(S_j, coS_j);
}
v... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
a = find(a);
b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct perem {
long long t = 0, l = 1, p = -1, q = 0;
};
ifstream fin("AAtest.in.txt");
long long n, k, m, c, vas, kl, cc = 1000000;
vector<long long> vv;
string s;
vector<vector<long long>> la;
vector<perem> pr;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cou... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl '\n'
#define pb push_back
#define ub upper_bound
#define lb lower_bound... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
int pa = find(a)... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 10;
const int apsz = 26;
const int INF = 10000007;
const unsigned long long mod = 97;
const int maxm = 10000 + 10;
struct rev {
int c0, c1, tag;
void maintain() {
c0 = min(c0, INF);
c1 = min(c1, INF);
}
};
rev info[maxn];
int dsu[maxn... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long llINF = 2e18, llMOD = 1e9 + 7;
const int INF = 2e9, MOD = 1e9 + 7, P = 179, N = 2e3 + 1, K = 23000, L = 18;
const long double EPS = 1e-6, ldINF = 1e18, PI = acos(-1);
template <typename T>
inline void sort_uniq(vector<T>& v) {
sort(v.begin(), v.end());
v... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
a = find(a);
b... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
const int oo = 1e9 + 5;
int du[] = {-1, 0, 0, 1};
int dv[] = {0, -1, 1, 0};
const long long mod = 1e9 + 7;
long long sqr(long long x) { return x * x; }
int getbit(int state, int i) { return ((state >> i) & 1); }
int n, m, res, dad[N + 5];
vector<int> g[N ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
return papa[a] = find(papa[a]);
}
bool juntos(int a, int b) { return find(a) == find(b); }
void uni(int a, int b) {
int pa = find(a)... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
long long fac[1] = {1}, inv[1] = {1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mp(long long a, long long b) {
long long ret = 1;
while (... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long shin[25];
long long seto(void);
void ayano(long long x, char spliter = '\n');
int m;
int tans = 0;
vector<int> sts[300005];
vector<int> rs[300005];
int chosen[300005];
int cgst[300005], cgstop = 0;
int visited[300005];
int arr[300005], cnt[300005];
char tstr[30000... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <class V>
int get_p(V& p, int j) {
if (p[j] == j) return j;
if (p[j] < 0) return p[j] = -get_p(p, -p[j]);
return p[j] = get_p(p, p[j]);
}
int get_min(bool a_j, int S_j, bool coa_j, int coS_j) {
if (!coa_j) return S_j;
if (!a_j) return coS_j;
return std::min(S_j, coS_j);
}
t... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct UF {
vector<int> e;
UF(int n) : e(n, -1) {}
int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
bool join(int a, int b) {
a = find(a), b = find(b);
if (a == b) return false;
if (e[a] > e[b]) swap(a, b);
e[a] += e[b];
e[b] = a;
... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 900000;
int papa[MAXN], peso[MAXN], custo[MAXN];
int k;
bool obg[MAXN];
int find(int a) {
if (papa[a] == -1) return a;
papa[a] = find(papa[a]);
obg[a] = obg[papa[a]];
custo[a] = custo[papa[a]];
return papa[a];
}
bool juntos(int a, int b) { return ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 5;
int pre[N], si[N], num[N / 2], n, m;
bool vis[N];
char s[N];
vector<vector<int> > v(N / 2);
int findd(int x) {
if (pre[x] == x) return x;
pre[x] = findd(pre[x]);
if (vis[x]) vis[pre[x]] = 1;
return pre[x];
}
inline int id(int x) { return x > m... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int N, K, a[MAXN];
vector<int> V[MAXN];
char S[MAXN];
int f1[MAXN], v1[MAXN], f2[MAXN], chs[MAXN], ans;
int get1(int x) {
if (f1[x] != x) f1[x] = get1(f1[x]);
return f1[x];
}
void merge1(int x, int y) {
x = get1(x), y = get1(y);
if (x != y) ... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long maxn = 400005;
const long long inf = 1ll << 50;
int ans = 0;
bool init[maxn];
int par[maxn], sz[maxn], cnt[maxn][2], col[maxn];
vector<int> vec[maxn];
int find(int x) {
if (par[x] == x) {
return x;
}
par[x] = find(... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int ans = 0;
int val[600010], fa[600010];
int have[600010][2];
char str[600010];
int n, k;
int find(int x) { return x == fa[x] ? x : (fa[x] = find(fa[x])); }
int other(int u) { return u <= k ? u + k : u - k; }
void update(int u, int x, int y) {
ans -= min(val[u], val[othe... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long llINF = 2e18, llMOD = 1e9 + 7;
const int INF = 2e9, MOD = 1e9 + 7, P = 179, N = 2e3 + 1, K = 23000, L = 18;
const long double EPS = 1e-6, ldINF = 1e18, PI = acos(-1);
template <typename T>
inline void sort_uniq(vector<T>& v) {
sort(v.begin(), v.end());
v... |
1291_E. Prefix Enlightenment | There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, β¦, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 β€ i_1 < i_2 < i_3 β€ k, A_{i_1} β© A_{i_2} β© A_{i_3} = β
.
In one operation, you ... | {
"input": [
"5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n",
"8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n",
"19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n",
"7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n"
],
"output": [
"1\n1\n1\n1\n1\n",
"1... | {
"input": [
"1 1\n1\n1\n1\n"
],
"output": [
"0\n"
]
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int test = 0;
const int MAXN = 300009;
const long long MOD = 119 << 23 | 1;
class {
public:
vector<int> V[MAXN];
int fa[MAXN], cnt[MAXN];
int n, m;
int findfa(int x) {
if (fa[x] == x) return x;
return fa[x] = findfa(fa[x]);
}
void merge(int x, int y) {
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | import bisect
def getsum(tree , i):
s = 0
i += 1
while i>0:
s += tree[i]
i -= i & (-i)
return s
def updatebit(tree , n , i , v):
i+= 1
while i <= n:
tree[i] += v
i += i & (-i)
n = int(input())
x = list(map(int , input().split()))
v = list(map(int , input().spli... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct FenwickTree {
int n;
vector<long long> num;
FenwickTree() : n(0) {}
FenwickTree(int _n) {
n = _n;
num.assign(n, 0);
}
void add(int i, int val) {
for (; i < n; i |= i + 1) num[i] += val;
}
long long sum(int i) {
long long ret = 0;
f... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
int v[n];
for (int i = 0; i < n; i++) cin >> arr[i];
for (int i = 0; i < n; i++) cin >> v[i];
map<int, int> mp;
vector<pair<int, int> > vi;
vector<pair<int, int> > vf;
for (int i = 0; i < n; i++) {
vi.push_ba... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, T;
pair<int, int> a[200010];
long long getval(vector<long long> &f, int pos) {
pos++;
long long ans = 0;
for (int i = pos; i > 0; i -= (i & -i)) ans += f[i];
return ans;
}
void upd(vector<long long> &f, int pos, int val) {
pos++;
for (int i = pos; i < int... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | // Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/*
6666666666666 6666666666666
6 6
6 6
6 6
6 6 ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
class st {
int size;
vector<int> c;
vector<long long> a;
public:
st(int n) {
size = 1;
while (size < n) size *= 2;
c.assign(2 * size, 0);
a.assign(2 * size, 0);
}
void set(int i, long long v, int x, int lx, int rx) ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long MOD = 1e+9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
const long long MAXN = 2e+5 + 8;
vector<long long> adj[MAXN];
lon... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e6 + 7;
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 7;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, -1, +1};
pair<int, int> p[mxn];
map<long long, long long> f, s;
int n;
int a[mxn], ls[mxn];
long long ans;
void upd1(int x, int val) {
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | import io
import os
from collections import Counter, defaultdict, deque, namedtuple
# From: https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/SegmentTree.py
class SegmentTree:
def __init__(self, data, default=0, func=max):
"""initialize the segment tree with data"""
sel... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
from heapq import heappop,heappush,heapify, nlargest
from copy import deepcopy
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct hash_pair {
template <class T1, class T2>
size_t operator()(const pair<T1, T2>& p) const {
auto hash1 = hash<T1>{}(p.first);
auto hash2 = hash<T2>{}(p.second);
return hash1 ^ hash2;
}
};
bool prime[10000001];
long long P = 1000000007 - 2;
long long ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = int(1e9) + 7;
const long long int MOD64 = (long long int)(1e18) + 7;
const int INF = 0x7fffffff;
const long long int INF64 = 0x7fffffffffffffff;
using namespace std;
const int maxn = 1e+5;
struct abc {
long long pos;
long long sp;
} ver[maxn * 2 + 5];
in... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class p6
{
static class Input {
private StringTokenizer tokenizer = null;
private BufferedReader reade... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, c[200005];
long long ans;
struct t {
long long x, y;
int z;
} a[200005];
int lowbit(int x) { return x & (-x); }
void update(int x) {
for (int i = x; i <= n; i += lowbit(i)) c[i]++;
}
int query(int x) {
int s = 0;
for (int i = x; i >= 1; i -= lowbit(i)) s +=... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long N = 1e6 + 5;
const long long M = 1e8;
const long long mod = 1e9 + 7;
const long long INF... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
pair<int, int> a[200005];
vector<int> g;
struct node {
long long w, num;
} tree[1000005];
void update(int x, long long val, int l, int r, int k = 1) {
if (l == r and l == x) {
tree[k].w++;
tree[k].num += val;
return;
}
int mid = l + r >> 1;
if (x <= mi... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void dout() { cerr << '\n'; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
cerr << " " << H;
dout(T...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e5 + 7;
int n, m, cnt[N];
long long sum[N];
pair<i... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MovingPoints {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, MOD = 1e9 + 7;
pair<long long, long long> a[N];
pair<long long, long long> tree[4 * N];
bool compare(pair<long long, long long> p1, pair<long long, long long> p2) {
return p1.first < p2.first;
}
void update(long long node, long long st, long l... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct Point {
LL x, v;
bool operator<(const Point &rhs) const {
if (v == rhs.v)
return x < rhs.x;
else
return v < rhs.v;
}
};
Point p[200010];
LL n, x2[200010], idx[200010], c[200010], s[200010];
void update(LL *arr, LL pos, ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, tot, cnt, v[200001];
long long ans, c1[200001], c2[200001];
struct node {
int x, v;
inline bool operator<(const node &a) const { return x < a.x; }
} s[200001];
inline int read() {
int k = 0, f = 1;
char c;
while ((c = getchar()) < '0' || c > '9')
if (c ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
pair<long long, long long> p[N], a[N];
long long n;
long long fwt[N], cntf[N];
long long len;
void add(long long *b, long long x, long long v) {
while (x <= len) {
b[x] += v;
x += x & -x;
}
}
long long get(long long *b, long long x) ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
long long f[200005], ans, bit[200005], s[200005];
map<long long, long long> m;
long long t, n;
pair<long long, long long> a[200005];
long long get(long long first, long long second) {
long long re = 0, cnt = 0;
for (long long i = second; i > 0... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.*;
import java.util.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Housni Abdellatif
*/
public class Main {
public static void main(String[] args) throws IOException{
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
struct dd {
int gt;
int x;
int v;
};
vector<dd> a;
struct Data {
long long sum;
int sl;
};
Data it[200009 * 8];
Data ans;
long long res;
void update(int i, int l, int r, int pos, int data) {
if (l > pos || r < pos) return;
if (l == r) {
it[i].sum = ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java |
import java.util.*;
import java.util.stream.Collectors;
public class Problem1311F {
static class Pair {
int x;
int y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return String.fo... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | /**
* ******* Created on 1/5/20 2:03 PM*******
*/
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class F1311 implements Runnable {
private static final int MAX = (int) (1E5 + 5);
private static final int MOD = (int) (1E9 + 7);
private static final long Inf = (long) (1... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 1000010;
const long long mod = 998244353;
const long long inf = 1e9;
const long double eps = 1e-16;
const long double pi = acos(-1);
inline long long rd() {
long long p = 0;
long long f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
pair<long long, long long> pos[200005];
struct FenwickTree {
vector<long long> bit;
long long n;
FenwickTree(long long n) {
this->n = n;
bit.assign(n, 0);
}
FenwickTree(vector<long long> a) : FenwickTree(a.size()) {
for (size_t i = 0; i < ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
vector<long> inverse(vector<long>& perm) {
long n = perm.size();
vector<long> ret(n);
for (long i = 0; i < n; ++i) {
ret[perm[i]] = i;
}
return ret;
}
vector<long> assignPermutation(const vector<long>& uniqs) {
long n = uniqs.size();
vector<pair<long, long... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int lowbit(int x) { return x & (-x); }
long long get(vector<long long>& f, int pos) {
long long res = 0;
for (; pos >= 0; pos = (pos & (pos + 1)) - 1) res += f[pos];
return res;
}
void upd(vector<long long>& f, int pos, int val) {
for (; pos < int(f.size()); pos |= ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | //package Round624;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
/**
* @author sguar <shugangcao@gmail.com>
* strive for greatness
* Created on 2020-01-10
*/
public class E {
InputStream is;
PrintWriter out;
pri... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long n, ans, tree[800002], tree1[800002];
map<long long, long long> mp, mp1;
pair<long long, long long> a[300005];
vector<long long> v;
void inc1(int idx, int val) {
for (int i = idx; i <= n; i += i & (-i)) {
tree[i] += val;
}
}
void inc2(int idx, int val) {
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int [][] xi = new int[num][2];
int i=0;
while (i<num){
xi[i][0]... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | import sys
input = sys.stdin.readline
from heapq import heappush, heappop, heapify
def query(f, i):
ret = 0
while i:
ret += f[i]
i -= (i & -i)
return ret
def update(f, i, d):
n = len(f)
while i < n:
f[i] += d
i += (i & -i)
n = int(input())
x = list(map(int, input(... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int l, r;
int cnt = 0;
long long sum = 0;
int left = -1;
int right = -1;
} NIL;
vector<Node> st;
Node merge(Node x, Node y) {
Node z;
z.cnt = x.cnt + y.cnt;
z.sum = x.sum + y.sum;
return z;
}
void add(int u, int x, int v) {
if (not(st[u].l ... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
long long f1[200005], f2[200005], kc;
pair<long long, long long> a[200005];
bool cmp1(pair<long long, long long> x, pair<long long, long long> y) {
return x.first < y.first;
}
bool cmp2(pair<long long, long long> x, pair<long long, long long> y) {
return x.second... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
static int MAX_N = 200000, n;
vector<ll> bitx(MAX_N + 1), bit1(MAX_N + 1);
ll sum(int i, vector<ll> &bit) {
ll res = 0;
while (i > 0) {
res += bit.at(i);
i -= i & -... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void fio() {}
void pti() {
double timeuse = clock() * 1000.0 / CLOCKS_PER_SEC;
cerr << "Timeuse " << timeuse << "ms" << endl;
}
void end() { exit(0); }
namespace io {
const int SIZ = 55;
int que[SIZ], op, qr;
char ch;
template <class I>
inline void gi(I& w) {
ch = get... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class f624 implements Runnable{
public static void main(String[] args) {
try{
new Thread(null, new f624(), "process", 1<<26).start();
}
catch(Exception e){
System.out.println(e);
... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#pragma optimize("O3")
using namespace std;
const long long MOD = 1e9 + 9;
const long long INF = 1e9 + 7;
const int base = 2e5 + 1;
const long long MAX = 1e15 + 1;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MAXN = 2 * 1e5 + 47;
mt19937 rng(chrono::steady_clock::now().time_s... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
pair<long long int, long long int> final[200001];
void up(long long int i, long long int x, long long int j) {
while (i < 200001) {
j == 0 ? final[i].first += x : final[i].second += x;
i += (i & (-i));
}
}
long long int q(long long int i, long long int j) {
lo... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double eps = 1e-4;
const double pi = acos(-1.0);
void debug() { cerr << '\n'; }
template <typename T, typename... Ts>
void debug(T x, Ts... y) {
cerr << "\033[31m" << x << "\033[0m";
if (... |
1311_F. Moving Points | There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ... | {
"input": [
"3\n1 3 2\n-100 2 3\n",
"2\n2 1\n-3 0\n",
"5\n2 1 4 3 5\n2 2 2 3 4\n"
],
"output": [
"3\n",
"0\n",
"19\n"
]
} | {
"input": [],
"output": []
} | CORRECT | java | //package round624;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
public class F {
InputStream is;
PrintWriter out;
String INPUT = "";
void sol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.