Skip to content

Commit

Permalink
Upload sort
Browse files Browse the repository at this point in the history
  • Loading branch information
inpyeong committed May 15, 2020
1 parent 01dfbf3 commit ef9ad84
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 0 deletions.
27 changes: 27 additions & 0 deletions solution/Sort/10814.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//#include <algorithm>
//#include <iostream>
//#include <vector>
//#include <string>
//#include <utility>
//using namespace std;
//bool cmp(const pair<int, string>& p1, const pair<int, string>& p2) {
// if (p1.first == p2.first) {
// return false;
// }
// else {
// return p1.first < p2.first;
// }
//}
//int main10814() {
// int n;
// cin >> n;
// vector <pair<int, string>> v(n);
// for (int i = 0; i < n; i++) {
// cin >> v[i].first >> v[i].second;
// }
// stable_sort(v.begin(), v.end(), cmp);
// for (int i = 0; i < n; i++) {
// cout << v[i].first << " " << v[i].second << "\n";
// }
// return 0;
//}
27 changes: 27 additions & 0 deletions solution/Sort/10825.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//#include <iostream>
//#include <algorithm>
//#include <string>
//#include <vector>
//#include <tuple>
//using namespace std;
//struct Score
//{
// string name;
// int k, e, m;
//};
//bool cmp(const Score& s1, const Score& s2) {
// return make_tuple(-s1.k, s1.e, -s1.m, s1.name) < make_tuple(-s2.k, s2.e, -s1.m, s2.name);
//}
//int main10825() {
// int n;
// cin >> n;
// vector <Score> v(n);
// for (int i = 0; i < n; i++) {
// cin >> v[i].name >> v[i].k >> v[i].e >> v[i].m;
// }
// sort(v.begin(), v.end(), cmp);
// for (int i = 0; i < n; i++) {
// cout << v[i].name << "\n";
// }
// return 0;
//}
21 changes: 21 additions & 0 deletions solution/Sort/10989.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//#include <cstdio>
//#include <algorithm>
//#include <utility>
//using namespace std;
//int main10989() {
// int n, temp;
// scanf("%d", &n);
// int cnt[10001] = { 0, };
// while (n--) {
// scanf("%d", &temp);
// cnt[temp]++;
// }
// for (int i = 1; i <= 10000; i++) {
// if (cnt[i] > 0) {
// for (int j = 0; j < cnt[i]; j++) {
// printf("%d\n", i);
// }
// }
// }
// return 0;
//}
13 changes: 13 additions & 0 deletions solution/Sort/11004.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX = 5000000;
long long a[MAX];
int main() {
int n, k;
scanf("%d %d", &n, &k);
for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); }
sort(a, a + n);
printf("%lld", a[k - 1]);
return 0;
}*/
33 changes: 33 additions & 0 deletions solution/Sort/11650.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//#include <iostream>
//#include <algorithm>
//#include <vector>
//#include <utility>
//using namespace std;
//
//bool compare(pair <int, int> p1, pair <int, int> p2) {
// if (p1.first == p2.first) {
// return p1.second < p2.second ;
// }
// else {
// return p1 < p2;
// }
//}
//
//int main11650() {
// int N;
// cin >> N;
// pair <int, int> p;
// vector <pair <int, int>> v;
// int a, b;
// for (int i = 0; i < N; i++) {
// cin >> a >> b;
// p = make_pair(a, b);
// v.push_back(p);
// }
//
// sort(v.begin(), v.end(), compare);
// for (int i = 0; i < N; i++) {
// cout << v[i].first << " " << v[i].second << "\n";
// }
// return 0;
//}
32 changes: 32 additions & 0 deletions solution/Sort/11651.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//#include <iostream>
//#include <algorithm>
//#include <vector>
//using namespace std;
//struct Point
//{
// int x, y;
// bool operator < (const Point& v) const {
// if (y < v.y) {
// return true;
// }
// else if (y == v.y) {
// return x < v.x;
// }
// else {
// return false;
// }
// }
//};
//int main11651() {
// int n;
// cin >> n;
// vector <Point> v(n);
// for (int i = 0; i < n; i++) {
// cin >> v[i].x >> v[i].y;
// }
// sort(v.begin(), v.end());
// for (int i = 0; i < n; i++) {
// cout << v[i].x << " " << v[i].y << "\n";
// }
// return 0;
//}
34 changes: 34 additions & 0 deletions solution/Sort/11652.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
const int MAX = 1000000;
using namespace std;
long long cnt[MAX];
int main11652() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%lld", &cnt[i]);
}
sort(cnt, cnt + n);
for (int i = 0; i < n; i++) {
printf("%d ", cnt[i]);
}
printf("\n");
int ans = 1, maxAns = 1;
long long num = cnt[0];
for (int i = 1; i < n; i++) {
if (cnt[i] == cnt[i - 1]) {
ans++;
if (maxAns < ans) {
maxAns = ans;
num = cnt[i];
}
}
else {
ans = 1;
}
}
printf("%lld", num);
}*/
22 changes: 22 additions & 0 deletions solution/Sort/1377.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//#include <algorithm>
//#include <cstdio>
//#include <vector>
//using namespace std;
//int main1377() {
// int n;
// scanf("%d", &n);
// vector <pair<int, int>> v(n);
// for (int i = 0; i < n; i++) {
// scanf("%d", &v[i].first);
// v[i].second = i;
// }
// sort(v.begin(), v.end());
// int ans = 0;
// for (int i = 0; i < n; i++) {
// if (ans < v[i].second - i) {
// ans = v[i].second - i;
// }
// }
// printf("%d", ans+1);
// return 0;
//}
12 changes: 12 additions & 0 deletions solution/Sort/2751.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//#include <algorithm>
//#include <iostream>
//using namespace std;
//int main2751() {
// int n;
// cin >> n;
// int* num = new int[n];
// for (int i = 0; i < n; i++) { cin >> num[i]; }
// sort(num, num + n);
// for (int i = 0; i < n; i++) { cout << num[i] << "\n"; }
// return 0;
//}

0 comments on commit ef9ad84

Please sign in to comment.