-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92527d4
commit 601e49a
Showing
154 changed files
with
6,504 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
..._Contest/Educational_Round/150_Div_2/q1/.cph/.1.cpp_4cc8020798e185e8872469deee48d6d6.prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"Local: 1","url":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q1\\1.cpp","tests":[{"id":1686580888240,"input":"2\n3\n6","output":"Bob\nAlice"},{"id":1686585353383,"input":"2\n10\n11","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q1\\1.cpp","group":"local","local":true} |
Binary file not shown.
109 changes: 109 additions & 0 deletions
109
CodeForces_Live_Contest/Educational_Round/150_Div_2/q1/1.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
|
||
// Policy based data structures(PBDS) C++ STL | ||
// order_of_key(k): returns count of elements strictly smaller than k | ||
// find_by_order(k): returns the iterator of the k-th element in a set (0-index) | ||
// Time complexity: O(logn) for both | ||
#include <ext/pb_ds/assoc_container.hpp> | ||
#include <ext/pb_ds/tree_policy.hpp> | ||
using namespace __gnu_pbds; | ||
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; | ||
template <class K, class V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>; | ||
|
||
#ifndef ONLINE_JUDGE | ||
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl; | ||
#else | ||
#define debug(x) | ||
#endif | ||
|
||
void _print(long long t) {cerr << t;} | ||
void _print(string t) {cerr << t;} | ||
void _print(char t) {cerr << t;} | ||
void _print(long double t) {cerr << t;} | ||
|
||
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";} | ||
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
|
||
#define ll long long | ||
#define int ll | ||
#define ld long double | ||
#define iv(a , n) vector<int>a(n); for(int i=0;i<n;++i){cin>>a[i];} | ||
#define yes cout << "YES" << endl; | ||
#define no cout << "NO" << endl; | ||
#define all(v) v.begin(),v.end() | ||
#define F first | ||
#define S second | ||
#define check1(v) for(auto &i : v){ cout<<i<<" "; } cout<<endl; | ||
#define check2(v) for(auto &i : v){ cout<<i.F<<" "<<i.S<<endl; } | ||
#define check3(v) for(auto &i : v){ cout<<i.F.F<<" "<<i.F.S<<" "<<i.S<<endl; } | ||
#define check4(v) for(auto &i : v){ cout<<i.F.F<<" "<<i.F.S<<" "<<i.S.F<<" "<<i.S.S<<endl; } | ||
#define pb push_back | ||
#define lb lower_bound | ||
#define ub upper_bound | ||
#define bpp __builtin_popcountll | ||
#define INF 1000000000000000000 | ||
#define Pi 3.1415926535897932384626 | ||
#define EPS 1e-9 | ||
#define nl "\n" | ||
|
||
const int mod97 = 1000000007 ; | ||
const int modg = 998244353 ; | ||
const int N = 2e1 + 10 ; | ||
int SPF[N] ; | ||
vector<bool > isPrime(N , 1) ; | ||
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()) ; // a random number generator (RNG) using the Mersenne Twister algorithm, specifically the mt19937 engine. The purpose of an RNG is to generate a sequence of random numbers. | ||
|
||
int gcd(int a, int b){if(b == 0){return a;} return gcd(b, a % b);} | ||
int lcm(int a, int b){return (a / gcd(a, b) * b) ;} | ||
bool comparatorfunction(pair<int,int> &a, pair<int,int> &b){if(a.S != b.S){return a.S < b.S ;}return a.F > b.F ;} | ||
int power(int x, int y){int res = 1 ; while(y > 0) {if(y & 1) res = (res * x) ; x = (x * x) ; y = y >> 1 ;} return res ;} | ||
int powermod(int x, int y){int res = 1; x = x % mod97; while(y > 0){if(y&1) res = (res * x) % mod97; y = y >> 1; x = (x * x) % mod97 ;}return res ;} | ||
bool isPowerOfTwo(int n){if(n==0) {return false;} return (ceil(log2(n)) == floor(log2(n)));} | ||
void prime(){isPrime[0]=isPrime[1]=false;for(int i = 2; i <= N; ++i){if(isPrime[i] == true){for(int j = 2*i; j <= N; j += i){isPrime[j] = false;}}}} | ||
void spf(){for(int i = 0; i <= N; ++i) SPF[i] = i; for(int i = 2; i <= N; ++i) if(SPF[i] == i) for(int j = i; j <= N; j += i) if(SPF[j] == j) SPF[j] = i;} // SPF is the smallest prime number that divides a given number without leaving a remainder | ||
int isqrt(int n){long long x = sqrtl(n);while (x*x>n){--x;} while((x+1) * (x+1)<=n){++x;}return x;} | ||
int sqrtprecision(int l,int r,int target){while(r-l>EPS){int mid=(l+(r-l)/2);if(mid*mid<target)l=mid;else r=mid;}return l+(r-l)/2;} | ||
int errichtokabinary(int l,int r,vector<int>&a,int target){int ans=-1; while(l <= r){int mid=(l+(r-l)/2); if(a[mid]==target){ans=mid;return ans;}if(a[mid]<target)l=mid+1;else r=mid-1;}return ans;} | ||
void ncrwithoutmod(int n, int r){long long p = 1, k = 1; if (n-r < r) r = n-r; if (r != 0) {while (r) {p *= n; k *= r; long long m = __gcd(p, k);p /= m; k /= m; n--; r--; }} else cout << p << endl; } | ||
int getRandomNumber(int l, int r) {return uniform_int_distribution<int>(l, r)(rng);} | ||
|
||
bool solve(){ | ||
int n ; | ||
cin >> n ; | ||
if(n <= 4) cout << "Bob" << nl ; | ||
else cout << "Alice" << nl ; | ||
return true ; | ||
} | ||
|
||
|
||
int32_t main() | ||
{ | ||
ios_base::sync_with_stdio(false); cin.tie(NULL); | ||
//#ifndef ONLINE_JUDGE | ||
// freopen("input.txt","r",stdin); | ||
// freopen("output.txt","w",stdout); | ||
// freopen("error.txt", "w", stderr); | ||
//#endif | ||
int t; | ||
cin >> t; | ||
//int count = 1; | ||
|
||
while (t--){ | ||
//cout << "Case #" << count << ": "; | ||
if(solve()){ | ||
//count++; | ||
}else{ | ||
// cout << "NO" << endl; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
|
||
|
||
// Think twice, code once. |
1 change: 1 addition & 0 deletions
1
..._Contest/Educational_Round/150_Div_2/q2/.cph/.1.cpp_40eaebb32b2fb283c0bacdf10d46fc0a.prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"Local: 1","url":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q2\\1.cpp","tests":[{"id":1686581132006,"input":"3\n9\n3 7 7 9 2 4 6 3 4\n5\n1 1 1 1 1\n5\n3 2 1 2 3","output":"111110010\n11111\n11011"},{"id":1686590145448,"input":"1\n8\n3 2 3 4 1 3 2 2","output":""},{"id":1686590507470,"input":"1\n19\n0 4 15 18 4 10 12 8 13 8 15 0 14 12 10 12 10 14 13","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q2\\1.cpp","group":"local","local":true} |
Binary file not shown.
129 changes: 129 additions & 0 deletions
129
CodeForces_Live_Contest/Educational_Round/150_Div_2/q2/1.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
|
||
// Policy based data structures(PBDS) C++ STL | ||
// order_of_key(k): returns count of elements strictly smaller than k | ||
// find_by_order(k): returns the iterator of the k-th element in a set (0-index) | ||
// Time complexity: O(logn) for both | ||
#include <ext/pb_ds/assoc_container.hpp> | ||
#include <ext/pb_ds/tree_policy.hpp> | ||
using namespace __gnu_pbds; | ||
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; | ||
template <class K, class V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>; | ||
|
||
#ifndef ONLINE_JUDGE | ||
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl; | ||
#else | ||
#define debug(x) | ||
#endif | ||
|
||
void _print(long long t) {cerr << t;} | ||
void _print(string t) {cerr << t;} | ||
void _print(char t) {cerr << t;} | ||
void _print(long double t) {cerr << t;} | ||
|
||
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";} | ||
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} | ||
|
||
#define ll long long | ||
#define int ll | ||
#define ld long double | ||
#define iv(a , n) vector<int>a(n); for(int i=0;i<n;++i){cin>>a[i];} | ||
#define yes cout << "YES" << endl; | ||
#define no cout << "NO" << endl; | ||
#define all(v) v.begin(),v.end() | ||
#define F first | ||
#define S second | ||
#define check1(v) for(auto &i : v){ cout<<i<<""; } cout<<endl; | ||
#define check2(v) for(auto &i : v){ cout<<i.F<<" "<<i.S<<endl; } | ||
#define check3(v) for(auto &i : v){ cout<<i.F.F<<" "<<i.F.S<<" "<<i.S<<endl; } | ||
#define check4(v) for(auto &i : v){ cout<<i.F.F<<" "<<i.F.S<<" "<<i.S.F<<" "<<i.S.S<<endl; } | ||
#define pb push_back | ||
#define lb lower_bound | ||
#define ub upper_bound | ||
#define bpp __builtin_popcountll | ||
#define INF 1000000000000000000 | ||
#define Pi 3.1415926535897932384626 | ||
#define EPS 1e-9 | ||
#define nl "\n" | ||
|
||
const int mod97 = 1000000007 ; | ||
const int modg = 998244353 ; | ||
const int N = 2e1 + 10 ; | ||
int SPF[N] ; | ||
vector<bool > isPrime(N , 1) ; | ||
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()) ; // a random number generator (RNG) using the Mersenne Twister algorithm, specifically the mt19937 engine. The purpose of an RNG is to generate a sequence of random numbers. | ||
|
||
int gcd(int a, int b){if(b == 0){return a;} return gcd(b, a % b);} | ||
int lcm(int a, int b){return (a / gcd(a, b) * b) ;} | ||
bool comparatorfunction(pair<int,int> &a, pair<int,int> &b){if(a.S != b.S){return a.S < b.S ;}return a.F > b.F ;} | ||
int power(int x, int y){int res = 1 ; while(y > 0) {if(y & 1) res = (res * x) ; x = (x * x) ; y = y >> 1 ;} return res ;} | ||
int powermod(int x, int y){int res = 1; x = x % mod97; while(y > 0){if(y&1) res = (res * x) % mod97; y = y >> 1; x = (x * x) % mod97 ;}return res ;} | ||
bool isPowerOfTwo(int n){if(n==0) {return false;} return (ceil(log2(n)) == floor(log2(n)));} | ||
void prime(){isPrime[0]=isPrime[1]=false;for(int i = 2; i <= N; ++i){if(isPrime[i] == true){for(int j = 2*i; j <= N; j += i){isPrime[j] = false;}}}} | ||
void spf(){for(int i = 0; i <= N; ++i) SPF[i] = i; for(int i = 2; i <= N; ++i) if(SPF[i] == i) for(int j = i; j <= N; j += i) if(SPF[j] == j) SPF[j] = i;} // SPF is the smallest prime number that divides a given number without leaving a remainder | ||
int isqrt(int n){long long x = sqrtl(n);while (x*x>n){--x;} while((x+1) * (x+1)<=n){++x;}return x;} | ||
int sqrtprecision(int l,int r,int target){while(r-l>EPS){int mid=(l+(r-l)/2);if(mid*mid<target)l=mid;else r=mid;}return l+(r-l)/2;} | ||
int errichtokabinary(int l,int r,vector<int>&a,int target){int ans=-1; while(l <= r){int mid=(l+(r-l)/2); if(a[mid]==target){ans=mid;return ans;}if(a[mid]<target)l=mid+1;else r=mid-1;}return ans;} | ||
void ncrwithoutmod(int n, int r){long long p = 1, k = 1; if (n-r < r) r = n-r; if (r != 0) {while (r) {p *= n; k *= r; long long m = __gcd(p, k);p /= m; k /= m; n--; r--; }} else cout << p << endl; } | ||
int getRandomNumber(int l, int r) {return uniform_int_distribution<int>(l, r)(rng);} | ||
|
||
bool solve(){ | ||
int n ; | ||
cin >> n ; | ||
iv(v , n) | ||
int up = 1 ; | ||
int down = 1 ; | ||
vector<int > vis(n , 0) ; | ||
int tt = 1e15 ; | ||
int com = 0 ; | ||
for(int i = 0 ; i < n ; ++i){ | ||
if(com <= v[i] && up && down){ | ||
vis[i] = 1 ; | ||
com = v[i] ; | ||
} | ||
else if(v[i] < com && v[0] >= v[i] && up){ | ||
up = 0 ; | ||
down = 0 ; | ||
vis[i] = 1 ; | ||
com = v[i] ; | ||
}else if(up == 0 && v[i] >= com && v[0] >= v[i]){ | ||
com = v[i] ; | ||
vis[i] = 1 ; | ||
} | ||
} | ||
check1(vis) | ||
return true; | ||
} | ||
|
||
|
||
int32_t main() | ||
{ | ||
ios_base::sync_with_stdio(false); cin.tie(NULL); | ||
//#ifndef ONLINE_JUDGE | ||
// freopen("input.txt","r",stdin); | ||
// freopen("output.txt","w",stdout); | ||
// freopen("error.txt", "w", stderr); | ||
//#endif | ||
int t; | ||
cin >> t; | ||
//int count = 1; | ||
|
||
while (t--){ | ||
//cout << "Case #" << count << ": "; | ||
if(solve()){ | ||
//count++; | ||
}else{ | ||
// cout << "NO" << endl; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
|
||
|
||
// Think twice, code once. // kismat ka khel sara |
1 change: 1 addition & 0 deletions
1
..._Contest/Educational_Round/150_Div_2/q3/.cph/.1.cpp_bfca928856a5958c6687539859257b3d.prob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"Local: 1","url":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q3\\1.cpp","tests":[{"id":1686581836044,"input":"4\nDAAABDCA\nAB\nABCDEEDCBA\nDDDDAAADDABECD\n","output":"11088\n10010\n31000\n15886\n"},{"id":1686583083380,"input":"1\nAAAAEEBBCD","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\varsh\\.vscode\\nayan work c c++\\CodeForces_Live_Contest\\Educational_Round\\150_Div_2\\q3\\1.cpp","group":"local","local":true} |
Binary file not shown.
Oops, something went wrong.