Skip to content

Commit

Permalink
abc352 problemset
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanashii76 authored May 4, 2024
1 parent e0455fc commit 9e94864
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Atcoder/abc352/A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <bits/stdc++.h>
using namespace std;


int main() {

int n, x, y, z; cin >> n >> x >> y >> z;
vector<int> values(n,0);
while(x != y) {
if(x <= y) {
values[x] = 1;
x++;

}
else {
values[x] = 1;
x--;
}
}

cout << (values[z] ? "Yes" : "No") << endl;

return 0;
}
18 changes: 18 additions & 0 deletions Atcoder/abc352/B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <bits/stdc++.h>
using namespace std;


int main(){

string s, t; cin >> s >> t;
for(int i = 0, j = 0; s[i] != '\0';++j) {
if(s[i] == t[j]) {
cout << j+1 << " ";
i++;
}
}

cout << endl;
return 0;

}
34 changes: 34 additions & 0 deletions Atcoder/abc352/C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

bool templateSort(pair<ll,ll> a, pair<ll,ll> b) {
return a.first > b.first;
}

int main(){

int n; cin >> n;
vector<pair<ll,ll>> heights(n+1);
while(n--) {
ll a, b; cin >> a >> b;
heights.emplace_back(make_pair(a,b));
}

sort(heights.begin(),heights.end(),templateSort);
int count = heights[0].second;

for(int i = 1; i < (int)heights.size(); ++i) {
heights[i].first += heights[i-1].first;
heights[i].second += heights[i-1].first;

if(heights[i].second >= count)
count = heights[i].second;

}

cout << count << endl;
return 0;

}

0 comments on commit 9e94864

Please sign in to comment.