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<bits/stdc++.h> using namespace std; int main() { int t,n,H,x,y,cnt; cin>>t; while(t--) { cin>>n>>H; int max1=0,max2=0; for(int i=1;i<=n;i++) { cin>>x; if(x>max1) max2=max1,max1=x; else if(x>max2) max2=x; } cnt=H/(max1+max2)*2; y=H%(max1+max2); if(y>max1) cnt+=2; ...
C++
4d5457d9f053556c78c102f5c32f7542
91212831b85e8a169e756ea0967b0af3
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int i,t,n,h,a[1001],x; cin>>t; while(t--) { cin>>n>>h; int mx1=0,mx2=0,cnt=0; for(i=0;i<n;i++) { cin>>x; if(x>=mx1) { mx2=mx1; mx1=x; } else if(x>mx2)mx2=x; } cnt=h/(mx1+mx2); int y=h%(mx1+mx2); cn...
C++
4d5457d9f053556c78c102f5c32f7542
a4b27e17d0ec075df8329cd2b3390242
800
PASSED
#include <bits/stdc++.h> using namespace std; const int N=1e5+5; int a[N]; int main(){ int t,n,h,x; cin >> t; for(int j=0;j<t;j++){ cin >> n >> h; int mx1=0,mx2=0; for(int i=0;i<n;i++){ cin >> x; if(x>=mx1) { mx2=mx1; mx1=x; } else { if(x>mx2) mx2=x; } } int ...
C++
4d5457d9f053556c78c102f5c32f7542
0c44b647c60083d85ecc55da80352443
800
PASSED
#include <bits/stdc++.h> using namespace std; int t,n,h; int main() { cin>>t; while(t--) { int a[100000]; int sum=0,max1=0,max2=0,y; cin>>n>>h; for(int i=1;i<=n;i++) { int x; cin>>x; if(x>max1) max2=max1,max1=x; else if(x>max2) max2=x; }sum=h/(max1+max2)*2; y=h%(max1...
C++
4d5457d9f053556c78c102f5c32f7542
88e20632a025817d4482380f4c51f3d1
800
PASSED
#include <bits/stdc++.h> using namespace std; int t,n,h; int main() { cin>>t; while(t--) { int a[100000]; int sum=0,max1=0,max2=0,y; cin>>n>>h; for(int i=1;i<=n;i++) { int x; cin>>x; if(x>max1) max2=max1,max1=x; else if(x>max2) max2=x; }sum=h/(max1+max2)*2; y=h%(max1...
C++
4d5457d9f053556c78c102f5c32f7542
2c9712c56bf9c3d97dc00adb4ce45eb2
800
PASSED
#include<bits/stdc++.h> using namespace std; int a,b,m[10001],sum=0,n; int t; int main() { cin>>t; while(t--) { cin>>a>>b; for(int i=1;i<=a;i++) { cin>>m[i]; } sort(m+1,m+a+1); if(b%(m[a]+m[a-1])>m[a]) { cout<<b/(m[a]+m[a-1])*2+2<<endl; } else if(b%(m[a]+m[a-1])==0) ...
C++
4d5457d9f053556c78c102f5c32f7542
cd4ae13eed486ddbee2a7d180c2c0197
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long a[10001],s,d,z,x; cin>>z; for(int i=0;i<z;i++) { cin>>s>>d; for(int j=0;j<s;j++) { cin>>a[j]; } sort(a,a+s); if(d%(a[s-1]+a[s-2])==0) x=d/(a[s-1]+a[s-2])*2; else if(d%(a[s-1]+a[s-2])<=a[s-1]) x=d/(a[s-1]...
C++
4d5457d9f053556c78c102f5c32f7542
d37082b559eeacec275cfbe49a1f089d
800
PASSED
#include <bits/stdc++.h> using namespace std; int t,n,h,a[1009]; int cmp(int a,int b){ return a>b; } int main() { cin>>t; while(t--) { cin>>n>>h; for(int i=0; i<n; i++) { cin>>a[i]; } sort(a,a+n,cmp); int c=a[0]+a[1]; int b=h/c*2; if(h%c==0) { cout<<b<<"\n"; } els...
C++
4d5457d9f053556c78c102f5c32f7542
06123f795797f8475804942391068fc8
800
PASSED
#include<bits/stdc++.h> using namespace std; long long n,h,a; int main() { long long t; cin>>t; while(t--) { long long imax=INT_MIN,sec=INT_MIN; cin>>n>>h; for(int i=0; i<n; i++) { cin>>a; if(a>=imax) sec=imax,imax=a; else if(a>sec) sec=a; } if(h%(imax+sec)!=0) { ...
C++
4d5457d9f053556c78c102f5c32f7542
00960ac34813922a93acfa4a5f44e163
800
PASSED
using System; using System.Collections.Generic; using System.Linq; namespace CodeForces { class Program { static void Main(string[] args) { _ = Console.ReadLine(); var nums = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray(); ...
C#
d3e972b7652c0c1321c2e8f15dbc264b
172c989c5d40c1072658b351f14dcce7
2,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int mod=1e9+7; const int N=2e6+5; const int M=2; int n; int a[N]; int x[N],num[N],pre[N]; void run() { //不超过1<<20 scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int ans=0; i...
C++
d3e972b7652c0c1321c2e8f15dbc264b
6695f9df890b973bab046d7943416dcf
2,400
PASSED
#pragma GCC optimize ("O3") #include <bits/stdc++.h> #define mod 1000000007 #define pi 3.14159265358979323846 #define ll long long using namespace std; /* bool prime(ll n) { for(int i=2;i*i<=n;i++)if(n%i==0)return 0; return 1; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b...
C++
d3e972b7652c0c1321c2e8f15dbc264b
e516df4347561029177127175588adc2
2,400
PASSED
#pragma GCC optimize ("O3") #include <bits/stdc++.h> #define mod 1000000007 #define pi 3.14159265358979323846 #define ll long long using namespace std; /* bool prime(ll n) { for(int i=2;i*i<=n;i++)if(n%i==0)return 0; return 1; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b...
C++
d3e972b7652c0c1321c2e8f15dbc264b
1fae48e6b1de1094af537c9641c0b3df
2,400
PASSED
/* Includes */ #include <bits/stdc++.h> /* Using libraries */ using namespace std; /* Defines */ #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ld long double #define pb push_back #define vc vector #define sz(a) (int)a.size() #define forn(i, n) for (int i = 0; i < n; ++i) #define pii pa...
C++
d3e972b7652c0c1321c2e8f15dbc264b
21fb00e5100953afed0c0ba3b7cbcb23
2,400
PASSED
/* Includes */ #include <bits/stdc++.h> /* Using libraries */ using namespace std; /* Defines */ #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ld long double #define pb push_back #define vc vector #define sz(a) (int)a.size() #define forn(i, n) for (int i = 0; i < n; ++i) #define pii pa...
C++
d3e972b7652c0c1321c2e8f15dbc264b
91121e23ef2245d6542e971d3cb8e9b1
2,400
PASSED
/* Includes */ #include <bits/stdc++.h> /* Using libraries */ using namespace std; /* Defines */ #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ld long double #define pb push_back #define vc vector #define sz(a) (int)a.size() #define forn(i, n) for (int i = 0; i < n; ++i) #define pii pa...
C++
d3e972b7652c0c1321c2e8f15dbc264b
c32597720de784d0d9b3ca9beab39b38
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define FAST() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD 998244353 #define pb push_back #define ll long long /* Sorting on column basis */ // bool sortcol(vector<ll>& v1,vector<ll>& v2 ) { // if(v1[1] == v2[1]) // r...
C++
d3e972b7652c0c1321c2e8f15dbc264b
5dc105e8997b102569b0bc6c261ce815
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define FAST() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD 998244353 #define pb push_back #define ll long long /* Sorting on column basis */ // bool sortcol(vector<ll>& v1,vector<ll>& v2 ) { // if(v1[1] == v2[1]) // r...
C++
d3e972b7652c0c1321c2e8f15dbc264b
31bf37a4fe5314079ffc3a69d32b9453
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define FAST() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD 998244353 #define pb push_back #define ll long long /* Sorting on column basis */ // bool sortcol(vector<ll>& v1,vector<ll>& v2 ) { // if(v1[1] == v2[1]) // r...
C++
d3e972b7652c0c1321c2e8f15dbc264b
1315999520250c0bad7766b379a95b13
2,400
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("inline") #include<bits/stdc++.h> using namespace std; template<class T> struct cLtraits_identity{ using type = T; } ; template<class T> using cLtraits_try_make_signed = typename conditional< is_integral<T>::value...
C++
ad61d92fde608b304c0362420c2ae6dc
e0e1748ffbe1a45f7f90ed7c31995e64
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
7494e57595fcc75157a3fceca97a2af1
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
f26879de01fe8cc44f62150a3bb66bca
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
cb998eba3c1434085c21781cb3209a68
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
a6ec4b007125a97fb959b4930452c352
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
be964fde9ffa4d359fc47c2a7e2cd8d2
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
9d180ca3326cf4c98c4fd0d4bad8823c
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
47498c85c4fd1f0895c23511666d3fd5
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
e6084d8c731ec648389e5d8dd29ee20e
1,700
PASSED
#include<vector> #include<iostream> using namespace std; const int N = 100000 + 10; int n, k; int a[N]; vector<int>G[N]; int sum = 0; int cnt = 0; int DFS(int v, int p) { int res = a[v]; for (int nv : G[v]) { if (nv == p) continue; res ^= DFS(nv, v); } if (res == sum) { cnt++;...
C++
ad61d92fde608b304c0362420c2ae6dc
5b4ab9148b340361cf544e06e6016f50
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define F first #define S second #define oo 1000000000 #define MOD 1000000007 #define fast ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #define...
C++
1305b44c5c588221bc991c696a492fe7
2918de11ebf7d019d1357db4cb60e5d5
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t,n,i,x; cin>>t; while(t--){ cin>>n>>x; int a[n],b[n],ans=1; for(i=0;i<n;i++){cin>>a[i];b[i]=a[i];} sort(b,b+n); for(i=n-x;i<x;i++){if(b[i]!=a[i]){ans=0;}} ans?cout<<"YES"<<endl:cout<<"NO"<<endl; } }
C++
1305b44c5c588221bc991c696a492fe7
12cae22d5e67d9fae9627e12add0fe35
1,200
PASSED
/*------------------------------------------------------- Competitive programing Name: Đào Xuân Hoàng Tuấn (Salmon) Nothing is impossible, as you as you believe you can do it You can do it!!! -------------------------------------------------------*/ #include <bits/stdc++.h> using namespace std; #define...
C++
1305b44c5c588221bc991c696a492fe7
2f9afbea7ce3fceae13df35c4990813e
1,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve() { int n, x, i, k, aux; bool sorted = true; cin>>n>>x; k = n - x; vector<int> a; cin>>aux; a.push_back(aux); for(i = 1; i < n; i++) { cin>>aux; a.push_back(aux); if(a[i] < a[i -...
C++
1305b44c5c588221bc991c696a492fe7
60b2f654d4a86e929c1724b4e7fc8211
1,200
PASSED
#include <iostream> #include <vector> #include <cmath> #include <string> #include <set> #include <unordered_set> #include <algorithm> #include <stdlib.h> #include <map> #include <iomanip> #include <iterator> #include <fstream> using namespace std; typedef long long ll; #define PI 3.14159265358979311600; ...
C++
1305b44c5c588221bc991c696a492fe7
1672190ea755fda16cedac622602e1e9
1,200
PASSED
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define nxt nx<int>() #define next(T) nx<T>() #define nl '\n' #define ll long long template <typename T> inline void read(T &x) { cin >> x;} template<typename T, typename ...S>void read(T& m, S&...s) { cin >> m;read(s...);}inline string ...
C++
1305b44c5c588221bc991c696a492fe7
bd7609145cf122ca529261aa65f447d7
1,200
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; void Fast() { cin.tie(0); cin.sync_with_stdio(0); } int main() { Fast(); ll t; cin >> t; while (t --) { ll n, x; cin >> n >> x; vector<ll> v, sortedv; for (ll i = 0; i < n; i++) ...
C++
1305b44c5c588221bc991c696a492fe7
ff8c1b289cc2070525d54210e6727a3b
1,200
PASSED
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <list> #include <cassert> #include <...
C++
1305b44c5c588221bc991c696a492fe7
f9ecdc439e1e83572990373a2e232bf4
1,200
PASSED
#include <bits/stdc++.h> #define int long long int #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define pb push_back #define ff first #define ss second #define sz size() #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define fo for #define MOD 1000000007 using namespa...
C++
1305b44c5c588221bc991c696a492fe7
8519784a4e2dbd2ecd39a36bca4bc15c
1,200
PASSED
#include<bits/stdc++.h> using namespace std; using ll=long long int; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ll t; cin>>t; while(t--){ ll n,x; cin>>n>>x; ll arr[n],arr1[n]; for(ll i=0;i<n;i++){...
C++
1305b44c5c588221bc991c696a492fe7
838de2cc5810a9cf357c5d50c28b9cdf
1,200
PASSED
#pragma GCC optimaze(3) #pragma GCC optimaze(2) #pragma GCC optimaze("Ofast") #pragma GCC optimaze("inline") #pragma GCC optimaze("unroll-loops") #include<bits/stdc++.h> #define N 510 using namespace std; int n,m,ret; bool a[N][N]; int b[N][N]; char ch; int main() { scanf("%d%d",&n,&m); for (int i=...
C++
9f1590b1126059269ea692d4c6b11d4e
03b4d05a06a95f5e81e22c54c2530f84
2,600
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,ret; bool a[510][510]; int b[510][510]; char ch; int main() { scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) { ch=getchar(); while (ch!='W'&&ch!='B') ch=getchar(); if (ch=='B') b[i][j]=1; } } for (...
C++
9f1590b1126059269ea692d4c6b11d4e
9a28d007bb53a6c7aaff099f54ffac32
2,600
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,ret; bool a[510][510]; int b[510][510]; char ch; int main() { scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) { ch=getchar(); while (ch!='W'&&ch!='B') ch=getchar(); if (ch=='B') b[i][j]=1; } } fo...
C++
9f1590b1126059269ea692d4c6b11d4e
a0d2f4b31173b705684f7b3359c823ea
2,600
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,ret; bool a[510][510]; int b[510][510]; char ch; int main() { scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) { ch=getchar(); while (ch!='W'&&ch!='B') ch=getchar(); if (ch=='B') b[i][j]=1; } } for (...
C++
9f1590b1126059269ea692d4c6b11d4e
099bb091839e0d26edf3a7a6bbf208c6
2,600
PASSED
#include<bits/stdc++.h> using namespace std; int a[505][505]; int main(){ int n,m;cin>>n>>m; for(int i=1;i<=n;i++){ string s;cin>>s; for(int j=1;j<=m;j++){ a[i][j]=(s[j-1]=='B'); } } int cnt=0; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=(a[i][j]+a[i+1][j+1]+a[i+1][j]+a[i][j+1])%...
C++
9f1590b1126059269ea692d4c6b11d4e
2aca122fc1dc4d9cedfbd661e5d09732
2,600
PASSED
#include<iostream> #include<cstdio> using namespace std; inline int read() { int n=0,f=1,ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { n=n*10+ch-'0'; ch=getchar(); } return n*f; } char s[505]; int b[505][505],a[505][505]; int main() ...
C++
9f1590b1126059269ea692d4c6b11d4e
e4a62ba498f22757b8349afe607bdf6b
2,600
PASSED
// LUOGU_RID: 95229268 #include<bits/stdc++.h> #define Tp template<typename Ty> #define Ts template<typename Ty,typename... Ar> #define W while #define I inline #define RI int #define LL long long #define Cn const #define CI Cn int& #define gc getchar #define D isdigit(c=gc()) #define pc(c) putchar((c)) usi...
C++
9f1590b1126059269ea692d4c6b11d4e
516a50ef15baeffcfec8c899b03adbe4
2,600
PASSED
#include<bits/stdc++.h> #define Tp template<typename Ty> #define Ts template<typename Ty,typename... Ar> #define W while #define I inline #define RI int #define LL long long #define Cn const #define CI Cn int& #define gc getchar #define D isdigit(c=gc()) #define pc(c) putchar((c)) using namespace std; name...
C++
9f1590b1126059269ea692d4c6b11d4e
00d581adc2c253231c9fef049328011e
2,600
PASSED
// Problem: F1. Alice and Recoloring 1 // Contest: Codeforces - Codeforces Round #746 (Div. 2) // URL: https://codeforces.com/problemset/problem/1592/F1 // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #pragma GCC optimize(2) #pragma GCC optimize(3) #include <...
C++
9f1590b1126059269ea692d4c6b11d4e
3da29a0ef4bfb9b69877e55a16db938a
2,600
PASSED
#include<bits/stdc++.h> using namespace std; const int MAXN=505; int n,m; char s[MAXN]; int mp[MAXN][MAXN]; int zfx[15]={1,0,1}; int zfy[15]={0,1,1}; int NYH[MAXN][MAXN]; signed main() { scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) { scanf("%s",s+1); for(int j=1;j<=m;j++) { if(s[j]=='B') ...
C++
9f1590b1126059269ea692d4c6b11d4e
2d67598ef0e6e78a5cb0c6ae658837c6
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #define N 2000 vector<int> gg[N], oo, pp; set<int> q; int mx; int get() { cout << "? " << q.size() << " "; for (auto x : q) cout << x + 1 << " "; cout << endl; int x; cin >> x; return x; } void dfs(int v, int p) { oo.push_back(v); for (auto ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
df94df937297f539d02529b2c06166a0
2,300
PASSED
#include <bits/stdc++.h> using namespace std; int read() { int x=0, f=0; char c=getchar(); while (!isdigit(c)) f|=c=='-', c=getchar(); while (isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar(); return f ? -x : x; } const int N=1e3+10; int n, dfn[N], rnk[N], cnt, f[N]; vector<int> e[N]; void dfs(...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
12edc7d831ce9d7aeca5f71f9db2b6cf
2,300
PASSED
#include <bits/stdc++.h> typedef long long ll; const long long inf = 2e9; using namespace std; vector<vector<ll>> g; ll query(vector<ll> & v, ll indx){ set<ll> s; for(int i=0;i<indx;i++)s.insert(v[i]+1); cout<<"? "<<s.size()<<" "; for(auto a: s)cout<<a<<" "; cout<<endl; ll a; ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
aa99fa61e074b6b7ba8507b4fa3c43a1
2,300
PASSED
#include<cstdio> #include<cstring> #define rep(a,b,c) for(int c=(a);c<=(b);++c) #define grep(b,c) for(int c=head[(b)];c;c=nxt[c]) inline int read() { int res=0;char ch=getchar();while(ch<'0'||ch>'9')ch=getchar(); while(ch<='9'&&ch>='0')res=res*10+(ch^48),ch=getchar();return res; } int n;const int N=2010;int ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
54fe6119deadf72af05c06182405b763
2,300
PASSED
#include<cstdio> #include<cstring> #define rep(a,b,c) for(int c=(a);c<=(b);++c) #define grep(b,c) for(int c=head[(b)];c;c=nxt[c]) inline int read() { int res=0;char ch=getchar();while(ch<'0'||ch>'9')ch=getchar(); while(ch<='9'&&ch>='0')res=res*10+(ch^48),ch=getchar();return res; } int n;const int N=2010;int ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
c9784ae1904e02683b5767b8a9393195
2,300
PASSED
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("O3") //#pragma GCC optimize("Ofast") #define paiu return #define moment 0; //#define int long long #define double long double #define ll long long #define forr(i,x) for (int i=0; i<x; i++) #define forn(i,x) for (int i=0; i<x; i++)...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
d0e2989304774836326ccabd11c9c267
2,300
PASSED
// /Name: Arghyadeep Mandal //From: It's not over until you win. // #pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #define dd double #define ll long long int #define ull unsigned ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
79d94744b3368806633718b0dcc2f285
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 1e9 + 7; const int mod = 1e9 + 7; const int maxn = 1e3 + 100; ll inv2, inv3; inline char get(void) { static char buf[100000], *p1 = buf, *p2 = buf; if (p1 == p2) { p2 = (p1 = buf) + fread(buf, 1, 100000, st...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
ae6a0fd17de9b78727d08562921df064
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; typedef vector<vector<int> > vvi; typedef vector<string> vs; #define rep(i,l,r) for(int i=l;i<=r;++i) #define per(i,r,l) for(int i=r;i>=l;--i) #define rep0(i,l,r) ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
362f9f629c82f65520e6b8c9d9e2bb21
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vii; typedef vector<vector<int> > vvi; typedef vector<string> vs; #define rep(i,l,r) for(int i=l;i<=r;++i) #define per(i,r,l) for(int i=r;i>=l;--i) #define rep0(i,l,r) ...
C++
905e3f3e6f7d8f13789b89e77a3ef65e
830e1f5bc3236ccefea77cfb5bedee60
2,300
PASSED
#include<cstdio> #include<vector> #include<queue> struct graph { struct edge { int to,cap,opp; edge(int to,int cap,int opp){this->to=to,this->cap=cap,this->opp=opp;} }; std::vector<edge> a[1005]; int n,dep[1005],can[1005],nxt[1005]; void add(int x,int y,int v) { // printf("Edge %d %d %d\n",x,y...
C++
8f74200d7c34e696c65840d4c5738c63
9403c4af1bb1bc34588b8039e26d810b
2,800
PASSED
#include <cstdio> #include <algorithm> #include <cmath> #include <cstring> #include <vector> #define uint unsigned int #define LL long long #define mr make_pair #define pr pair <int, int> #define fr first #define se second using namespace std; const int MAXN = 1005, MAXM = 1000 * 1000 + 500 * 4 + 5, inf = 0...
C++
8f74200d7c34e696c65840d4c5738c63
d25bfa265d643355edbef58ce83b9aef
2,800
PASSED
#include<bits/stdc++.h> #define INF 1e9 using namespace std; const int MAXN=1005; struct Edge{ int to,nex,val; }edge[MAXN*MAXN*2]; int head[MAXN]; int cnt_edge=1; void Add(int u,int v,int val) { ++cnt_edge; edge[cnt_edge].nex=head[u]; edge[cnt_edge].to=v; edge[cnt_edge].val=val; head[u]=cnt_edge; ...
C++
8f74200d7c34e696c65840d4c5738c63
6fd4a41212a09e7fbfe712c93e31b247
2,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1005, M = 1002005; int head[N], nxt[M << 1], to[M << 1], val[M << 1], tot; int _val[M << 1]; void add(int x, int y, int v) { nxt[tot] = head[x]; head[x] = tot; to[tot] = y; val[tot++] = v; swap(x, y); nxt[tot] = head[x]; head[x] = t...
C++
8f74200d7c34e696c65840d4c5738c63
2bb549c17b8e7379172056cca09f10b2
2,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1005, M = 1002005; int head[N], nxt[M << 1], to[M << 1], val[M << 1], tot; int _val[M << 1]; void add(int x, int y, int v) { nxt[tot] = head[x]; head[x] = tot; to[tot] = y; val[tot++] = v; swap(x, y); nxt[tot] = head[x]; head[x] = t...
C++
8f74200d7c34e696c65840d4c5738c63
3380bba7800371d8d76eb330d511927f
2,800
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define CHECK(...) #endif namespace { namespace zkw { template<typename T> struct CostFlow { public: static constexpr T inf = std::numeric_limits<T>::max(); int n = 0; int s = -1, t = -1; std::vector<bool> vis; std:...
C++
8f74200d7c34e696c65840d4c5738c63
e23e1257cf3ea88317a95e729ffb8f97
2,800
PASSED
#include <bits/stdc++.h> #define DEBUG #define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++i) #define rFor(i, b, a) for (int i = b, i##end = a; i >= i##end; --i) #define eFor(i, u, v) for (int i = head[u], v = e[i].to; i; i = e[i].next, v = e[i].to) typedef long long ll; typedef std::pair<int, i...
C++
8f74200d7c34e696c65840d4c5738c63
d1d931abc97076a638d55221668779b9
2,800
PASSED
// #pragma GCC optimize("O3") // #pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; const int inf = 1e9 + 1; const int N = 1e5 + 10; const int M = 4e6 + 10; int nn, s, t, num = 1; int head[N], dis[N], cur[N]; struct P { int to, ne, flow, cap; }e[M << 1]; bool vis[N]; queu...
C++
8f74200d7c34e696c65840d4c5738c63
78638cfdb02c7866b55ce0e901d0f19d
2,800
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T> class dinic { public: const T inf = numeric_limits<T>::max(); const int n, source, sink; struct edge { int from, to; T c, f; }; vector<vector<int>> g; vector<edge> edges; vector<int> d, ptr; queue<int> q; ...
C++
8f74200d7c34e696c65840d4c5738c63
b680df217343df39727529a69e0aa3ee
2,800
PASSED
#include<bits/stdc++.h> #define mp make_pair #define mt make_tuple #define ff first #define ss second using namespace std; template <typename T> using matrix = vector<vector<T>>; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1;...
C++
8f74200d7c34e696c65840d4c5738c63
156793578a39dc899950959685817cbe
2,800
PASSED
import java.util.*; public class Main{ public static void main(String ...arar){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String s=sc.next(); List<Character> l=new ArrayList<>(); for(int i=0;i<n;i++){ if(!l.contains(s...
Java
8ca8317ce3f678c99dc746cb9b058993
f80dd4ee993508a80577ad20e155ee74
1,200
PASSED
import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class alter { static int check(String s, char c) { int n = s.length(); if (n == 1) { return 0; } if (n == 2) { if (s.charAt(0) == s....
Java
8ca8317ce3f678c99dc746cb9b058993
3c7dbc2c3a30ffa8ab83941c8473308f
1,200
PASSED
import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class palin { public static void main(String[] args) throws IOException { Scanner sc= new Scanner(System.in); PrintWriter out = new PrintWriter(new BufferedOutputStream(System....
Java
8ca8317ce3f678c99dc746cb9b058993
7cd6a20053e2ac56fe8837f2a12c8551
1,200
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class Main { // Graph // prefix sums //inputs public static void main(String args[]) throws Exception { Input sc = new Input(); preca...
Java
8ca8317ce3f678c99dc746cb9b058993
00318605ad26e00e303fe835d3f1615f
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class HelloWorld3 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new In...
Java
8ca8317ce3f678c99dc746cb9b058993
a02b7b05d943d71a765144ebf2bd013c
1,200
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class JavaApplication1 { static int num = 0; static long mod = (long)...
Java
8ca8317ce3f678c99dc746cb9b058993
66843539291c07080e1b5d09ab4a3161
1,200
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class JavaApplication1 { static int num = 0; static long mod = (long) 1...
Java
8ca8317ce3f678c99dc746cb9b058993
f43b819f45dcb03a45c4bd28fbeef8dd
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class KnitsAScarf { public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.pa...
Java
8ca8317ce3f678c99dc746cb9b058993
9bdefbdc1c251142c03c917b0021819c
1,200
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9 + 7; // static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); ...
Java
8ca8317ce3f678c99dc746cb9b058993
aa0587976e6b3a6e3060a95a12b4cb56
1,200
PASSED
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) { new MainClass().execute(); } } class MainClass extends PrintWriter { MainClass() { super(System.out, true); } boolean cases = true; // Solution void solveIt(int testCa...
Java
8ca8317ce3f678c99dc746cb9b058993
ae6e43e5d895b664ef8649402266c658
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define fore(i, l, r) \ for (auto i = (l) - ((l) > (r)); i != (r) - ((l) > (r)); i += 1 - 2 * ((l) > (r))) #define all(a) begin(a), end(a) #define sz(a) int(a.size()) #define pb push_back #define f first #define s second #ifdef LOCAL #include "../debug.h" #else #define ...
C++
c4541021337252c7e2c4afd2de8cd766
24ab0cb43f36607b35365b43264ffce1
1,600
PASSED
#include <bits/stdc++.h> #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define MOD 1000000007 #define MOD1 998244353 #define inf 1e18 #define endl "\n" #define pb push_back #define ppb pop_back #define mp make_pair #define ff first #define ss second #define set_bits __built...
C++
c4541021337252c7e2c4afd2de8cd766
3ba1d2347d838273693d1f8514583547
1,600
PASSED
/** * In The Name Of GOD * author : Behrad **/ #include "bits/stdc++.h" #define sz(x) ((int) (x).size()) using namespace std; const int N = 2e5 + 11; int a[N]; bool f(int n) { if (n < 0) return 0; return 1; } void doo() { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n; ...
C++
c4541021337252c7e2c4afd2de8cd766
dd235ede5b7d5a161ba8dd2ee0365ef0
1,600
PASSED
#include <iostream> #include <algorithm> #include <functional> #include <string> #include <math.h> #include <stack> #include <queue> #include <vector> #include <set> #include <unordered_set> #include <map> using namespace std; typedef long long ll; #define speed ios_base::sync_with_stdio(false);cin.tie(N...
C++
c4541021337252c7e2c4afd2de8cd766
e56d4e73e9c4a32f5bb97c9c8a554304
1,600
PASSED
#include<iostream> #include<algorithm> #include<string> #include<vector> using namespace std; typedef long long ll; const int maxn=5e5+10; ll num[maxn]; int ans[maxn]; ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b); } int main(){ int t,n; cin >> t; while(t--){ cin >> n; ll g=1; for(int i=0;i<n;i++){...
C++
c4541021337252c7e2c4afd2de8cd766
9c11515862f845fb2ae2e5d072b3eebf
1,600
PASSED
/// Template : #include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define si(a) scanf("%d",&a) #define si2(a,b) scanf("%d%d",&a,&b) #define si3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define sl(a) scanf("%lld",&a) #define sl2(a,b) scanf("%lld%lld",&a,&b) #define sl3(a,b, c) scanf("%lld%ll...
C++
c4541021337252c7e2c4afd2de8cd766
9655d4fe17773190420c4bcbdc24d4ce
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void dark() { int n; cin>>n; int a[n]; vector<int>v; for(int i=0;i<n;i++){ cin>>a[i]; } int c=0; if(n%2==1){ if(a[1]+a[0]){ v.push_back(a[2]); v.push_back(a[2]); v.push_back(-1*(a[1]+a[0])...
C++
c4541021337252c7e2c4afd2de8cd766
92506ea68501b43fe5d60cd3297099ba
1,600
PASSED
#include<iostream> #include<algorithm> #include<cstring> #define MAXN 100010 using namespace std; int t,n; int a[MAXN],b[MAXN]; int main() { scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); if(n%2==0) { //偶数容易构...
C++
c4541021337252c7e2c4afd2de8cd766
72bbc2053e362d6b795221846aa64cb0
1,600
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; // cout << "here"; vector<int> a(n + 5); for (int i = 1; i <= n; i++) { cin >> a[i]; } vector<int> ans(n + 5); if (n % 2 == 0) { for (int i = 1; i <= n; i += 2) { a...
C++
c4541021337252c7e2c4afd2de8cd766
cc3559c12de5260d7f71fa2a0393289e
1,600
PASSED
#include <stdio.h> #include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <string.h> #include <stack> #include <bitset> #include <queue> #include <math.h> #include <unordered_map> using namespace std; typedef long long ll; ll a[100010]; ll b[100010]; int main(){ int t; ...
C++
c4541021337252c7e2c4afd2de8cd766
66e1fce7aa30a7485e483904cdc50e05
1,600
PASSED
#include<bits/stdc++.h> using namespace std; long long n,a,b,c; int main() { //也是实验室生日会哦 乱打 cin>>n; for(int i=1;i<=n;++i)// { cin>>a>>b>>c; if(c==1&&a==1&&b==0) cout<<2<<endl; else cout<<(a+b*2+c*3)%2<<"\n"; } return 0; }
C++
4322861935ca727b0de8556849bc5982
d8c53673664d4afed2200b387a4cb9cc
800
PASSED
#include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { long long a,b,c; cin >>a>>b>>c; if ((a+b*2+c*3)%2==0) { cout<<0<<endl; } else { cout<<1<<endl; } } return 0; }
C++
4322861935ca727b0de8556849bc5982
0e68af5bf59fa46f6b658835726da279
800
PASSED
#include <iostream> using namespace std; int main() { int t; cin >> t; while (t--) { long long a,b,c; cin >>a>>b>>c; if ((a+b*2+c*3)%2==0) { cout<<0<<endl; } else { cout<<1<<endl; } } return 0; }
C++
4322861935ca727b0de8556849bc5982
58375b5e72e3e7545518a70188d1ddaf
800
PASSED
#include <bits/stdc++.h> #define getchar() (tt == ss && (tt = (ss = ln) + fread(ln, 1, 1 << 20, stdin), ss == tt) ? EOF : *ss++) using namespace std; char ln[2 << 21], *tt = ln, *ss = ln; inline long long read() { register long long d = 0, f = 1; register char c = getchar(); while(c < '0' || c > '9') { ...
C++
4322861935ca727b0de8556849bc5982
79d4510511ad7b7e1a28d61e93a11dd1
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,a,b,c; scanf("%d",&t); for(int i=0;i<t;i++) { scanf("%d%d%d",&a,&b,&c); a%=2; b%=2; c%=2; if(a==0 && b==0 && c==0) printf("0\n"); else if(a==0 && b==0 && c==1) printf("1\n"); else if(a==0 && b==1 && c==0) printf("0\n"); els...
C++
4322861935ca727b0de8556849bc5982
5476df01eb385a401b0f41fb29ae8c13
800
PASSED
#include<iostream> #define int long long using namespace std; int n,a,b,c; signed main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b>>c; cout<<(a+b*2+c*3)%2<<endl; } return 0; } //asdfadf
C++
4322861935ca727b0de8556849bc5982
c071ba596ff2466e37f36ca2aa35629c
800
PASSED
#include<iostream> #define int long long using namespace std; int n,a,b,c; signed main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b>>c; cout<<(a+b*2+c*3)%2<<endl; } return 0; }
C++
4322861935ca727b0de8556849bc5982
4bf225139d7b49c5aa192e6f41cc7974
800
PASSED
#include<bits/stdc++.h> using namespace std; long long t,a,b,c; int main(){ cin>>t; while(t--){ cin>>a>>b>>c; if(c==1&&a==1&&b==0){ cout<<2<<endl; } else{ cout<<(a+b*2+c*3)%2<<endl; } } return 0; }
C++
4322861935ca727b0de8556849bc5982
66cf51482753dc3c64a53f0bf9cd9b56
800
PASSED
#include<bits/stdc++.h> using namespace std; long long n,a,b,c; int main() { ios::sync_with_stdio(0); cin>>n; while (n--) { cin>>a>>b>>c; cout<<(a+2*b+3*c)%2<<endl; } return 0; }
C++
4322861935ca727b0de8556849bc5982
ae94a5607ebe1212ffe2eed684899647
800
PASSED
#include<bits/stdc++.h> using namespace std; int t; int main(){ cin>>t; for(int i=1;i<=t;++i){ int a,b,c,s; cin>>a>>b>>c; s=a*1+b*2+c*3; if(s%2==0){ cout<<0<<endl; } else{ cout<<1<<endl; } } return 0; }
C++
4322861935ca727b0de8556849bc5982
99eee917f4ab016662f1b4630a7b58ab
800
PASSED
#include <iostream> using namespace std; int main() { long long t, i, n, a; cin >> t; while (t--) { cin >> n; long long x = 0, y = 0; for (i = 1; i <= n; i++) { cin >> a; if (a == 0) x++; if (a == 1) y++; } long long r = y; for (i = 1; i <= x; i++) r = r * 2; cout << r << endl; ...
C++
d786585fee251ebfd5c3e8d8b0425791
acc1aa9c48655e50842c5425c2eb52d8
900
PASSED