Skip to content

Commit 2867907

Browse files
committed
January circuits
1 parent e116429 commit 2867907

11 files changed

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

0 commit comments

Comments
 (0)