source_code stringlengths 26 62k | lang_cluster stringclasses 11
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | difficulty int32 -1 3.5k ⌀ | exec_outcome stringclasses 1
value |
|---|---|---|---|---|---|
// LUOGU_RID: 90672729
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int N=(1<<22)+5;
int a[N],b[N],n,k,curr,dis[N];
void build(int p,int l,int r){
if(l==r){
a[p]=b[l];return;
}
int mid=(l+r)>>1;
build(2*p,l,mid);build(2*p+1,mid+1,r);
a[p]=a[p*2]+a[p*2+1];... | C++ | d975f1a3b42a09da3cb2e549a2ce3046 | 5227caf3b1e2f1fc61033ea87c2c7361 | 2,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,k;
int tr[2][20000005],mx[20000005],mn[20000005],ans[20000005],cnt=1;
vector<int> vec[20];
inline void insert(int x){
int now=1;
for(int i=k-1;~i;i--){
int u=((x>>i)&1);
if(!tr[u][now])tr[u][now]=++cnt,vec[i].push_back(cnt);
now=tr[u][now];
}mn[now]... | C++ | d975f1a3b42a09da3cb2e549a2ce3046 | c32dc801a28a616aca006c1000ba3170 | 2,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int f[1500010],mn[1500010],mx[1500010];/*
inline void print(int ii)
{
for(int i=2;~i;i--)
cout<<((ii>>i)&1);
cout<<endl;
}*/
int main()
{
int n,k;
scanf("%d%d",&n,&k);
memset(f,0x3f,sizeof(f));
memset(mx,-0x3f,sizeof(mx));
memset(mn,0x3f,sizeof(mn));
for(int i=1,x;... | C++ | d975f1a3b42a09da3cb2e549a2ce3046 | 550e60b527bbb8520fe646b0a968bb15 | 2,900 | PASSED |
#pragma GCC optimize("Ofast,unroll-loops")
#include <stdio.h>
#define ll long long
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
const int bl = 670;
int n, m, a[200005], c[300005], d[300005], bad[300005];
ll t, b[200005], e[300005];
int main() {
// code
scanf("%d", &n);
bad[0] = 1... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | a045dbb973aa690caf6433298410d78a | 2,300 | PASSED |
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#include <stdio.h>
#define ll long long
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
const int bl = 670;
int n, m, a[200005], c[300005], d[300005], bad[300005];
ll t, b[200005], e[300005];
int main() {
// code
scanf("%d", &n);
... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | 7852561e79f6ac63a9292b86fc7a83a0 | 2,300 | PASSED |
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,tune=native")
#include <stdio.h>
#define ll long long
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
const int bl = 670;
int n, m, a[200005], c[300005], d[300005], bad[300005... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | 8ac138c306301286bac5f373e3f27890 | 2,300 | PASSED |
#include <stdio.h>
#define ll long long
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
const int bl = 670;
int n, m, a[200005], c[300005], d[300005], bad[300005];
ll t, b[200005], e[300005];
int main() {
// code
scanf("%d", &n);
bad[0] = 1;
for (int i = 1; i <= n; i++) {
sca... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | a10244421175f1fa61937db0c894769a | 2,300 | PASSED |
#include <stdio.h>
#define ll long long
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
const int bl = 670;
int n, m, a[200005], c[300005], d[300005], bad[300005];
ll t, b[200005], e[300005];
int main() {
// code
scanf("%d", &n);
bad[0] = 1;
for (int i = 1; i <= n; i++) {
sca... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | 6472298650914f29d2ea09b98a0b8a91 | 2,300 | PASSED |
#include <bits/stdc++.h>
#define speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define precision \
cout.precision(30); \
cerr.precision(10);
#define ll long long
#define ld long double
#define pb(x) push_back(x)
#define sz(x) (int)x.size(... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | e2b4ef6d623819f2c8992134d74b4dc0 | 2,300 | PASSED |
#include <bits/stdc++.h>
#define speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define precision \
cout.precision(30); \
cerr.precision(10);
#define ll long long
#define ld long double
#define pb(x) push_back(x)
#define sz(x) (int)x.size(... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | 69e5cae27b56ad2af98ec097bd92097d | 2,300 | PASSED |
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#include <bits/stdc++.h>
#define speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cou... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | 879097f2f7155a94c2d6be570bf48f2d | 2,300 | PASSED |
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#include <bits/stdc++.h>
#define speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cou... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | e05c8bb622dbb6ddb626ec59b3301144 | 2,300 | PASSED |
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#include <bits/stdc++.h>
#define speed \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cou... | C++ | 857d84cfbf8c9ce5c95d36b4d2854a88 | dd102c94392d6ab7740be0314c463ace | 2,300 | PASSED |
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC diagnostic error "-std=c++11"
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | d7294c162880f22dad2e15f817140931 | 3,400 | PASSED |
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC diagnostic error "-std=c++11"
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 0ae7db5426bf7b98b9a50d59d659edb0 | 3,400 | PASSED |
/*
start thinking:
BULB:
result of thinking: Pure
f(i, 0/1, j): 前i段并为j段,最后一段长是否为1,方案数
dp算一个通项类似阶乘的东西,可以把n!拆成1*2*...*n依次贡献
start coding: 21:00
AC:
卡常技巧: modadd; 把f(n, 0/1, j)的j!的贡献放到外面,dp只需记2^(>1段个数)之和,
这样可以避免O(n^2)次int64取模操作.
*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast","-funroll-loops"... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 8ba538a1ca158f7f882d41ae92478802 | 3,400 | PASSED |
/*
start thinking:
BULB:
result of thinking: Pure
f(i, 0/1, j): 前i段并为j段,最后一段长是否为1,方案数
dp算一个通项类似阶乘的东西,可以把n!拆成1*2*...*n依次贡献
start coding: 21:00
AC:
卡常技巧: modadd; 把f(n, 0/1, j)的j!的贡献放到外面,dp只需记2^(>1段个数)之和,
这样可以避免O(n^2)次int64取模操作.
*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast","-funroll-loops")... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 2bd6adca1d3a609b3799deca548a377e | 3,400 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define sz(a) ((int)((a).size()))
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
template<const int &MOD>
struct _m_int {
int val;
_m_int(int64_t v = 0) {
if (v < 0) v = v % MOD + MOD;
if... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 2ae1324f3a87b7c0735f17d1735deded | 3,400 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
// #define POJ
#ifdef POJ
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <cfloat>
#include <cstring>
#include <climits>
#include <utility>
#include <set>
#include <map>
#else
#include <bits/stdc++.h... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | f136c26d287f68a423d9c2165501bbea | 3,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct modular_base{
using Type = typename decay<decltype(T::value)>::type;
static vector<Type> MOD_INV;
constexpr modular_base(): value(){ }
template<typename U> modular_base(const U &x){ value = normalize(x); }
template<typename U> static Type n... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 1fd7acd627194f9d337d6121145f8ada | 3,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct modular_base{
using Type = typename decay<decltype(T::value)>::type;
static vector<Type> MOD_INV;
constexpr modular_base(): value(){ }
template<typename U> modular_base(const U &x){ value = normalize(x); }
template<typename U> static Type n... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 78d7f8a24e99474ff88dd2a24ff84732 | 3,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct modular_base{
using Type = typename decay<decltype(T::value)>::type;
static vector<Type> MOD_INV;
constexpr modular_base(): value(){ }
template<typename U> modular_base(const U &x){ value = normalize(x); }
template<typename U> static Type n... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | bf4e73fecccf38df4fa2db75fc2ed502 | 3,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct modular_base{
using Type = typename decay<decltype(T::value)>::type;
static vector<Type> MOD_INV;
constexpr modular_base(): value(){ }
template<typename U> modular_base(const U &x){ value = normalize(x); }
template<typename U> static Type n... | C++ | 732638c1481bf591cf8caf00f1bd8fe9 | 4f98210920ad948f97d2a495e3c1e5c3 | 3,400 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | c208928691cafc5fa8b98431eba57bdc | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | 9fdc28989a7d08d286560d6baca35752 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | cf339b4d2ae8a70d24a47a3fb685a369 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | e55b06f37d7e9a295f74dfb7d0d94158 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | bcb3c140919f055c1c271d19a33f4ed0 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | 92742bcdde2584b394a8bdd57fabdb8d | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | a0766391ec34a7edde89ad5640602ab8 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | 3c77603268aeb3481d741a6d910d51df | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | 96cc507fdec744d8cfa9dfab39942dd6 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | 7f71bea1c62b0a027c8d55431fbc7db7 | 0995844a395af0caa1a9b7d2e2a51c73 | 1,600 | PASSED |
#include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int a, b;
scanf("%d %d", &a, &b);
if (a == 0)
{
printf("1\n");
}
else
{
printf("%d\n", (a + (2 * b) + 1));
}
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | a711b7428e8589cf8db7d38c959844c3 | 800 | PASSED |
#include<stdio.h>
int main()
{
int a,b,s,i=0,t;
scanf("%d",&t);
while(i<t){
scanf("%d %d",&a,&b);
if(a==0){
s=1;
}
else if(a!=0){
s=b*2+a+1;
}
printf("%d\n",s);
printf("\n");
i++;
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | 76af3d598267d81aa341fe0f47ae1189 | 800 | PASSED |
#include<stdio.h>
int main()
{
int a, b;
int s;
scanf("%d",&s);
while (scanf("%d %d" ,&a, &b) != EOF)
{
int c = 0;
if (a == 0)
{
c = 1;
}
else
{ c = a + b * 2 + 1; }
printf("%d\n",c);
}
return 0;
}
... | C++ | 2b6e670b602a89b467975edf5226219a | 1f33a0e9118863ab50e50fd34f4546fc | 800 | PASSED |
#include<iostream>
using namespace std;
int main()
{
int t;
int a,b;
cin >> t;
while(t--)
{
cin >> a >> b;
if(a == 0)
{
cout << 1 << endl;
continue;
}
cout << a+2*b+1 << endl;
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | bbacc9af523454e24cb2888e5813dce3 | 800 | PASSED |
#include<stdio.h>
int main()
{
int t,a,b;
scanf("%d",&t);
while(t--){
scanf("%d%d",&a,&b);
if(b==0&&a!=0){
printf("%d\n",a+1);
}
if(a==0){
printf("1\n");
}
if(a!=0&&b!=0){
printf("%d\n",a+2*b+1);
}
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | 7d9639bd4ac8f45a2c08a7f0a2a7b6bb | 800 | PASSED |
#include <cstdio>
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;
int main ()
{
long long t;
long long s=0;
cin>>t;
while (t--)
{
long long a,b;
cin >>a >>b;
if (a==0)
{
s = 1;
}
else s=a+2*b+1;
cout << s<<"\n";
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | 18b5ac7ae65a34272e0835983f37a5cb | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,a,b;
cin>>x;
while(x--){
cin>>a>>b;
if(a==0)cout<<1<<endl;
else if(b==0)cout<<a+1<<endl;
else if(a!=0&&b!=0)cout<<a+2*b+1<<endl;
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | 19e229a7770492020b4b790fd79c3bd6 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
ll t;
void solve() {
cin >> t;
for (ll i = 0; i < t; i++) {
ll x, y;
cin >> x >> y;
if (x == 0) {
cout << 1 << endl;
} else {
cout << x + y * 2 + 1 << endl;
}
}
}
int main() {
solve();
}
... | C++ | 2b6e670b602a89b467975edf5226219a | d50c5602e1a021e2307b759cd8fef697 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int t,a,b;
int main(){
cin>>t;
for(int i=1;i<=t;++i){
cin>>a>>b;
if(!a) cout<<1<<endl;
else if(!b) cout<<a+1<<endl;
else cout<<a+2*b+1<<endl;
}
return 0;
}
| C++ | 2b6e670b602a89b467975edf5226219a | 951ee426ebfd6a7a8291aeb8c2fb29dd | 800 | PASSED |
//Author:Zealous_YH
//Hai Bian & Xiao Bao
#include <bits/stdc++.h>
#define ET return 0
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define bk break
#define ctn continue
#define inf INT_MAX
#define uinf INT_MIN
#define prq priority_queu... | C++ | 2b6e670b602a89b467975edf5226219a | b6275e30755c36f5cde6ba139b0989fb | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using INT = long long;
const int NN = 2e5 + 10;
char s[NN];
int A[NN], sum[NN], B[NN];
vector <int> vec[5];
int n;
int calc(int u, int ans = 0){
for(; u; u ^= u & -u) ans += B[u];
return ans;
}
void update(int u, int val){
for(; u <= n; u += u & -u) B[u] += val;
}
bool ... | C++ | 19a3247ef9d10563db821ca19b0f9004 | e05a8cfcdc808868a857c2eb7686dd86 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using INT = long long;
const int NN = 4e5 + 100;
INT a[NN];
INT n, nm[5], B[5][NN], BIT[5][NN];
char s[NN];
void update(int u, int f, int x){
for(;u <= 2*n + 1;u += u & -u) BIT[f][u] += x;
}
int calc(int u, int f, int ans = 0){
for(;u;u -= u & -u) {
ans += BIT[f][u];
}... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 420fb6e5927fc704f9b339b8e16e1c58 | 2,100 | PASSED |
#include <bits/stdc++.h>
#define NN 1000100
#define INT long long
#define INF 1000000007
#define pii pair<INT,INT>
#define x first
#define y second
using namespace std;
int A[NN],B[NN],C[NN],D[NN],ans[NN];
int n;
void add(int u){
for(;u<=4*n;u+=u&-u){
C[u]++;
}
}
int calc(int u){
int ans=0;
u--;
for(;u;u-=u&-u){... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 338f14f7c6ba29e066f430fb3b04144e | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define NN 200010
char s[NN];
int a[NN], b[NN], c[NN];
int B[NN], n;
void update(int u) {
while (u > 0) {
B[u]++;
u -= u & (-u);
}
}
int calc(int u) {
int ss = 0;
while (u <= n + 1) {
ss += B[u];
u += u & (-u);
}
return ss;
}
vector<int> vec[5];
int main... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 63ab2a581b69537f41265afe8f85e20f | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using INT=long long;
const int NN=272727;
char s[NN];
int N;
struct Bit {
int B[NN];
void init() {
for(int i=0;i<=N;i++) B[i]=0;
}
void update(int u,int x) {
for(;u<=N;u+=u&-u) B[u]+=x;
}
int calc(int u) {
int ans=0;
for(;u>0;u^=u&-u) ans+=B[u];
return ans;
... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 2cadfa10fc13b1f6c061d5651fe8fa37 | 2,100 | PASSED |
#include<bits/stdc++.h>
#define NN 200100
#define ls (u << 1)
#define rs (ls | 1)
#define mid (l + r >> 1)
using namespace std;
using INT=long long;
int flag[NN<<2], mn[NN<<2][4], mx[NN<<2][4];
int cnt[NN<<2][4];
void push_up(int u) {
for(int i = 0; i < 3; i ++) {
mx[u][i] = max(mx[ls][i], mx[rs][i]);
mn[u][i] =... | C++ | 19a3247ef9d10563db821ca19b0f9004 | aa04d93ddbf14dfc6079966cada52cc4 | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using INT = long long;
const int NN = 402020;
const int D = 2e5;
char s[NN];
int b[NN][3];
vector<int> buf;
int update(int u, int sg) {
u += D;
buf.push_back(u);
for(; u < NN; u += u &-u) b[u][sg] ++;
}
int init() {
for(auto u : buf) {
for(; u < NN; u += u &-u) {... | C++ | 19a3247ef9d10563db821ca19b0f9004 | fe980c73d4399814e57954a20163ac9d | 2,100 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=998244353;
int a[200005],b[200005];
char s[200005];
int q[200005*4][3];
int sum[200005];
int sum1[200005][3];
struct duqi{
int k,i;
};
duqi qi[200005];
bool cmp1(duqi a1,duqi a2){
return a1.k>a2.k;
}
void xg(int i,i... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 30c91a99b2463777ae5dae672046321c | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define intt long long int
#define F first
#define S second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
const int N=4e5+500;
int ftree[N][3];
int bal=2e5+5;
int n;
void upd(int num,int i,int size... | C++ | 19a3247ef9d10563db821ca19b0f9004 | 6ecbb54d0f96187fd0f52c266c18931f | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define intt long long int
#define F first
#define S second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
const int N=4e5+500;
int ftree[N][3];
void upd(int num,int i,int size,int type) // by increment... | C++ | 19a3247ef9d10563db821ca19b0f9004 | a56671dbf80b4ea136a6fed73461039c | 2,100 | PASSED |
// LUOGU_RID: 91315028
#include<bits/stdc++.h>
using namespace std;
const int N=3050;
char s[N];
int main(){
int T;
for(scanf("%d",&T);T--;){
int n,ans=0;
scanf("%d%s",&n,s+1);
for(int l=1;l<=n;++l){
int c1=0,c2=0,c3=0,t=0;
for(int r=l;r<=n;++r){
s[r]=='-'?(++c2,t==0?(t=1):(++c3,t=0)):(++c... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 583c7ba2deb0fa537fcd3998fbcd42f5 | 1,700 | PASSED |
// LUOGU_RID: 91237222
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int sf[3010], sz[3010];
int main() {
int t;
cin >> t;
while (t--) {
int n, ans = 0;
cin >> n;
string s;
cin >> s;
sf[0] = s[0] == '-';
sz[0] = s[0] == '+';
for (int i = 1; i <... | C++ | 802e4d90444b371a1dbab10d3d589e55 | d3a464f62b42b82e228c9fcfeb047731 | 1,700 | PASSED |
// LUOGU_RID: 90180743
#include<iostream>
using namespace std;
string s;
int main() {
int T;
cin>>T;
while(T--) {
int n;
cin>>n>>s;
int ans=0;
for(int i=0;i<n;i++){
int x=0,y=0;
for(int j=i;j<n;j++){
if(s[j]=='+')y++;
... | C++ | 802e4d90444b371a1dbab10d3d589e55 | b0a4a13d8c2250e66f25406b78a0b5bb | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int T,n,a[3005],x,y,p,l,ans;
char c;
char get()
{
char c=getchar();
while(c=='\n'||c==' '||c=='\r')
{
c=getchar();
}
return c;
}
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
c=get();
if(c=='+')... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 35339ab7a514ec3ae81bba61aa71e682 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int t, n, ans;
string s;
int main() {
cin >> t;
while(t--) {
ans = 0;
cin >> n >> s;
for(int i = 0; i < n; i++) {//起始位置
int f = 0, z = 0;
for(int j = i; j < n; j++) {//长度
if(s[j] == '+') z+... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 46389d4d614058e3de1b22dd84d77b30 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int t,n,ans;
string s;
int main(){
cin >> t;
while(t--) {
ans = 0;
cin >> n >> s;
for(int i = 0;i<n;i++) {
int f=0,z=0;
for(int j=i;j<n;j++) {
if(s[j]=='+'){
z++;
}el... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 023489c48fe2ad6b6b375addf914139e | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int n, T, ans;
string s;
int main()
{
cin >> T;
while(T--)
{
ans = 0;
cin >> n >> s;
for(int i = 0; i < n; i++)
{
int x = 0, y = 0;
for(int j = i; j < n; j++)
{
... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 11796f04f1f37a14a30545ada687e352 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e3+5;
int T;
int n;
int b[MAXN];
int main()
{
scanf("%d",&T);
while(T--)
{
int d = 0;
scanf("%d",&n);
memset(b,0,sizeof(b));
for(int i=1;i<=n;++i)
{
char c;
cin >> c;
if(c=='+')
b[i] = 1;
else
b[i] ... | C++ | 802e4d90444b371a1dbab10d3d589e55 | 4457cabf1537d8a011a1014093a8d884 | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define debug(x) cout<<#x<<" = "<<x<<endl;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int mod = 1e9 + 7;
const int N = 10 + 2e5;
int n, sum... | C++ | 802e4d90444b371a1dbab10d3d589e55 | bbd9a9ec31d1db5f755bf7156c0d01f8 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
int Q,n;
int m... | C++ | 802e4d90444b371a1dbab10d3d589e55 | ea20b7c072eb4153b8c7798f4577ea78 | 1,700 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define For(a, b, c) for (int a = b; a <= c; a ++)
#define Rev(a, b, c) for (int a = b; a >= c; a --)
using namespace std;
const int N = 4e3+5, P = 131, INF = 0x3f3f3f3f;
char a[N][N];
int s[N][N];
int p[N][N];
inline int solve() {
//memset(... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | 30780fd3d47b01ff176092b559685489 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
char s[4001][4001];
int sum[4001][4001];
int p[4001][4001];
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
int ans=0x3f3f3f3f;
scanf("%d",&n);
getchar();
for(int i=1; i<=2*n; ++i)
for(int j=1; j<=2*n; ++j)
sum[i][j] = 0;
for(int i=1;... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | c2924c64e88fa1090989359a5e0410cb | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<pair<int, int>,null_type,less<pair<int,int>>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bm... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | 01eae3ed3581ec14b8922193ca88b192 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | 29c946b69e75c85e2687fd643b40cd4c | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | d9608a5632c1827822a100d114eab544 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | e78c089a9b4154bc95474a09532e7558 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | c119b35cfe1ea90b7c828ab686bc356b | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | 040bf012404833a9a26583b94234ff0e | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | 649ebf46f0034955fb59e3848e972fc3 | 1,600 | PASSED |
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#... | C++ | d174982b64cc9e8d8a0f4b8646f1157c | d958ec2a9c82cf24e44233b462832fb4 | 1,600 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int TC = 1; cin >> TC;
while(TC--) {
int n; cin >> n;
int arr[n];
for(int i = 0; i < n; ++i) cin >> arr[i];
if(n == 1) {
... | C++ | 8b926a19f380a56018308668c17c6928 | 239e6adc855b74b397e72b5596ca8039 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long INF = INT_MAX;
int main() {
int t;
cin >> t;
while (t--){
long long n;
cin >> n;
long arr[n];
for(int i=0;i<n;i++){
cin >> arr[i];
}
sort(arr,arr+n);
if(n==1 and arr[0]>1)
... | C++ | 8b926a19f380a56018308668c17c6928 | 7f0fc3a1f3b4d6b5a682ac5556b891e3 | 800 | PASSED |
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<iostream>
int a[200000];
using namespace std;
int main(void){
int casos,tamanho;
scanf("%d", &casos);
while(casos--){
scanf("%d", &tamanho);
for(int i=0;i<tamanho;i++){
cin>>a[i];
}
sort(a,a+tamanho... | C++ | 8b926a19f380a56018308668c17c6928 | 6210f91130159f1332d456a358e5021a | 800 | PASSED |
#include <iostream>
using namespace std;
int main() {
int t, n, aFirst, aSecond, aux;
cin >> t;
while(t--)
{
aFirst = aSecond = 0;
cin >> n;
while(n--)
{
cin >> aux;
if(aux > aFirst)
{
aSecond = aFirst;
... | C++ | 8b926a19f380a56018308668c17c6928 | e5dd6b1683e6615a73d6281d358b5fc9 | 800 | PASSED |
#include <iostream>
using namespace std;
int t,n,a,b,m;
int main(){
cin>>t;
for(int i=1;i<=t;i++){
cin>>n;
a=0;b=0;
for(int j=1;j<=n;j++){
cin>>m;
if(m>a){
b=a;
a=m;
}
else if(m>b)
b=m;
}
if(a-b>1)
cout<<"NO"<<endl;
else cout<<"YES"<<... | C++ | 8b926a19f380a56018308668c17c6928 | b2054843e4d1ae28ef75c26294c8158c | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin >>n;
int a[n+3];
for (int i = 0; i < n; ++i)
{
cin >>a[i];
}
sort(a,a+n);
if(n==1)
{
if(a[0] >1)
cout <<"NO"<<endl;
else
cout <<"YES"<<endl;
}
else
{
... | C++ | 8b926a19f380a56018308668c17c6928 | fd1cd98a2ccd272f62c9dcfad69def12 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
vector<int>candy;
int main() {
int T,n,a;
cin>>T;
while(T--)
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
candy.push_back(a);
}
sort(candy.begin(),candy.end(),greater<int>());
if(candy.size()==1 && candy[0]>1) cout... | C++ | 8b926a19f380a56018308668c17c6928 | 26807b473e75408fd1ef3d58c3c04366 | 800 | PASSED |
//E-M-M-I-N-T-Y\\
#include <bits/stdc++.h>
#include <unordered_map>
#include <numeric>
#define _USE_MATH_DEFINES
#define what_is(x) cerr << #x << " is " << x << endl;
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
typedef long long ll;
int main() {
FastIO
#ifndef ONLINE_JUDGE
... | C++ | 8b926a19f380a56018308668c17c6928 | d4ea06ef0769bfcd480410fd25c12b25 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int tc, cs = 1;
void test_cases() {
int n; cin >> n;
vector<int> v(n);
for (int i = 0; i < n; ++i) cin >> v[i];
sort(v.begin(), v.end());
if (n == 1) {
if (v[0] > 1) cout << "NO" << '\n';
else cout << "YES" << '\n';
return;
}... | C++ | 8b926a19f380a56018308668c17c6928 | a70378b3621997445d1d0f0ecce2ea2b | 800 | PASSED |
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
//#define int long long
using namespace std;
const int maxm=2e5+5;
int cs,n,a[maxm],t;
bool flag;
signed main(){
cin>>cs;
while(cs--){
cin>>n;
for(int i=0;i<n;++i)
cin>>a[i];
if(n==1){
if(a[0]=... | C++ | 8b926a19f380a56018308668c17c6928 | dd18bd0484a12b2f04f31669704dcae5 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1e5
#define endl '\n'
#define tcs int t;cin>>t;while(t--)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define sp ' '
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin()... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | 02c7998aa6a8f2b02c2cfea2dbb0f639 | 1,300 | PASSED |
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<iomanip>
#include<sstream>
#include<cstring>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ul unsigned long long
#define ll long long
using namespace std;
//欧拉筛... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | 907bc9b496d76fa6f1875ba808828db7 | 1,300 | PASSED |
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<iomanip>
#include<sstream>
#include<cstring>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define ul unsigned long long
#define ll long long
using namespace std;
//欧拉筛... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | eef2db5f82a34581e3ecb5012816d289 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int inf = 1000000;
int main() {
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int n = s.size();
vector <vector <int>> dp(n + 1, vector <int>(27, inf));
dp[0][26] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 27; j++) {
dp[i ... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | 1a2b5c9520507257aeff6a64a47a9d76 | 1,300 | PASSED |
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define all(a) a.begin(), a.end()
#define sz(s) (int)s.size()
// vector<vector<char>>a(n, vector<char>(n));
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | 292040c9cf215a82be09c85930975bb0 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
void resetaFrequencia(map<char, int> &f) {
string alfabeto = "abcdefghijklmnopqrstuvwxyz";
for (auto letra : alfabeto) f[letra] = 0;
}
int main() {
int t;
cin >> t;
while (t--) {
string s; cin >> s;
int n = s.size();
map<char... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | d7f19706663af699a8d5b7ea01a2e1ad | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
string s;
int cnt[30];//a=0
int ans=0;
int main(){
ios::sync_with_stdio(false);
cin.tie();cout.tie();
int tt;
cin>>tt;
while(tt--){
memset(cnt,0,sizeof(cnt));
cin>>s;
ans=s.length();
for(int i=0;i<s.length();++i){
++cnt[s[i]-97];
if(cnt[s[i]-97]==2){
... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | ca251ff92f549829edc4e37dd28626b5 | 1,300 | PASSED |
#include<bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long long mod=1e9+7;
const int maxn=10000007;
const int N=2e5+5;
int t,n,i,k;
pair<int,int>p[200005];
int a[20000... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | e7ad661c3bb0dfbfdd9d0cc9bce5c457 | 1,300 | PASSED |
#include<iostream>
#include<string>
using namespace std;
void clear(int m[],int n){
for(int i = 0;i < n;i ++){
m[i] = 0;
}
}
int main(){
int t;
cin >> t;
for(int i = 0;i < t;i ++){
int m[26];
clear(m,26);
int evenNum = 0;
string s;
cin >> s;
for(int i = 0;i < s.size();i ++){
m[s[i]-'a'] ++;
i... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | f100ab3e65a828a5c7534b5cb1909262 | 1,300 | PASSED |
// (•◡•) Ramez_Emad (>‿◠)✌
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
speed
ll t ;
cin>>t;
while(t--)
{
string str;
cin >> str;
int len = str.length() ;
map< int ... | C++ | 6b92f09df1e35edc80cf1cbf8494b41e | 4beaeac0e599151486f36bc8b5e82714 | 1,300 | PASSED |
#ifdef ONLINE_JUDGE
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#endif
#include <bits/stdc++.h>
using namespace std;
static struct FastInput {
static constexpr int BUF_SIZE = 1 << 20;
char buf[BUF_SIZE];
size_t chars_read = 0;
size_t buf_pos = 0;
FILE *in = stdin;
char cur = 0;
... | C++ | f3810a3e779083e51128b0c13b55b7df | 0037f598cbeac574529cd2ce8e2d7a33 | 2,900 | PASSED |
#line 1 "sol.cpp"
// #include "debug.h"
#include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
std::vector<int> is_base(n);
for (int i = 0; i < n; ++i) {
scanf("%d", &is_base[i]);
}
std::vector<std::vector<int>> tree(n);
for (int i = 0, a, b; i < n - 1; ++i) {
scanf("%d%d", &a, &b);
a... | C++ | f3810a3e779083e51128b0c13b55b7df | 6814b40a275c87d7a3e42cfdcaf9fc78 | 2,900 | PASSED |
//Awwawa! Dis cold yis ratten buy Pikachu!
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<ll>
#define pi pair<int, int>
#define mod 1000000007
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0... | C++ | f3810a3e779083e51128b0c13b55b7df | e496e825e72e64f6a30c887bf0ccb3f6 | 2,900 | PASSED |
//Awwawa! Dis cold yis ratten buy Pikachu!
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<ll>
#define pi pair<int, int>
#define mod 1000000007
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0... | C++ | f3810a3e779083e51128b0c13b55b7df | 679e313bf72744a0085128b4a359436b | 2,900 | PASSED |
/**
* @file 1654G.cpp
* @author Macesuted (i@macesuted.moe)
* @date 2022-06-09
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif
bool mem1;
#define maxn 200005
typedef pair<int, int> pii;
int h[maxn], d[maxn], b... | C++ | f3810a3e779083e51128b0c13b55b7df | f2cb3c3b586f9bcd0f5e0c42bdaf6dea | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, d[N], z[N], c[N], q[N << 1], l, r, u, v;
vector<int> G[N], a[N];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i = 0; i < n; i++) cin >> d[i], d[i] ? q[r++] = i : 0;
for(int i = 1; i < n; i++) cin >> u >> v, G[--u].push... | C++ | f3810a3e779083e51128b0c13b55b7df | 0b3ed650f6845cf1fb36c33bb929b2e2 | 2,900 | PASSED |
#include<cstdio>
#include<cstring>
#define N 3000001
#define mod 998244353
using namespace std;
long long jc[N],njc[N],f[N],g[N],pre[N],suf[N],h[N],g1[N],SG[N],PSG[N],rev[N],a[N],b[N],c[N];
long long r1[111][200011],r0[111][200011],s1[200011][111];
int p_suf[N],stack[N],snum[111][111];
int n,m,len,SMAX;
bool c... | C++ | 42c82423da85da63dbf0ac108db4e2d9 | 7597b20dd0a583e7633bcbf87022b1d5 | 3,500 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.