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 |
|---|---|---|---|---|---|
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int t, n, m, k, p, a[20000], b[20000], c[20000];
cin >> t;
for (int i = 1; i <= t; i++)
{
int d = 0, x = 1, y = 1;
p = 1;
cin >> k >> n >> m;
for (int j = 1; j <= n; j++)
{
cin >> ... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | 19fefca1a5cc1280bf2169fa3a3f85f9 | 1,100 | PASSED |
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int t, n, m, k, p, a[20000], b[20000];
cin >> t;
for (int i = 1; i <= t; i++)
{
vector<int>c;
int d = 0, x = 1, y = 1;
p = 1;
cin >> k >> n >> m;
for (int j = 1; j <= n; j++)
{
... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | c03033a31686ea07dcacaf29b0fa2a8f | 1,100 | PASSED |
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{int k,n,m;
cin>>k>>n>>m;
int mono[301],poly[301];
for(int i=0;i<n;i++)cin>>mono[i];
for(int i=0;i<m;i++)cin>>poly[i];
in... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | b1675f92fb3c94aff216f60a1df86918 | 1,100 | PASSED |
#include <iostream>
using namespace std;
#define maxMN 100
int n, m, k, t;
int a[maxMN], b[maxMN], c[2 * maxMN];
void parsing()
{
int i = 0, j = 0, p = 0;
for (; i < n || j < m;)
{
if (i < n && a[i] == 0)
{
k++; c[p++] = a[i++];
}
else
if (j < m && b[j] == 0)
{
k++; c[p+... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | ad5aee05fc9882887a2606929ef20817 | 1,100 | PASSED |
#include <iostream>
#include<vector>
#include <climits>
#include<map>
#include<list>
#include<set>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include <deque>
#include<cstring>
#include<cmath>
#include<bitset>
#include<string>
#include<unordered_set>
#include<unordered_map>... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | 3305f5b803439e169a3ca8ff9e3b6188 | 1,100 | PASSED |
#include <iostream>
#include<vector>
#include <climits>
#include<map>
#include<list>
#include<set>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include <deque>
#include<cstring>
#include<cmath>
#include<bitset>
#include<string>
#include<unordered_set>
#include<unordered_map>... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | 8b9d3cd06a675db40d417d0922454292 | 1,100 | PASSED |
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int a[101],b[101],c[301];
int k0,n,m;
void result()
{
int sum=k0;
int i=0;
int j=0;
int k=0;
while(i<n||j<m)
{
if(a[i]==0&&i<n)
{
c[k++]=a[i];
i++;
sum++;
continue;
}
else if(b[j]==0&&j<m)
... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | b13539b0b96a0cd59ef37345cbdd2e4d | 1,100 | PASSED |
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int k, m, n, a[101], b[101], ans[202], zero = 0, dem = 0;
cin >> k >> n >> m;
bool yes = true;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < m; i++)
cin >> b[i];
in... | C++ | 6628bd89b4d4fdfa90d2357f7cc1b795 | 2865fd73f6351314c160c565ecf9ea38 | 1,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--) {
int a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e >> f;
if (a == c && b == d){
cout << "0" << endl;
}
else if (a == c && a == e && f >= min(b, d) && f <= max(b, d)){
... | C++ | 6422d76f71702e77808b1cc041962bb8 | 337f1a2c67aaea4e240857cbb6e459df | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int t;
int a1,a2,b3,b4,f5,f6;
int main()
{
cin>>t;
for(int i=1;i<=t;i++)
{
cin>>a1>>a2>>b3>>b4>>f5>>f6;
if(a1==b3&&a1==f5)
{
if(f6>min(a2,b4)&&f6<max(a2,b4))
{
cout<<max(a2,b4)-min(a2,b4)+2<<endl;
continue;
}
cout<<max(a2,b4)-min... | C++ | 6422d76f71702e77808b1cc041962bb8 | 4629d5801f8bd73573ef9e5d2d1e0006 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int x1, x2, x3, y1, y2, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
if(x1 == x2 && x2 == x3)
{
if((y1 < y3 && y3 < y2) || (y2 < y3 && y3 < y1))
cout << abs(y1 - y2) + 2 << "\n";
else
cout ... | C++ | 6422d76f71702e77808b1cc041962bb8 | 0d359a7feeaca527075375ea045739a3 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
inline int read_int() {
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9') {
if(ch=='-') {
w=-1;
}
ch=getchar();
}
while(ch>='0'&&ch<='9') {
s=s*10+ch-'0';
ch=getchar();
}
return s*w;
}
struct node {
int x;
int y;
};
node a,b,f;
... | C++ | 6422d76f71702e77808b1cc041962bb8 | 2639affa03e8ba0ad79267a8b43f094a | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int ax,ay,bx,by,fx,fy;
bool flag;
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>ax>>ay;
cin>>bx>>by;
cin>>fx>>fy;
int s;
s=abs(ax-bx)+abs(ay-by);
flag=0;
if(ax==fx&&bx==fx&&((ay<fy&&by>fy)||(ay>fy&&by<fy)))
flag=1;
if(ay==fy&&by==f... | C++ | 6422d76f71702e77808b1cc041962bb8 | 7084bc4071abbb6bf9027d569b606920 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int ax,ay,bx,by,fx,fy;
bool c;
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>ax>>ay;
cin>>bx>>by;
cin>>fx>>fy;
int min1=abs(ax-bx)+abs(ay-by);
c=false;
if(ax==fx&&bx==fx&&((ay<fy&&by>fy)||(ay>fy&&by<fy)))
c=true;
if(ay==fy&&by==fy&&((ax<... | C++ | 6422d76f71702e77808b1cc041962bb8 | 626a99af53bb6505ad50de9856f34c81 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int t,x,y,x0,y0,xt,yt;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>t;
while(t--)
{
cin>>x0>>y0;
cin>>x>>y;
cin>>xt>>yt;
if(x0==x&&x==xt&&((yt>y&&yt<y0)||(yt<y&&yt>y0)))
{
cout<<abs(y-y0)+abs(x-x0)+2<<endl;
}
e... | C++ | 6422d76f71702e77808b1cc041962bb8 | e55843d0047b73ec1a7c64667dd55b8c | 800 | PASSED |
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int t,xa,ya,xb,yb,xf,yf;
cin>>t;
for (int i=1;i<=t;i++)
{
cin>>xa>>ya;
cin>>xb>>yb;
cin>>xf>>yf;
int a=0;
a=fabs(xa-xb)+fabs(ya-yb);
if ((xa==xb&&xb==xf)&&(ya<yf&&yf<yb||yb<yf&&yf<ya)) a+=2;
if ((ya==yb&&yb==yf)&&(xa<xf&&xf<xb||xb... | C++ | 6422d76f71702e77808b1cc041962bb8 | ff54c265f7403a0addc14be48efe89ad | 800 | PASSED |
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int ax,ay,bx,by,fx,fy;
bool flag;
int main(){
int t;
cin>>t;
while(t--){
cin>>ax>>ay;
cin>>bx>>by;
cin>>fx>>fy;
int smal=abs(ax-bx)+abs(ay-by);
flag=0;
if(ax==fx&&bx==fx&&((ay<fy&&by>fy)||(ay>fy&&by<fy)))flag=1;
... | C++ | 6422d76f71702e77808b1cc041962bb8 | 08f5e6f9f3e644e981d65601b5d8dce1 | 800 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
int ax,ay,bx,by,fx,fy;
bool flag;
int main(){
int t;
cin>>t;
while(t--){
cin>>ax>>ay;
cin>>bx>>by;
cin>>fx>>fy;
int dis=abs(ax-bx)+abs(ay-by);
flag=false;
if(ax==fx&&bx==fx&&((ay<fy&&by>fy)||(ay>fy&&by<fy)))flag=1;
if(ay==fy&&... | C++ | 6422d76f71702e77808b1cc041962bb8 | 166056ed90b4b0313a17cabd3153bf1b | 800 | PASSED |
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<cctype>
#include<set>
#include<unordered_set>
#include<cstring>
#include<numeric>
#include<limits>
#include<limits.h>
#include<bitset>... | C++ | 8d25700c9996a80fea3557222273c89a | 2f909aaa32542ee861e7ee9d1a72bf0f | 1,300 | PASSED |
#include <vector>
#include <iostream>
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long int
#define double double_t
#define INF 1e18
using namespace __gnu_pbds;
using namespace std;
template<typename T>
using ordered_set = tree<T, null_type, less<... | C++ | 8d25700c9996a80fea3557222273c89a | 75f388cbe6ecdceaa16ce7e62de668b1 | 1,300 | PASSED |
#include<bits/stdc++.h>
#define arisu ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define scase sf ("%d",&tc)
#define ull unsigned long long
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define fr(i,x,n) for(int (i) = (x) ; (i) < (n) ; ++(i))
#define fre(i,x,n) for(int (i) = (x) ; (i) <= (n) ; ++(... | C++ | 8d25700c9996a80fea3557222273c89a | 7290f9afe4a9966b5409de0591419c8f | 1,300 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
# include<map>
# include<iomanip>
# include<vector>
# pragma optimize(2)
using namespace std;
typedef long long int ll;
int a[200000+10];
int main ()
{
int t;
cin>>t;
while(t-... | C++ | 8d25700c9996a80fea3557222273c89a | d8ec891f449a191ed77a424888c8768a | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define se second
#define fi first
#define el "\n"
#define ll long long
#define all(a) a.begin(),a.end()
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PREC cout.precision(20);
const ll mod = 1e9 + 7,... | C++ | 8d25700c9996a80fea3557222273c89a | 3e81f13b2f98f2d72116e7b002aabd16 | 1,300 | PASSED |
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#define endl '\n'
#define ll long long
using namespace std;
const int N = 2e5+10;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int tc;cin>>tc;
while(tc--)
{
int n;cin>>n;
ll arr[n]... | C++ | 8d25700c9996a80fea3557222273c89a | bbf1e6e6a4b7669835bf6e47207feedf | 1,300 | PASSED |
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int MAX=2e5+5;
int x[MAX];
int y[MAX];
int main() {
int T;
cin >> T;
while (T--) {
memset(y, 0, sizeof(y));
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
int temp = x[i];
if (i) {
for (int j = ... | C++ | 8d25700c9996a80fea3557222273c89a | f58ec6f2ea56f570b5853274549c06f5 | 1,300 | PASSED |
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<vector>
#include<unordered_set>
#include<unordered_map>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define x first
#define y second
#define... | C++ | 8d25700c9996a80fea3557222273c89a | fdfe88a6eef5b72ebde1ae36d7deccc6 | 1,300 | PASSED |
/*
qwq!
*/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <unordered_map>
using namespace std;
#define pb push_back
#define pu push
#define fi first
#define se second
#define LL l... | C++ | 8d25700c9996a80fea3557222273c89a | 5aa931df8dc75cf16f94f54df27e2e4c | 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);
#define v_in(v , n , type) for(int i = 0 ; i < n ; i++) {type x ; cin>> x; v.push_back(x);}
#define ok(check) if(check) cout <<"YES\n" ; else cout <<"NO\n... | C++ | 8d25700c9996a80fea3557222273c89a | 28b8ac2c2cb125f355eb6681d31b611d | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(x, y, z) for (int x = y; x <= z; x++)
#define dep(x, y, z) for (int x = y; x >= z; x--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof a) // others
#defin... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 982c82b682562d08dfc283f9d17303dc | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(x, y, z) for (int x = y; x <= z; x++)
#define dep(x, y, z) for (int x = y; x >= z; x--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof a) // others
#defin... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 75a9d0ef7c2f153b993f3623cec3d66a | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int maxN(4e5);
int knot,belong[maxN+5],nb[maxN+5],sss[maxN+5],statu[maxN+5];
//全局数组:nb[u]为belong[u]的反向映射,sss[u]记录强连通分量块内大小,statu[u]记录强连通分量内的状态(相当于上文的ans).
bool cic[maxN+5];//cic[u]记录在原图中u是否自环.
struct G2_{//缩点后的图.
vector<int>node[maxN+5];
void init(){for... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 306b7c0f6eb5b230e501da9756a65278 | 2,100 | PASSED |
// Those who cannot remember the past are
// condemned to repeat it (use DP -_-)
// - George Santayana
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), ... | C++ | 055346dd6d2e0cff043b52a395e31fdf | c8d9a1efc9492e8cc0eb070a6848c606 | 2,100 | PASSED |
// Those who cannot remember the past are
// condemned to repeat it (use DP -_-)
// - George Santayana
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), ... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 052990c2166d7f4934c2b8ff078aac62 | 2,100 | PASSED |
#include <iostream>
#include <cstring>
#include<vector>
#include<map>
using namespace std;
const int N = 400010*16;
int n, m; // 点数、边数
vector<int>h[N];
int dfn[N]; // dfn[u]: 表示遍历到u的时间戳
int low[N]; // low[n]: 从u开始走,所能遍历到的最小时间戳。
int timestamp; // 时间戳
int stk[N], top; // 存储在当前SCC中的点
bool in_stk[N... | C++ | 055346dd6d2e0cff043b52a395e31fdf | bfac6952f1500486bcfa48bee98fb8e4 | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
const int N=1000010;
int a[N];
vector<int> g[N];
int dist[N],deg[N];
int ans[N];
int v[N],v1[N],v2[N];
int tp[N];
void dfs(int x)
{
v[x]=1;
for(auto to:g[x])
{
if(v[to]) continue;
dfs(to);
}
}
void dfs1(int x)
{
i... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 5a41060e7627ed9d7557247a33c60891 | 2,100 | PASSED |
#pragma GCC target("avx2")
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x =... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 259233ba9318048529bdbd40ebc7ee18 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n, m;
cin >> n >> m;
vector<vector<int>> g(n), rg(n);
vector<int> in(n, 0ll), o(n, 0ll);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--, b--;
g[a].push_back(b);
rg[b].push_back(a);
in[... | C++ | 055346dd6d2e0cff043b52a395e31fdf | 23d61cac039e1b32ac729273f766101e | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n, m;
cin >> n >> m;
vector<vector<int>> g(n), rg(n);
vector<int> in(n, 0ll), o(n, 0ll);
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--, b--;
g[a].push_back(b);
rg[b].push_back(a);
in[... | C++ | 055346dd6d2e0cff043b52a395e31fdf | f6375638934bb71d999ebe54adaacfd1 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define forn(i,n) for(int i=0;i<n;++i)
#define mem(a,b) memset(a, (b), sizeof(a))
inline int gcd(int a, int b){while(b){b^=a^=b^=a%=b;} return a;}
const int maxn = 2e5 + 5;
int dp[maxn][20];
int n;
int a[maxn... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 641013246793bba9332b0e53e370338c | 1,900 | PASSED |
# include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 4e5 + 10;
int n, a[N], st[N][55];
inline int gcd (int a, int b) {
return b ? gcd(b, a % b) : a;
}
inline void Build () {
int k = 32 - __builtin_clz(n) - 1;
for (int j = 1; j <= k; j ++) {
... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | bac1012fcaafa7c449f6746eb6db7c8a | 1,900 | PASSED |
# include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 4e5 + 10;
int n, a[N], st[N][55];
inline int gcd (int a, int b) {
return b ? gcd(b, a % b) : a;
}
inline void Build () {
int k = 32 - __builtin_clz(n) - 1;
for (int j = 1; j <= k; j ++) {
... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | d44872d568048e35bc54b84b92c6ccfb | 1,900 | PASSED |
# include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 4e5 + 10;
int n, a[N], st[N][55];
inline int gcd (int a, int b) {
return b ? gcd(b, a % b) : a;
}
inline void Build () {
int k = 32 - __builtin_clz(n) - 1;
for (int j = 1; j <= k; j ++) {
... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 72848c0607d4553d83b8baba330be22a | 1,900 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define ll long long
#define ld long double
#define pii pair<int,int>
#define int long long
#define F first
#define S second
#define endl "\n"
#define usk ios_base::sync_with_stdio(0)... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | fc6ddbb6a933cd4d8b3ffd4bd57e33f9 | 1,900 | PASSED |
#include<iostream>
#include<queue>
#include<cstring>
#include<map>
#include<deque>
#include<algorithm>
#include<set>
#include<cmath>
#include<vector>
#include<string>
#include<unordered_map>
#include<unordered_set>
#define yes puts("YES")
#define no puts("NO")
#define int long long
#define pf(x, y) sp(x)... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 977d8dc81c647dabf15ce45be8a052a6 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("O3")
#define ll long long
int tt, tc;
const int N = 2e5 + 9;
const int LOG = 20;
int a[N], range_gcd[N][LOG];
int n;
void build_sparse();
int query(int l, int r);
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) cin ... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | a37e412862bd09ccaef8456461976780 | 1,900 | PASSED |
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=1;i<=(n);++i)
#define rep3(i,i0,n) for(ll i=i0;i<(n);++i)
#define rrep(i,n) for(ll i=((n)-1); i>=0; --i)
#define rrep2(i,n) for(ll i=(n); i>0; --i)
#define pb push_back
#... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 55e7cf25e00f8c96ce2d4ff8c6b886c0 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const long N=2e5+10;
long n,A[N*2],d,t,ans,D[N*8],cnt;
void build(long id,long l,long r){
if(l==r) {D[id]=A[l]; return;}
long mid=(l+r)>>1;
build(id*2,l,mid);
build(id*2+1,mid+1,r);
D[id]=__gcd(D[id*2],D[id*2+1]);
}
void get(long id,long l,long... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 66e98100d129a6b433cca2f9a9f4f2c8 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
class SG {
public:
int n;
vector<int>t;
void set(int d) {
n = d;
t.resize(2 * n + 1, 0);
}
void build() { // build the tree
for (int i = n - 1; i > 0; --i) t[i] = __gcd(t[i << 1] , t[i << 1 | 1]);
}
void modify(int p, int value... | C++ | 1dfef6ab673b51e3622be6e8ab949ddc | 70feca7d73f990ba86c37d0e32f68e33 | 1,900 | PASSED |
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iostream>
#include <set>
using namespace std;
#define print(v) { std::cout << "[" << __LINE__ << "] " << #v << " = " << (v) << std::endl; }
#define print2(v1, v2) { std::cout << "[" << __LINE__ << "] " << #v1 << " = " << (v1)... | C++ | 95e2ea3e270af683706b9832557c3442 | 632f4169a000418573c11757d6874fc5 | 2,900 | PASSED |
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iostream>
#include <set>
using namespace std;
#define print(v) { std::cout << "[" << __LINE__ << "] " << #v << " = " << (v) << std::endl; }
#define print2(v1, v2) { std::cout << "[" << __LINE__ << "] " << #v1 << " = " << (v1)... | C++ | 95e2ea3e270af683706b9832557c3442 | fadf50b0cb19d5ec3136c83e0f401c1d | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve();
#define answer(out) { cout << (out) << '\n'; return; }
#define answerExit(out) { cout << (out) << '\n'; exit(0); }
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int t = 1;
cin >> t;
... | C++ | 95e2ea3e270af683706b9832557c3442 | 8ee4d1a70971624b2aafcfdc5bed5907 | 2,900 | PASSED |
#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>... | C++ | 95e2ea3e270af683706b9832557c3442 | 68387376acd2f02aff50e70405254588 | 2,900 | PASSED |
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define LL long long
#define il inline
#define pb push_back
#define pii pair<int,int>
#define fi first
#d... | C++ | 95e2ea3e270af683706b9832557c3442 | 564b6cf43663d506ac15fa684d94149d | 2,900 | PASSED |
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define LL long long
#define il inline
#define pb push_back
#define pii pair<int,int>
#define fi first
#d... | C++ | 95e2ea3e270af683706b9832557c3442 | 10b8dc7b44fbb03575152668ec0527ff | 2,900 | PASSED |
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define LL long long
#define il inline
#define pb push_back
#define pii pair<int,int>
#define fi first
#d... | C++ | 95e2ea3e270af683706b9832557c3442 | c4630ab4b2934b698d9339d34c452ead | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using ii = pair<ll,ll>;
using iii = pair<ii,ll>;
using vii = vector<ii>;
using ld = long double;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
... | C++ | 95e2ea3e270af683706b9832557c3442 | 218dcff86e099196e862ad0a311cd5f4 | 2,900 | PASSED |
/*
.:*+=%@@@@@@=-.
.:=@#@@@#@@#######%==*.
.-=####@######%*-.....:%##%.
.*@###########%+:--........-%@-
.*@##############@+--.........-:%-
.+##################@==%%%%=+*:----+.
.-@####################%++%@@@@@=+**%@@*
.%######... | C++ | 95e2ea3e270af683706b9832557c3442 | 75de012e1ec084f339bfe90c90e544cf | 2,900 | PASSED |
// LUOGU_RID: 93423496
/*
¤ï¤ó¤ï¤ó¡¡¤ï¤ó¤À¤Û©`¤¤¤Ã¡î
Wonderhoy!
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;
char buf[1<<21],*p1=buf,*p2=buf;
#define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<18,stdin),p1==p2)?EOF:*p1++)
int read()
{
int x=0;
char c=ge... | C++ | 95e2ea3e270af683706b9832557c3442 | 39c456044848a570d018f7e51ffaccd2 | 2,900 | PASSED |
nn = int(input())
for _ in range(nn):
n = int(input())
fire_or_frost=input()#[0,0,0,1,1,1]#[randint(0,1) for x in range(n_skills)]
fire_or_frost = fire_or_frost.split(' ')
skills = [int(x) for x in fire_or_frost]
scores = input()#[3,4,5,6,7,8]#[randint(1,10) for x in range(n_skills)]
scores = scores.split(' ')
d... | Python | bc1587d3affd867804e664fdb38ed765 | d835e044a268e3f4d67725cdcfb0cb3c | 800 | PASSED |
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
l1 = []
l2 = []
for i in range(n):
if a[i]==0:
l1.append(b[i])
else:
l2.append(b[i])
l1 = sorted(l1, reverse = True)
... | Python | bc1587d3affd867804e664fdb38ed765 | 3a899d6ddbeccc589a9aa715fdaf4a11 | 800 | PASSED |
t=int(input())
for _ in range(t):
r=int(input())
c=[];d=[];e=[];f=[]
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range (r):
if a[i]==0:
c.append(b[i])
e.append(b[i])
else :
d.append(b[i])
f.app... | Python | bc1587d3affd867804e664fdb38ed765 | 2b7e50b99de847802ddd14b4c79b2362 | 800 | PASSED |
def glory_addict(n, a, b):
if n == 1:
return b[0]
fire, frost = [], []
for i in range(n):
if a[i] == 0:
fire.append(b[i])
else:
frost.append(b[i])
sum_fire, sum_frost, sum_b = sum(fire), sum(frost), sum(b)
if len(fire) == 0:
retu... | Python | bc1587d3affd867804e664fdb38ed765 | 8b6ed2c79a1fd95623e8d9a046ef0209 | 800 | PASSED |
t = int(input())
a = []
b = []
n = []
for i in range(t):
n.append(int(input()))
a.append(list(map(int, input().split())))
b.append(list(map(int, input().split())))
#print(n)
#print(a)
#print(b)
for k in range(t):
zero=[]
one = []
cn = n[k]
ca = a[k]
cb = b[k]
s =... | Python | bc1587d3affd867804e664fdb38ed765 | 11ad3843ee88012867b07bc4121e52c6 | 800 | PASSED |
I=input
s=sorted
for _ in[0]*int(I()):
I();a=[[],[]]
for x,y in zip(I()[::2],I().split()):a[x>'0']+=int(y),
a,b=s(a,key=len);l=len(a);print(sum(a*2+b+s(b)[::-1][:l])-(l==len(b))*min(a+b)) | Python | bc1587d3affd867804e664fdb38ed765 | 53021573fdce9e53b4b27fefc4ce09d2 | 800 | PASSED |
I=input
for _ in[0]*int(I()):
I();c=[[],[]]
for x,y in zip(I()[::2],I().split()):c[x>'0']+=int(y),
a,b=sorted(c,key=len);l=len(a);print(sum(a*2+b+sorted(b)[::-1][:l])-(l==len(b))*min(a+b)) | Python | bc1587d3affd867804e664fdb38ed765 | 04642af4272ed87b38b194203744499c | 800 | PASSED |
I=input
for _ in[0]*int(I()):
I();c=[[],[]]
for x,y in zip(I()[::2],I().split()):c[x>'0']+=int(y),
a,b=sorted(c,key=len);l=len(a);c=sorted(b)[::-1][:l];print(sum(a*2+b+c)-(l==len(b))*min(a+b)) | Python | bc1587d3affd867804e664fdb38ed765 | c2140dada28c57dfa9442cf1e538a9b1 | 800 | PASSED |
I=input
for _ in[0]*int(I()):
I();c=a,b=[[],[]]
for x,y in zip(I()[::2],I().split()):c[x>'0']+=int(y),
m,n=map(len,c);c,d=(sorted(x)[::-1][:min(m,n)]for
x in c);print(sum(a+b+c+d)-(m==n)*min(a+b)) | Python | bc1587d3affd867804e664fdb38ed765 | f34d2fd1494436831eb4ca808474e100 | 800 | PASSED |
for _ in range(int(input())):
a = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
zero = []
one = []
damage = 0
if a == 1:
print(l2[0])
elif l1.count(0) == l1.count(1):
for i in range(len(l1)):
if l1[i] == 0:... | Python | bc1587d3affd867804e664fdb38ed765 | dee3f75e2f13eb9884e4668264a09f7b | 800 | PASSED |
#include<iostream>
#include<stack>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long A[100005],B[100005];
int main(){
int n;int t,k,i,d,j,c=0;int e;long long g;
scanf("%d",&n);
while(n--){
c=0;
scanf("%d%d",&t,&k);
for(i=t-k+1;i<=t;i++){
... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | 9818e096349982988f92913d40301fee | 1,200 | PASSED |
#include<iostream>
#include<stack>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long A[100005],B[100005];
int main(){
int n;int t,k,i,d,j,c=0;int e;long long g;long long cha,l=1000000000000;
scanf("%d",&n);
while(n--){
c=0;l=1000000000000;
scan... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | ad46c958903b746227de38235cdce6e2 | 1,200 | PASSED |
#include <stdio.h>
#include <string.h>
long long b[100100] = {0};
long long a[100010] = {0};
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= k; i++)
{
scanf("%lld", &a[i]);
}
if (k == 1)
{
printf("YES\n");
}
else
{
int re = 1;... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | fd98d31bf54d97b513b4193cd79b5c4b | 1,200 | PASSED |
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
ll b[200000],a[200000];
int main(){
ll t;
cin>>t;
while(t--){
ll n,k,c=0;
memset(b,0,200000);
memset(a,0,200000);
cin>>n>>k;
for(int i=0;i<k;i++){
cin>>b[... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | efa90f9f4491c25175b548161b8f7476 | 1,200 | PASSED |
//#include<neverevergiveup>
#include<bits/stdc++.h>//
using namespace std;
typedef long long ll;
typedef long double ld;
signed main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll t;cin>>t;
while(t--){ll n,k;cin>>n>>k;ld arr[n+1]={0};ld a[n+1]={0};
for(int i=n-k+1;i<=n;i++){cin>>arr[i];}//ld c=(arr[... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | 21933ac33e2feb090c24f4a0960554d0 | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define pb push_back
#define pf push_front
#define F first
#define S second
#define FileIO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fix fixed << setprecision(20)
#define io ios_base::sync_with_... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | b734031fcf93a7fa6895b6f7abb0e5de | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
vector<long long> s(n + 1);
for (int i = n - k + 1; i <= n; ++i)
cin >> s[i];
if (k == 1)
{
cout << "YES" << endl;
return;
}
vector<long long> a(n + 1);
for (int i = n - k + 2; i <= n; ++i)
a[i] = ... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | b40d67a6d950615d808d491af1bb2eca | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
array<int,100000>T;
int t,n,k,c,i,j,p;
cin >>t ;
for (int j=0;j<t;j++)
{
cin>>n ;
cin>>k ;
for (int i=0;i<k;i++)
{
ci... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | 1b2f7453c447d5bc436c6d427fdc4ad3 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t, n, i, j, k, k1, f;
cin >> t;
for (; t--;)
{
cin >> n >> k;
k1 = n - k + 1;
vector<ll> s(k), a(k);
for (i = 0; i < k; i++)
{
cin >> s[i];
... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | abdcfb32106fc594aa0369c3cf5cb3df | 1,200 | PASSED |
#include <bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
#define lli long long int
using namespace std;
void solve(){
lli n,k;
cin>>n>>k;
vector<int> v(k);
for(int i=0;i<k;i++)
cin>>v[i];
vector<int> b(k);
if(n==1||k==1){... | C++ | 9edbe28b5be43a9cc6c633db98bc5a36 | 64377063c8ebfa0336d28c3c224141a3 | 1,200 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | f18a89a68e52961dd730a08110bfa252 | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | c27076a86c2bb841202f51c00eb14488 | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | 04da1c55118595617498023b410fbe5f | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | f43f2db35aba62eafb29ba971a4f56aa | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | 54b014fc00c1f4f036e114ba748491ff | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | 7ba51dd78853283beb097419c22b32c0 | 1,500 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define gap ' '
#define mini -10000000000000000
#define ... | C++ | d0c9f2f2037d093762fb87206f396850 | bd3e0dc6aab674f4bd68cee5e909464c | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int ara[n];
int even=0;
int odd=0;
for(int i=0;i<n;i++)
{
cin >> ara[i];
if(ara[i]<0)
{
... | C++ | d0c9f2f2037d093762fb87206f396850 | 484c9a0c04c2d68d73ebc913260b81e3 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n;
cin >> n;
int a;
int o = 0, e = 0;
for (int i = 0; i < n; i++) {
cin >> a;
if (!(a % 2)) e++;
else o++;
}
if (!(o % 4)) cout << "Alice\n";
else if (o % 4 == 1 && e % 2) cout << "Alice\n";
else i... | C++ | d0c9f2f2037d093762fb87206f396850 | 76e3a851d2dc8e48f3a95678bb73c986 | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m;
int f[2][2][N][N];
int d[N];
int dfs(int u, int s0, int sum2, int sum1)
{
if(sum1 + sum2 == 0)
{
if(s0 == 1)
{
if(u == 0)
return 0;
return 1;
}else
... | C++ | d0c9f2f2037d093762fb87206f396850 | e743a64a2c8d0c997c75faa2811d33c9 | 1,500 | PASSED |
#include <bits/stdc++.h>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ninja ios_base::sync_with_stdio(false);cin.tie(NULL);
#define tc int test_cases; cin >> test_cases; while(test_cases--)
#define re... | C++ | 152aba87aaf14d1841f6622dc66051af | f8e4945483c660ce9e75bb6b15593123 | 1,900 | PASSED |
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=100100;
int a[N],q[N],v[N],w[N];
vector<int> f[N];
void solve()
{
int cnt=1;
int n;
cin>>n;
int ans=-1;
int tot=0,t=0;
int l=0,r=n;
int minn=0,maxn=n+1;
for(int i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
v[a[i]]... | C++ | 152aba87aaf14d1841f6622dc66051af | 9f560e588c4c44b333d968b5c461478e | 1,900 | PASSED |
#include<bits/stdc++.h>
#include<chrono>
using namespace std::chrono;
using namespace std;
// Alias:-
typedef long double ld;
typedef long long ll;
struct var{ll x,y;};
// Good Tools:-
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Tgreen auto start = high_reso... | C++ | 152aba87aaf14d1841f6622dc66051af | 0d7b1ff293c01927377a4b65085d749d | 1,900 | PASSED |
#include<bits/stdc++.h>
#include<chrono>
using namespace std::chrono;
using namespace std;
// Alias:-
typedef long double ld;
typedef long long ll;
struct var{ll x,y;};
// Good Tools:-
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)... | C++ | 152aba87aaf14d1841f6622dc66051af | 499023d0b192516c12bb9bbfadda6e78 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
#define double long double
#define endl "\n"
#define fi first
#define se second
#define mapa make_pair
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define o_ or... | C++ | 152aba87aaf14d1841f6622dc66051af | 716033c0a0b61a015b16f126c8d33aff | 1,900 | PASSED |
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;
const int N = 2e5 + 10, mod = 998244353;
int a[N];
vector<int> g[N];
void dfs(int u){
if(!g[u].size()) return;
int k = 0;
for(auto v : g[u]){
if(g[v].size()){
k... | C++ | 152aba87aaf14d1841f6622dc66051af | dcca7b62b9d868606ea041ab32e89c03 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int nax = 3e5 + 10;
int n;
int b[nax];
vector <int> g[nax];
bool vis[nax];
vector <int> ord;
bool is_back[nax];
int back_of[nax];
void dfs(int v) {
vis[v] = true;
for (int to : g[v])
if (!vis[to]) dfs(to);
ord.push_back(v);
}
v... | C++ | 152aba87aaf14d1841f6622dc66051af | 4d5110d7580f2b3359de05353c9b1519 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int nax = 3e5 + 10;
int n;
int b[nax];
int suf_max[nax];
vector <int> g[nax];
bool vis[nax];
vector <int> ord;
bool is_back[nax];
int back_of[nax];
void dfs(int v) {
vis[v] = true;
for (int to : g[v])
if (!vis[to]) dfs(to);
ord.... | C++ | 152aba87aaf14d1841f6622dc66051af | e59eeca9e46dfd4ea5907508260a78a6 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int nax = 3e5 + 10;
int n;
int b[nax];
int suf_max[nax];
vector <int> g[nax];
bool vis[nax];
vector <int> ord;
bool is_back[nax];
int back_of[nax];
int lst[nax];
void dfs(int v) {
vis[v] = true;
for (int to : g[v]) {
if (!vis[to]) {... | C++ | 152aba87aaf14d1841f6622dc66051af | bd8fe5eaee719b867ed0a9bcbee4d0a1 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int nax = 3e5 + 10;
int n;
int b[nax];
int suf_max[nax];
vector <int> g[nax];
bool vis[nax];
vector <int> ord;
bool is_back[nax];
int back_of[nax];
int lst[nax];
void dfs(int v) {
vis[v] = true;
for (int to : g[v]) {
if (!vis[to]) {... | C++ | 152aba87aaf14d1841f6622dc66051af | 286f2180f1b1e268944a249b5bbea894 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
const int N=1e5+33,M=998244353;
int n,a[N];
ll pre[N],p[N],inv[N],fac[N],invf[N];
void init(){
p[0]=1;
rep(i,1,1e5+10)p[i]=p[i-1]*2%M;
fac[0]=fac[1]=1;inv[0]=inv[1]=1;invf[0]=invf[1]=1;
... | C++ | fad12986a0a97a96109734fdce3bd7a7 | 313253fe10e48b4bff92ee2ee375430b | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
const int N=1e5+33,M=998244353;
int n,a[N];
ll pre[N],p[N],inv[N],fac[N],invf[N];
void init(){
p[0]=1;
rep(i,1,1e5+10)p[i]=p[i-1]*2%M;
fac[0]=fac[1]=1;inv[0]=inv[1]=1;invf[0]=invf[1]=1;
... | C++ | fad12986a0a97a96109734fdce3bd7a7 | d6119a3bb1f69cb9693adcce87a06db2 | 2,300 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.