Skip to content

Commit 268e0f6

Browse files
committed
Updated after so long
1 parent da94daf commit 268e0f6

File tree

1,409 files changed

+1108135
-808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,409 files changed

+1108135
-808
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
string s;
18+
cin>>s;
19+
bool bad=false;
20+
for(int i=0;i<3;i++){
21+
if(s[i]==s[i+1]){
22+
bad=true;
23+
break;
24+
}
25+
}
26+
if(bad){
27+
cout<<"Bad"<<endl;
28+
}
29+
else{
30+
cout<<"Good"<<endl;
31+
}
32+
33+
return 0;
34+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
string s;
18+
cin>>s;
19+
20+
21+
return 0;
22+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
bool comp(int a, int b){
7+
return abs(a) < abs(b);
8+
}
9+
10+
int main(){
11+
12+
//fastio
13+
ios_base::sync_with_stdio(false);
14+
cin.tie(NULL);
15+
16+
#ifndef ONLINE_JUDGE
17+
freopen("input.txt", "r", stdin);
18+
freopen("output.txt", "w", stdout);
19+
#endif
20+
21+
int n,l,ans=0;
22+
cin>>n>>l;
23+
int arr[n];
24+
for(int i=0;i<n;i++){
25+
arr[i] = l+i;
26+
ans = ans + arr[i];
27+
}
28+
sort(arr,arr+n,comp);
29+
ans = ans - arr[0];
30+
cout<<ans<<endl;
31+
32+
return 0;
33+
}
65.2 KB
Binary file not shown.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
ll gcd(ll a, ll b){
7+
if (a == 0)
8+
return b;
9+
return gcd(b % a, a);
10+
}
11+
12+
ll lcm(ll a, ll b)
13+
{
14+
return (a*b)/gcd(a, b);
15+
}
16+
17+
int main(){
18+
19+
//fastio
20+
ios_base::sync_with_stdio(false);
21+
cin.tie(NULL);
22+
23+
#ifndef ONLINE_JUDGE
24+
freopen("input.txt", "r", stdin);
25+
freopen("output.txt", "w", stdout);
26+
#endif
27+
28+
ll a,b,c,d;
29+
cin>>a>>b>>c>>d;
30+
ll ans = (b/c) + (b/d) - (b/lcm(c,d)) - ( ((a-1)/c) + ((a-1)/d) - ((a-1)/(lcm(c,d))) );
31+
cout<<(b+1-a-ans)<<endl;
32+
33+
return 0;
34+
}
49.5 KB
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
bool comp(pair<int,int> a, pair<int,int> b){
7+
return a.second<b.second;
8+
}
9+
10+
int main(){
11+
12+
//fastio
13+
ios_base::sync_with_stdio(false);
14+
cin.tie(NULL);
15+
16+
#ifndef ONLINE_JUDGE
17+
freopen("input.txt", "r", stdin);
18+
freopen("output.txt", "w", stdout);
19+
#endif
20+
21+
int n;
22+
cin>>n;
23+
pair<int,int> arr[n];
24+
for(int i=0;i<n;i++){
25+
cin>>arr[i].first;
26+
cin>>arr[i].second;
27+
}
28+
sort(arr,arr+n,comp);
29+
int time=0;
30+
for(int i=0;i<n;i++){
31+
time += arr[i].first;
32+
if(time > arr[i].second){
33+
cout<<"No"<<endl;
34+
return 0;
35+
}
36+
}
37+
cout<<"Yes"<<endl;
38+
return 0;
39+
}
68.6 KB
Binary file not shown.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
int n,k;
18+
cin>>n>>k;
19+
if(n==2){
20+
if(k==0){
21+
cout<<1<<endl;
22+
cout<<"1 2"<<endl;
23+
}
24+
else{
25+
cout<<-1<<endl;
26+
}
27+
return 0;
28+
}
29+
if(k>(((n-1)*(n-2)) / 2)){
30+
cout<<-1<<endl;
31+
return 0;
32+
}
33+
vector<pair<int,int>> ans;
34+
ans.push_back({1,2});
35+
//ans.push_back({2,3});
36+
int curr=0,done = 2;
37+
int at2 = 1;
38+
int left = k;
39+
int leftnums = (n-2);
40+
for(int i=3;i<=n;i++){
41+
curr = at2;
42+
at2++;
43+
leftnums--;
44+
ans.push_back({2,i});
45+
int j=1;
46+
while(curr>(left-leftnums) && j<i){
47+
if(j==2){
48+
j++;
49+
continue;
50+
}
51+
ans.push_back({j,i});
52+
curr--;
53+
j++;
54+
}
55+
left = left - curr;
56+
//cout<<curr<<" "<<left<<endl;
57+
}
58+
cout<<ans.size()<<endl;
59+
for(int i=0;i<ans.size();i++){
60+
cout<<ans[i].first<<" "<<ans[i].second<<endl;
61+
}
62+
return 0;
63+
}
73.9 KB
Binary file not shown.
73.8 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5 8
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-1
2+
4
3+
1 2
4+
2 3
5+
2 4
6+
2 5
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
string a,b;
18+
cin>>a>>b;
19+
int ans=0;
20+
for(int i=0;i<3;i++){
21+
if(a[i]==b[i]) ans++;
22+
}
23+
cout<<ans<<endl;
24+
25+
return 0;
26+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
int a,b;
18+
cin>>a>>b;
19+
int curr=1,ans=0;
20+
while(curr<b){
21+
curr--;
22+
curr += (a);
23+
ans++;
24+
}
25+
cout<<ans<<endl;
26+
27+
return 0;
28+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
int n;
18+
cin>>n;
19+
int curr=0,prev,a,maxx=0;
20+
cin>>prev;
21+
for(int i=1;i<n;i++){
22+
cin>>a;
23+
if(a<=prev){
24+
curr++;
25+
}
26+
else {
27+
curr=0;
28+
}
29+
prev=a;
30+
maxx = max(curr, maxx);
31+
}
32+
cout<<maxx<<endl;
33+
return 0;
34+
}
48.4 KB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define MOD 1000000007
4+
using namespace std;
5+
6+
int main(){
7+
8+
//fastio
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
12+
#ifndef ONLINE_JUDGE
13+
freopen("input.txt", "r", stdin);
14+
freopen("output.txt", "w", stdout);
15+
#endif
16+
17+
ll n;
18+
cin>>n;
19+
cout<<((n*(n-1))/2)<<endl;
20+
21+
return 0;
22+
}
48.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)