Skip to content

Commit b48921c

Browse files
committed
codechef starter 3
1 parent 1370ced commit b48921c

File tree

4 files changed

+579
-0
lines changed

4 files changed

+579
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
Institute: National Institute of Technology, Uttarakhand
5+
*/
6+
#include <bits/stdc++.h>
7+
#include <ext/pb_ds/assoc_container.hpp>
8+
#include <ext/pb_ds/tree_policy.hpp>
9+
using namespace std;
10+
using namespace __gnu_pbds;
11+
typedef long long ll ;
12+
typedef unsigned long long ull;
13+
typedef vector<ll> vl;
14+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
15+
/* Abbrevations */
16+
#define ff first
17+
#define ss second
18+
#define mp make_pair
19+
#define line cout<<endl;
20+
#define pb push_back
21+
#define Endl "\n"
22+
// loops
23+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
24+
// Some print
25+
#define no cout<<"NO"<<endl;
26+
#define yes cout<<"YES"<<endl;
27+
// sort
28+
#define all(V) (V).begin(),(V).end()
29+
#define srt(V) sort(all(V))
30+
#define srtGreat(V) sort(all(V),greater<ll>())
31+
// some extra
32+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
33+
#define precision(x) cout<<fixed<<setprecision(x);
34+
#define sz(V) ll(V.size())
35+
// template
36+
template <typename T>
37+
T mymax(T x,T y)
38+
{
39+
return (x>y)?x:y;
40+
}
41+
// function
42+
ll power(ll x,ll y,ll mod)
43+
{
44+
ll res=1;
45+
// x=x%mod;
46+
while(y>0)
47+
{
48+
if(y%2==1)
49+
{
50+
res*=x;
51+
// res=res%mod;
52+
}
53+
y/=2; x*=x; // x=x%mod;
54+
}
55+
return res;
56+
}
57+
ll str_to_num(string s)
58+
{
59+
stringstream pk(s);
60+
ll num;
61+
pk>>num;
62+
return num;
63+
}
64+
65+
string num_to_str(ll num)
66+
{
67+
return to_string(num);
68+
}
69+
// datatype definination
70+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
71+
class Point
72+
{
73+
public:
74+
ll x;
75+
ll y;
76+
ll z;
77+
ll getsum()
78+
{
79+
return x+y+z;
80+
}
81+
};
82+
/* ascii value
83+
A=65,Z=90,a=97,z=122
84+
*/
85+
/* --------------------MAIN PROGRAM----------------------------*/
86+
// to run ctrl+b
87+
const ll INF=LONG_MAX;
88+
const ll mod1=1e9+7;
89+
const ll mod2=998244353;
90+
91+
92+
// Techniques
93+
// divide into cases, brute force, pattern finding
94+
// sort, greedy, binary search, two pointer
95+
// transform into graph
96+
97+
ll solve()
98+
{
99+
ll x,y,xi,yi,d;
100+
cin>>x>>y>>xi>>yi>>d;
101+
ll ans1=x/xi;
102+
ll ans2=y/yi;
103+
ll ans=min(ans1,ans2);
104+
if(d<=ans)
105+
yes
106+
else
107+
no
108+
return 0;
109+
}
110+
111+
int main()
112+
{
113+
speed;
114+
/* #ifndef ONLINE_JUDGE
115+
freopen("input.txt","r",stdin);
116+
freopen("output.txt","w",stdout);
117+
#endif */
118+
ll TestCase=1;
119+
cin>>TestCase;
120+
while(TestCase--)
121+
{
122+
solve();
123+
}
124+
}
125+
/* -----------------END OF PROGRAM --------------------*/
126+
/*
127+
* stuff you should look before submission
128+
* constraint and time limit
129+
* int overflow
130+
* special test case (n=0||n=1||n=2)
131+
* don't get stuck on one approach if you get wrong answer
132+
*/
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
Institute: National Institute of Technology, Uttarakhand
5+
*/
6+
#include <bits/stdc++.h>
7+
#include <ext/pb_ds/assoc_container.hpp>
8+
#include <ext/pb_ds/tree_policy.hpp>
9+
using namespace std;
10+
using namespace __gnu_pbds;
11+
typedef long long ll ;
12+
typedef unsigned long long ull;
13+
typedef vector<ll> vl;
14+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
15+
/* Abbrevations */
16+
#define ff first
17+
#define ss second
18+
#define mp make_pair
19+
#define line cout<<endl;
20+
#define pb push_back
21+
#define Endl "\n"
22+
// loops
23+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
24+
// Some print
25+
#define no cout<<"NO"<<endl;
26+
#define yes cout<<"YES"<<endl;
27+
// sort
28+
#define all(V) (V).begin(),(V).end()
29+
#define srt(V) sort(all(V))
30+
#define srtGreat(V) sort(all(V),greater<ll>())
31+
// some extra
32+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
33+
#define precision(x) cout<<fixed<<setprecision(x);
34+
#define sz(V) ll(V.size())
35+
// template
36+
template <typename T>
37+
T mymax(T x,T y)
38+
{
39+
return (x>y)?x:y;
40+
}
41+
// function
42+
ll power(ll x,ll y,ll mod)
43+
{
44+
ll res=1;
45+
// x=x%mod;
46+
while(y>0)
47+
{
48+
if(y%2==1)
49+
{
50+
res*=x;
51+
// res=res%mod;
52+
}
53+
y/=2; x*=x; // x=x%mod;
54+
}
55+
return res;
56+
}
57+
ll str_to_num(string s)
58+
{
59+
stringstream pk(s);
60+
ll num;
61+
pk>>num;
62+
return num;
63+
}
64+
65+
string num_to_str(ll num)
66+
{
67+
return to_string(num);
68+
}
69+
// datatype definination
70+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
71+
class Point
72+
{
73+
public:
74+
ll x;
75+
ll y;
76+
ll z;
77+
ll getsum()
78+
{
79+
return x+y+z;
80+
}
81+
};
82+
/* ascii value
83+
A=65,Z=90,a=97,z=122
84+
*/
85+
/* --------------------MAIN PROGRAM----------------------------*/
86+
// to run ctrl+b
87+
const ll INF=LONG_MAX;
88+
const ll mod1=1e9+7;
89+
const ll mod2=998244353;
90+
91+
92+
// Techniques
93+
// divide into cases, brute force, pattern finding
94+
// sort, greedy, binary search, two pointer
95+
// transform into graph
96+
97+
ll solve()
98+
{
99+
ll n,m,x,y;
100+
cin>>n>>m>>x>>y;
101+
while(n--){
102+
string s;
103+
cin>>s;
104+
ll full=0,partail=0,wrong=0;
105+
for(auto x:s){
106+
if(x=='F')
107+
full++;
108+
else if(x=='P')
109+
partail++;
110+
else
111+
wrong++;
112+
}
113+
if(full>=x||(full>=(x-1)&&partail>=y))
114+
cout<<1;
115+
else
116+
cout<<0;
117+
}
118+
line;
119+
return 0;
120+
}
121+
122+
int main()
123+
{
124+
speed;
125+
/* #ifndef ONLINE_JUDGE
126+
freopen("input.txt","r",stdin);
127+
freopen("output.txt","w",stdout);
128+
#endif */
129+
ll TestCase=1;
130+
cin>>TestCase;
131+
while(TestCase--)
132+
{
133+
solve();
134+
}
135+
}
136+
/* -----------------END OF PROGRAM --------------------*/
137+
/*
138+
* stuff you should look before submission
139+
* constraint and time limit
140+
* int overflow
141+
* special test case (n=0||n=1||n=2)
142+
* don't get stuck on one approach if you get wrong answer
143+
*/

0 commit comments

Comments
 (0)