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 <iomanip> #include <vector> #include <string> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <cmath> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define nl endl #define cy cout << "YES\n" #defin...
C++
d786585fee251ebfd5c3e8d8b0425791
8492d0a842c54b8be213c2c6a7acc43f
900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int t; int n; int a[60]; ll fast_exp(ll b, ll p) { if (p == 0) return 1; if (p == 1) return b; ll res = fast_exp(b, p / 2); res *= res; if (p % 2 != 0) res *= b; return res; } void solve() { scanf("%d", &n); int zero = 0, one = 0; ...
C++
d786585fee251ebfd5c3e8d8b0425791
04d19cf7224abc78e605bdc950fe43bb
900
PASSED
#include <iostream> #include<algorithm> #include <math.h> #include<map> using namespace std; int main() { int T; cin >> T; while (T--) { int n; cin >> n; int e = 0; int o = 0; while (n--) { int x; cin >> x; if (x == 1) { e++; } if (x == 0) { o++; } } long long ...
C++
d786585fee251ebfd5c3e8d8b0425791
6c32630984d32a9f1883059cfa82f857
900
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define TN typename #define vout(v) for (auto z: v) cout << z << " "; cout << endl; const int M = 1e9 + 7; const int Inf = (int)2e9 + 5; const int Lnf = (int)2e18 + 5; const int N = 5e5 + 5; const int NN ...
C++
d786585fee251ebfd5c3e8d8b0425791
6d03fd07bba610e59052615167d74940
900
PASSED
#include<bits/stdc++.h> using namespace std; #define INF 1000000007; typedef long long int ll; template <typename T> inline T maxi(T x, T y) { if(x>y) return x; else return y;} template <typename T> inline T maxi(T x, T y,T z) { return maxi(maxi(x,y),z);} template <typename T> inline T mini(T x, T y) { if(x<y) retur...
C++
d786585fee251ebfd5c3e8d8b0425791
38431329951b62364ad9371774807555
900
PASSED
#include<iostream> #include<math.h> typedef long long ll; using namespace std; int main() { int t,n; ll a; cin>>t; while(t--) { cin>>n; ll res0=0,res1=0; for(int i=1; i<=n; i++) { cin>>a; if(a==1) { res1++; } else if(a==0) { res0++; } } ll ans=res1*pow(2,res0); cout<<ans<<endl; } r...
C++
d786585fee251ebfd5c3e8d8b0425791
c3977635b736fa8ba852e87135c74688
900
PASSED
//Too Wrong to pass Too Correct to fail #include <iostream> #include<bits/stdc++.h> #define ll long long using namespace std; int main() { ll t,n; cin>>t; while(t--) { ll count =1,cont=0,sum=0,p=0; cin>>n; ll a[n]; for(int i=0;i<n;i++) {cin>>a[i]; sum+=a[i];} for(int i...
C++
d786585fee251ebfd5c3e8d8b0425791
4ec1b97525b17fbae886028fe8e90ee1
900
PASSED
#include<iostream> #include<string.h> #include<math.h> using namespace std; int a[100]; int main() { int t;//测试用例 cin>>t; while(t--) { memset(a,0,sizeof(a)); int n;//个数 cin>>n; for(int i=0; i<n; i++) cin>>a[i]; long long s=0; int flag1=0,flag0=0; for(int i=0; i<n; i++) { if(a[i]==1) flag1++; ...
C++
d786585fee251ebfd5c3e8d8b0425791
bea4745635fbe8fb25cb1d8da3c4a412
900
PASSED
#include<iostream> #include<cstdio> using namespace std; int ze,o; int t,n; long long get(int c) { long long res = 1; for(int i=0;i<c;i++) { res *= 2; } return res; } int main() { cin >> t; while(t--) { o = 0,ze = 0; scanf("%d",&n); for(int i=0;i<n;i++) { ...
C++
d786585fee251ebfd5c3e8d8b0425791
d2675f1826f96fb57a02da367221443a
900
PASSED
// i started at 1:03 A.M. 1/2/2022 Author:: Gorssorser , nice to see you here , thnx for visiting // why i always fall so quickly #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <iostream> #include <iomanip> #include <stdio.h> #include <limits.h> ...
C++
6057052f1eb001da04e3415001cce228
9b4934956bec81610c40b6954aec6b61
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=100010; int a[N]; int ans[N]; int dp[2][N];//滚动数组 int main() { int n; scanf("%d",&n); memset(dp,0x3f,sizeof dp); dp[0][0]=0; int k=1; for(int i=1;i<=n;i++,k^=1) { scanf("%d",&a[i]); for(int j=0;j<=512;j++) { if(dp[k^1][j...
C++
6057052f1eb001da04e3415001cce228
51727d78a786eeb3d22a24fec0bae0df
1,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=100010; int a[N]; int ans[N]; int dp[2][N];//滚动数组 const int inf=0x3f3f3f3f; int main() { int n; scanf("%d",&n); memset(dp,0x3f,sizeof dp); dp[0][0]=0; int k=0; for(int i=1;i<=n;i++,k^=1) { scanf("%d",&a[i]); for(int j=0;j<512;j++) ...
C++
6057052f1eb001da04e3415001cce228
8e58c19e7d3a65d65bad2e717a848b23
1,800
PASSED
#include <bits/stdc++.h> const int N = 100010; const int inf = 0x3f3f3f3f; int n, a[N], dp[2][N], cur, ans[N]; int main() { scanf("%d", &n); memset(dp, inf, sizeof(dp)); dp[cur][0] = 0; for (int i = 1; i <= n; ++i, cur ^= 1) { scanf("%d", &a[i]); for (int j = 0; j < 512; ...
C++
6057052f1eb001da04e3415001cce228
b094a7e6bd5510c8a9b123930d568510
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int c[8193],z=1; vector<int>v; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int x,y;cin>>x; for(int j=1;j<=8192;j++)c[j]=(1<<14); for(int i=0;i<x;i++){ cin>>y;z+=(c[y]==(1<<14));c[y]=min(c[y],y); for(int j=0;j<=8192;j++){ if(c[j]<y)...
C++
6057052f1eb001da04e3415001cce228
8ca3625775770693aaf577f0f9c02c9b
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int c[8193]; vector<int>v; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int x,y;cin>>x; for(int j=1;j<=8193;j++)c[j]=1<<14; for(int i=0;i<x;i++){ cin>>y;c[y]=min(c[y],y); for(int j=0;j<=8193;j++) if(c[j]<y)c[j^y]=min(c[j^y],y); ...
C++
6057052f1eb001da04e3415001cce228
518caec63fb98f654d47403cb02fe6c4
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int dp[520],c[520]; vector<int>v; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int x,y;cin>>x; for(int j=0;j<=512;j++)dp[j]=0,c[j]=1e9; for(int i=0;i<x;i++){ cin>>y;dp[y]=1;c[y]=min(c[y],y); for(int j=0;j<=512;j++){ if(c[j]<y){ ...
C++
6057052f1eb001da04e3415001cce228
6bc7612e0f085dc06316e8dffeb8e6bf
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #pragma GCC optimize ("Ofast") #define int ll #define double ld const int inf = 2e9; const int INF = 4e18; const int mod = 1e9+7; #define F first #define S second #define vi vector<int> #define vvi vector<v...
C++
6057052f1eb001da04e3415001cce228
f6c29b5a32c85207267f0f08f82559c6
1,800
PASSED
#include <algorithm> #include <iostream> #include <vector> static std::vector<int> read_a() { using std::cin, std::vector; int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } return a; } static void print_range(int from, int to) { using std::cout, std::endl; if (from < to) { ...
C++
6057052f1eb001da04e3415001cce228
7532d4697c6c917f414a092c72e2dc40
1,800
PASSED
#include <cmath> #include <iostream> #include <set> #include <climits> #include <algorithm> #include <cassert> #include <vector> #include <iomanip> #include <type_traits> #include <string> #include <queue> #include <map> using namespace std; int main() { ios_base::sync_with_stdio(false); cin....
C++
6057052f1eb001da04e3415001cce228
92fac0ce31440504e30f0021a8e8ad2e
1,800
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native") #include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define vi vector<short> #define vvi vector<vi > #define all(x) x.begin(), x.end() int n;...
C++
b4d8a79dc61a046f84dd7184929ba55e
38b40fdd88a67d5336ad9620cefa6ee1
2,400
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native") #include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define vi vector<short> #define vvi vector<vi > #define all(x) x.begin(), x.end() int n;...
C++
b4d8a79dc61a046f84dd7184929ba55e
51a6d2f5eccb55083acc7eabadcecc00
2,400
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native") #include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define vi vector<char> #define vvi vector<vi > #define all(x) x.begin(), x.end() ll n, m...
C++
b4d8a79dc61a046f84dd7184929ba55e
778fa95f710855dab282a25f825ac590
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define vi vector<char> #define vvi vector<vi > #define all(x) x.begin(), x.end() ll n, m = (1 << 13), k = 5001; vvi dp, dd; set<short> s; vector<vector<short> > cur; int main() { ios_base::sync_with_stdio(fals...
C++
b4d8a79dc61a046f84dd7184929ba55e
6d9e511887accf035d167d670ea07099
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
588bbc5002a4ca35147f971ec627b0fe
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
e2a70ade790ff038ab5882fceb780e76
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
4bc4dbe3c3fe4d17aaf47f71b19fd1a0
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
8ea132b880c1616dd179890c377e1a50
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
561c8ec42a50cc924055de419432bcb9
2,400
PASSED
#define DEBUG 0 #define TESTSETS 0 #if DEBUG #include <ultimate_power_2.h> #else #include <bits/stdc++.h> #define echo(...) {} #endif /* -------------------------------------------------------- Utils ---------------------------------------------------------------- */ #define debug if(DEBUG) #de...
C++
b4d8a79dc61a046f84dd7184929ba55e
ee33c33a3f6984e359f4b1a4b175aa21
2,400
PASSED
#include <bits/stdc++.h> #define INT long long #define pi pair<int, int> using namespace std; const int NN = 110000; const INT INF = 1e10; INT a[NN], dp[NN][555], s[NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int T; scanf("%d", &T); while(T --){ in...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
41baea026c5dd23d28975f1d210fd18f
2,000
PASSED
#include<bits/stdc++.h> #define NN 100100 #define INT long long #define N 1e9+10 using namespace std; INT a[NN],dp[NN][510],s[NN]; int main(){ #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); #endif int t; cin >> t; while (t--){ int n,ans =0 ; scanf("%d", &n); for(int i = 1; i <=...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
d4c19bc504e3d9a3cd2f38519bc08684
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long INT; const int NN = 1e5 + 100; int a[NN]; INT s[NN], dp[NN][555]; void solve(){ int n; scanf("%d", &n); for(int i = 1; i <= n; i ++){ scanf("%d", &a[i]); s[i] = s[i - 1] + a[i]; } for(int i = 1; i <= n + 1; i ++){ for(int j = 0; j <= 500; j ++){ ...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
d0a167937e5aa91d35a601d57199417d
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f3f3f3f3fLL; const int mod=1e9+7; #define INT long long #define x first #define y second const int NN=1e5+100; INT a[NN]; INT dp[NN][500]; int main(){ #ifndef ONLINE_JUDGE // freopen("in.in", "r", stdin); // freopen("out.out", "w", stdout); #e...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
59a0f9f555344a9de91603204328591b
2,000
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; const int NN = 1e5 + 10; int A[NN], dp[NN][550]; INT sum[NN]; ///////////// Victory /////////////////// int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int t; cin>>t; while(t --){ int n, an...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
15065af53f7bdd4ffaae517f42877be9
2,000
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; const int NN = 1e5 + 10; int A[NN], dp[NN][550]; INT sum[NN]; ///////////// Victory /////////////////// int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int t; cin>>t; while(t --){ int n, an...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
5bbbd3d3e77de29c689176678cf9eabe
2,000
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; const int NN = 1e5 + 10; int A[NN], dp[NN][550]; INT sum[NN]; ///////////// Victory /////////////////// int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int t; cin>>t; while(t --){ int n, an...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
bcb372cef35549745457cad2947f776d
2,000
PASSED
#include <bits/stdc++.h> #define NN 100100 #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],sum[NN]; INT dp[NN][520]; int main() { int q; scanf("%d", &q); for(int ta = 1;ta <= q;ta ++){ int n; scanf("%...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
dcc0673384dda4fb43f2d2ded0d1280b
2,000
PASSED
#include<bits/stdc++.h> using namespace std; using INT = long long; const int NN = 101000; const int MM = 555; const INT inf = 1e18; INT a[NN]; INT dp[NN][MM]; int b[NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int T; cin >> T; while(T--) { in...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
16b503c965dfa137ddb9499102358674
2,000
PASSED
#include<bits/stdc++.h> using namespace std; using INT=long long; const int NN=100100; int a[NN]; INT s[NN]; int dp[NN][555]; int main(){ #ifndef ONLINE_JUDGE freopen("in.in","r",stdin); freopen("out.out","w",stdout); #endif int t;cin>>t; while(t--){ int n;scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",a+i),...
C++
cc21fe2f33fed13e6fe0fb25f197ca8f
aea6196bfda93159eea28f8de35ca48b
2,000
PASSED
// a big egg #include<iostream> #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using L = __int128; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"...
C++
609c531258612e58c4911c650e90891c
46b905ba2c3379fad190926a0719fba2
2,600
PASSED
// a big egg #include<iostream> #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using L = __int128; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"...
C++
609c531258612e58c4911c650e90891c
956bdec96ef8d57721e02c29a6c1d6aa
2,600
PASSED
// a big egg #include<iostream> #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using L = __int128; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"...
C++
609c531258612e58c4911c650e90891c
904cd43a3382f8297027d604cbc83e9e
2,600
PASSED
// a big egg #include<iostream> #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using L = __int128; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"...
C++
609c531258612e58c4911c650e90891c
ef35ba39359ccc4367d38f3452d60cdf
2,600
PASSED
// a big egg #include<iostream> #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using L = __int128; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"...
C++
609c531258612e58c4911c650e90891c
135c6129f00d92ba7427b6621aa9cb2e
2,600
PASSED
#pragma GCC target( \ "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,lzcnt,bmi,bmi2") #pragma GCC optimize("-O3,-funroll-loops,-march=native,-mtune=native") #include <bits/stdc++.h> using namespace std; struct State { int pos; map<int, int> nom; map<int, int> den; }; void Merge(map<int, int...
C++
609c531258612e58c4911c650e90891c
755d3e8486c85c08523f149668a65709
2,600
PASSED
/*input 7 6 4 10 1 2 15 1 '/'/'// */ #include<bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; #pra...
C++
609c531258612e58c4911c650e90891c
c50b82d012b1db0413897e698c6d417b
2,600
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define vi vector<int> #define vvi vector<vi > #define all(x) x.begin(), x.end() struct SparseTable { int n, k; vvi st; vi x, y; SparseTable() {}; SparseTable(const vi& a) { n = k = 1; ...
C++
609c531258612e58c4911c650e90891c
a930595582f9a3a4f4bb2fc2411d8f14
2,600
PASSED
#include <bits/stdc++.h> #include <ext/rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#define int long long #define pb pus...
C++
609c531258612e58c4911c650e90891c
9d8a41673c30ea11a8e026b1ec71d600
2,600
PASSED
#include<iostream> #include<vector> #include<stack> using namespace std; const int mx=1e6; int p[1000001]; int a[1000001]; struct len{ int num,pw,id; len(){ num=id=0; } }; vector<int>pos[mx+1]; vector<len>b[mx+1]; vector<int>l[mx+1]; struct anothersegmentree{ vector<int>st; int sz; void setup(int n){...
C++
609c531258612e58c4911c650e90891c
e5c134094f2aaa976680e7790241c2b0
2,600
PASSED
#include<bits/stdc++.h> using namespace std ; # define int long long const double pi = 2 * acos (0.0) ; const int N=1e7+9 ; const int INF=INT_MAX ; int32_t main() { ios_base :: sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL) ; int t ; cin >> t ; while(t--) { ...
C++
a97e70ad20a337d12dcf79089c16c9f0
9b2436f2bf0303569767345385097e3e
1,100
PASSED
#define _CRT_SECURE_NO_WARNINGS 1 #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 50; #define ll long long ll a[N]; int main() { ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); // cin.tie(nullptr);cout.tie(nullptr); int T; cin >> T; while (T--) { int n; cin >> n; cin...
C++
a97e70ad20a337d12dcf79089c16c9f0
b307314a6df55f1f665ae113b0cf8970
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int a[200005],b[200005],c[200005]; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int x=0,y=0; for(int i=0;i<n;i++) { cin>>b[i]; if(b[i]&1)a[++x]=b[i]; else c[++y]=b[i]; } for(int i=2;i<=x;i++) { if(a[i]<a[i-1]) { puts("NO"); ...
C++
a97e70ad20a337d12dcf79089c16c9f0
f8414febe89c875477f9ea57343cc7ac
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef string str; typedef long long ll; typedef pair<int, int> ii; void solve() { int t; cin >> t; for (int i=0; i<t; i++) { int n; cin >> n; bool possible = 1; int odd=1, even=0; for (int j=0; j<n; j++) { int x; cin >> x; if (x%2) { if (odd > x)...
C++
a97e70ad20a337d12dcf79089c16c9f0
68237dbd036231ee19bb9ca06e245c81
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int T;cin>>T;int a; while(T--){ vector<int>ou,ji; int n;cin>>n; for(int i=0;i<n;i++){ cin>>a; if(a%2)ji.push_back(a); else ou.push_back(a); }bool flag=0; for(int i=0;i<(int)ji.si...
C++
a97e70ad20a337d12dcf79089c16c9f0
e99c8464b4fa6ecd0a6903fed95a8523
1,100
PASSED
#include<bits/stdc++.h> #define ll long long #define inf 1000000000000LL #define pii pair<int,int> #define ff first #define ss second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int tc; cin >> tc; while (tc--) { int n; cin >> n; int arr[n+5]; std::vector<int> v; i...
C++
a97e70ad20a337d12dcf79089c16c9f0
bb0337f63751682bc698b8542eb4a492
1,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; void solve() { int n; cin >> n; vector<int> a, b; for(int i = 0; i < n; i ++) { int x; cin >> x; if(x & 1) a.emplace_back(x); else b.emplace_back(x); } bool ok = true; for(int i = 1; i < a...
C++
a97e70ad20a337d12dcf79089c16c9f0
9dd6be5ef8891331ccd0deab5cf55fba
1,100
PASSED
/* SKEET IS HERE */ #include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <cstring> #include <iomanip> #include <map> using namespace std; #define int long long typedef long long ll; typedef vector<int> vi; #define F first #define nl '\n' #define S second #define PB pu...
C++
a97e70ad20a337d12dcf79089c16c9f0
b0f88b5fc26b6d30103baa3b8c134b69
1,100
PASSED
#include <iostream> #include <algorithm> using namespace std; bool solve(void); int main(void) { int m; cin >> m; while (m--) cout << (solve() ? "YES" : "NO") << endl; return 0; } int j[200000], o[200000], n; bool solve(void) { int t, l, k; t = k = l = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> t; ...
C++
a97e70ad20a337d12dcf79089c16c9f0
ea5f4a59c70942528f0bb26a9cf0dae1
1,100
PASSED
#include<bits/stdc++.h> #define endl '\n' typedef long long ll; #define all(x) (x).begin(), (x).end() using namespace std; void fastCode() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } int even[100001]; int odd[100001]; int main(){ fastCode(); int t; cin>>t; while(t--) { int n; ci...
C++
a97e70ad20a337d12dcf79089c16c9f0
ca40722715fe75560933c8ae59cb4d7a
1,100
PASSED
#include<algorithm> #include<cstring> #include<cstdio> #include<iostream> #include<vector> #include<queue> using namespace std; const int N=505; int a[N]; bool flag=false; int n; void cc() { int l,r; for(int i=1;i<=n;i++) { int maxx=a[i]; l=i; r=i; for(int j=i+1;j<=n;j++){ if(a[j]<maxx){ r=j...
C++
a57823a7ca0f67a07f94175ab59d33de
1b3fef34180299d6f71278e24bd94dd5
800
PASSED
#include<stdio.h> #include<string.h> #include<math.h> #include<stdbool.h> #include<stdlib.h> #include<iostream> #include<algorithm> using namespace std; int n; int t,a[505]; int main() { cin>>t; while(t--){ memset(a,0,sizeof a); int n,flag1=0,flag2=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int...
C++
a57823a7ca0f67a07f94175ab59d33de
27540cefd773c117cbd41c9161a765e0
800
PASSED
#include<iostream> #include<algorithm> #include<string.h> #include<string> #include<queue> #include<stack> #include<vector> #include<set> #include<map> #include<stdlib.h> #include<utility> #include<math.h> #include <random> using namespace std; const int maln = 1e6+10; const int inf=0x3f3f3f3f; typedef long long ll; ...
C++
a57823a7ca0f67a07f94175ab59d33de
6c234985fa998dbbf099bce6a08893f6
800
PASSED
#include<iostream> #include<algorithm> using namespace std; int a[505]; int n,l,r; void fun(){ for(int i=1;i<=n;i++){ int t=a[i]; l=i,r=i; for(int j=i+1;j<=n;j++){ if(a[j]<t){ r=j; t=a[j]; } } if(t==a[i])continue; else{ for(int i=1;i<l;i++) cout<<a[i]<<" "; for(int i=r...
C++
a57823a7ca0f67a07f94175ab59d33de
563e0ba346fd8fe28b998c75a438a018
800
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n,t,a[505],pos[505]; int main() { scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); pos[a[i]]=i; } for(int i=1;i<=n;i++) { if(pos[i]!=i) { reverse(a+i,a+pos[i]+1); break; } ...
C++
a57823a7ca0f67a07f94175ab59d33de
fb90331a9a373092f611cd7943bb8c77
800
PASSED
#include<bits/stdc++.h> #include<algorithm> using namespace std; const int N=1e5+10; int p[N]; int main() { int t; cin>>t; while(t--) { int n; cin>>n; for(int i=1;i<=n;i++) cin>>p[i]; int l=0,r=0; int num=0; for(i...
C++
a57823a7ca0f67a07f94175ab59d33de
3f8819e842b7ab30472daa1efa80d73f
800
PASSED
#include<iostream> #include<algorithm> #include<cstring> using namespace std; int a[505],b[505]; int main(){ int t; cin>>t; while(t--){ memset(a,0,sizeof a); memset(b,0,sizeof b); int n; cin>>n; int nu=n; int o=1; for(int i=1;i<=n;i++){ int x; cin>>x; if(x>nu) nu--; else { a[o]=x; b...
C++
a57823a7ca0f67a07f94175ab59d33de
2f83a4c07c9214bb226b6de225018be0
800
PASSED
#include<iostream> #include<algorithm> #include<string.h> #include<string> #include<queue> #include<stack> #include<vector> #include<set> #include<map> #include<utility> #include<math.h> using namespace std; const int N=1e5+5; int s[N]; int main() { int t; cin >> t; while(t--) { memset(s,0,sizeof(s)); int n; ...
C++
a57823a7ca0f67a07f94175ab59d33de
2c6b0bbd400848b09e2549965de9118e
800
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define ll long long using namespace std; int a[550]; int main(){ int t,n; scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } for(int i=1;i<=n;i++) if(a[i]!...
C++
a57823a7ca0f67a07f94175ab59d33de
27348124e7a56a20846ee5ea82a179b6
800
PASSED
#include<iostream> #include<algorithm> #include<cstring> using namespace std; int main() { int t,n; int a[505]; cin>>t; while(t--) { memset(a,0,sizeof a); cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } int l=0,r=0; for(int i=1;i<=n;i++) { if(a[i]!=i) { l=i; for(int j...
C++
a57823a7ca0f67a07f94175ab59d33de
e4b212ef93ae9a674de8be4002512cab
800
PASSED
// C #define YYF_PreMax #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <st...
C++
b371d47ea08091917ab632e559ee75c6
867c37eb74ac47ec795c8981e3aaa5d9
1,300
PASSED
// C #define YYF_PreMax #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <st...
C++
b371d47ea08091917ab632e559ee75c6
b13f3db028f221fb6f4d057997e22b70
1,300
PASSED
// C #define YYF_Stack #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <str...
C++
b371d47ea08091917ab632e559ee75c6
a9d7d0d845009aaf88859017f29a80a8
1,300
PASSED
// C #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
b371d47ea08091917ab632e559ee75c6
2c278a91c472f0127a99a1e9223b759d
1,300
PASSED
// C #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
b371d47ea08091917ab632e559ee75c6
2289d05a2020cf57f5fd71ae5c34cc9c
1,300
PASSED
#define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #inc...
C++
b371d47ea08091917ab632e559ee75c6
2721a3f744002210921f08c2d9935bd5
1,300
PASSED
// C #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
b371d47ea08091917ab632e559ee75c6
d73d5b32ec12cfc8f21b910b5a3374b4
1,300
PASSED
// B #define YYF_Stack #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <str...
C++
b371d47ea08091917ab632e559ee75c6
8688b8f2562a8c4883f3702b5da66038
1,300
PASSED
// C #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
b371d47ea08091917ab632e559ee75c6
5d7922e6b06e2a6cf5d7145b798fd214
1,300
PASSED
// C #define YYF #include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> ...
C++
b371d47ea08091917ab632e559ee75c6
c3bda0cd82ed1944e716e7aaab083cf6
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long int const int MOD = 1e9 + 7; const int Num = 2e5 + 10; vector <int> Fact; vector <bool> Prime; vector <int> B_Tree; vector <int> Parent; vector <int> Rank; //extract last set bit x & (-x) //remove last set bit x - (x & (-x)) //add l...
C++
3e08a9ef172ece7839728439d5b608a8
c235ffecf2a4211e168f08dff48d71a5
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long int const int MOD = 1e9 + 7; const int Num = 2e5 + 10; vector <int> Fact; vector <bool> Prime; vector <int> B_Tree; vector <int> Parent; vector <int> Rank; //extract last set bit x & (-x) //remove last set bit x - (x & (-x)) //add l...
C++
3e08a9ef172ece7839728439d5b608a8
2557538f1e5f8b6866e433a51c5b527c
2,000
PASSED
#include <bits/stdc++.h> using namespace std; int N,M; int Grid[1001][1001]; bool Check(int i, int j) { if ( i >= 0 && j >= 0 && i < N-1 && j < M-1 ) { vector <int> Square = {Grid[i][j],Grid[i+1][j],Grid[i][j+1],Grid[i+1][j+1]}; sort(Square.begin(),Square.end()); int Count = 0,Diff = -1; fo...
C++
3e08a9ef172ece7839728439d5b608a8
5acce20dbc2880dfe4516e03340f14f1
2,000
PASSED
#include <bits/stdc++.h> using namespace std; int kl[1003][1003]; struct S { int x, y, z; }; bool cp(int x, int y) { vector<int> cs = {kl[x][y], kl[x - 1][y], kl[x - 1][y - 1], kl[x][y - 1]}; sort(cs.begin(), cs.end()); for (int i = 0; i < 4; i++) { if (cs[i] == -1) ...
C++
3e08a9ef172ece7839728439d5b608a8
4e097e0c199d6c90d5d4e527d5ca37b1
2,000
PASSED
#include<bits/stdc++.h> using namespace std; //----------------------------------------- #define sz(x) ((int)(x).size()) typedef long long ll; //---------------------------------------------- const int inf = 2e9; const int mod = 998244353; const int N = 1000+10; //----------------------------------------...
C++
3e08a9ef172ece7839728439d5b608a8
e9867fc140ab195b187ede360f5c05ba
2,000
PASSED
#include<iostream> #include<algorithm> #include<queue> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define ff first #define ss second const int N = 1000 + 3; const int dx[8] = { -1, -1, -1, 0, 1, 1, 1, 0 }; const int dy[8] = { -1, 0, 1, 1, 1, 0, -1, -1 }; int m, n; int a[N][N]...
C++
3e08a9ef172ece7839728439d5b608a8
3a66591ac45f55fdbb2a1b1823cd399c
2,000
PASSED
#include<iostream> #include<algorithm> #include<queue> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define ff first #define ss second const int N = 1000 + 3; const int dx[8] = { -1, -1, -1, 0, 1, 1, 1, 0 }; const int dy[8] = { -1, 0, 1, 1, 1, 0, -1, -1 }; int m, n; int a[N][N]...
C++
3e08a9ef172ece7839728439d5b608a8
b55084e7d271bb68094c4fe3ddb8c1a3
2,000
PASSED
#include <iostream> #include <stack> #include <cstdio> using namespace std; const int WILDCOLOUR = 1e9; struct paint { int x, y, c; }; int n, m, cnt = 0; int colour[1010][1010]; bool visited[1010][1010]; int directs[][2] = {{1, 0}, {-1, 0}, {0, 1}, ...
C++
3e08a9ef172ece7839728439d5b608a8
27a556a9f1bf278f39a37216b5bd33d0
2,000
PASSED
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstdio> #include <tuple> using namespace std; const int WILDCOLOUR = 1e8 + 19260817; int n, m, cnt = 0; int colour[1010][1010]; bool visited[1010][1010]; queue<pair<int, int> > bfs; vector<tuple<int, int, int> > opts...
C++
3e08a9ef172ece7839728439d5b608a8
ea483124ad2c22a312704fce296cf4d3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define For(i,n) for (int i=1;i<=(int)(n);i++) #define rep(i,n) for (int i=0;i<(int)(n);i++) #define set0(i) memset(i,0,sizeof(i)) #define all(x) (x).begin(),(x).end() #define Max(a,b,c) max(a,max(b,c)) #d...
C++
3e08a9ef172ece7839728439d5b608a8
3e497f4d51d6f8e585e5812c69c66cd3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; bool print = false; void propagate(vector<long long> &values, vector<long long> &lazy, long long index) { if (lazy[index]) { long long left = index << 1, right = left | 1; values[left] += lazy[index]; values[right] += lazy[index]; lazy[left] ...
C++
1947e642d8aa0e669e65c22b3261c930
a2e171d9e7a9ef2f372126d48b77c849
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const int N=1e6+5; ll s[N*4],f[N*4]; void push_down(int root){ if(!f[root])return ; s[root<<1]+=f[root]; s[root<<1|1]+=f[root]; f[root<<1]+=f[root]; f[root<<1|1]+=f[root]; f[root]=0; } void update(int l,int r,int root...
C++
1947e642d8aa0e669e65c22b3261c930
d424ea3c9004093d085314299e69f374
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const int N=1e6+5; ll s[N*4],f[N*4]; void push_down(int root){ if(!f[root])return ; s[root<<1]+=f[root]; s[root<<1|1]+=f[root]; f[root<<1]+=f[root]; f[root<<1|1]+=f[root]; f[root]=0; } void update(int l,int r,int root...
C++
1947e642d8aa0e669e65c22b3261c930
72647157cd2cfa57dd8020227d6f0897
2,400
PASSED
#include<bits/stdc++.h> #define int long long #define N 2000005 #define lowbit(k) k&(-k) #define IT set<node>::iterator using namespace std; int n,m,x,y,z,t[N],tag[N]; char opt[N]; struct node { int l,r; mutable int val; node(int L, int R=-1, int Val=0):l(L), r(R), val(Val) {} bool operator<...
C++
1947e642d8aa0e669e65c22b3261c930
5c1c02991422712aa6223c74cc68ad55
2,400
PASSED
// LUOGU_RID: 94139483 #include<cstdio> #include<algorithm> #include<set> #define lc p<<1 #define rc p<<1|1 #define ct Chtholly_tree #define Chtholly set<ct>::iterator #define ll long long #define int long long #define N 1019810 using namespace std; int n,q; ll col[N]; struct bit2{ ll c[N]; int l...
C++
1947e642d8aa0e669e65c22b3261c930
7de281ed31ccf8f4b01a7ee4dfb2ed50
2,400
PASSED
#include<cstdio> #include<algorithm> #include<set> #define lc p<<1 #define rc p<<1|1 #define ct Chtholly_tree #define Chtholly set<ct>::iterator #define ll long long #define int long long #define N 1019810 using namespace std; int n,q; ll col[N]; struct bit2{ ll c[N]; int lowbit(int x){return x&-...
C++
1947e642d8aa0e669e65c22b3261c930
6a07c08c11b9a586ea237ad19ac320d1
2,400
PASSED
#include <algorithm> #include <iostream> #include <set> #include <vector> #define Chtholly set<node>::iterator using namespace std; struct node { int l, r; mutable int c; node(int l, int r = -1, int c = 0) { this->l = l; this->r = r; this->c = c; } bool operator<(const node& a) const...
C++
1947e642d8aa0e669e65c22b3261c930
c97ad12764117ddbb0087beac087e04c
2,400
PASSED
#pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #include<bits/stdc++.h> #define inf 20060327 #define fastIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; typedef pair<int,int> pii; typedef long long ll; const int N=1e6+10; struct ...
C++
1947e642d8aa0e669e65c22b3261c930
aeaedc2b81e12435f462936cc1c11169
2,400
PASSED
#pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #include<bits/stdc++.h> #define inf 20060327 #define fastIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; typedef pair<int,int> pii; typedef long long ll; const int N=1e6+10; struct ...
C++
1947e642d8aa0e669e65c22b3261c930
9329e618f334ce79dd10bbe4405a550f
2,400
PASSED
#pragma optimize GCC("Ofast") #include<bits/stdc++.h> #define inl inline #define Rep for #define re(i,x,y,z) for(int i=(x);i!=(y);i=(z)) #define ree(i,x,y,z) for(int i=(x);i<=(y);i=(z)) #define rre(i,x,y,z) for(int i=(x);i>=(y);i=(z)) #define rep(i,x,y) for(int i=(x);i<=(y);++i) #define repp(i,x,y,d) for(int i...
C++
1947e642d8aa0e669e65c22b3261c930
117528d2ad6919cedb1997eab6b46027
2,400
PASSED
const long long MOD = 1e9 + 7; const long long INF = 1e9; const long long INFLL = 1e18; #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef com...
C++
3a3977962de377beb94988d517d09f9c
55be572ff315d3bc270f0c1f462454fb
3,200
PASSED