aboutsummaryrefslogtreecommitdiff
path: root/works/life/chuanzhi-cup/contest/3.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-12 15:55:21 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-12 15:55:21 +0800
commit1ecfd0ab7f1f511268fd6404dbc110c3c277b48c (patch)
tree49449a4076ded9bd937a51679318edbe2a532cae /works/life/chuanzhi-cup/contest/3.cpp
parent55d8b025e8d6ea971e8ee5762c892405fedc316b (diff)
parentf8c10dd1fc55e60f35286475356e48c4f642eb63 (diff)
downloadcrupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.tar.gz
crupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.tar.bz2
crupest-1ecfd0ab7f1f511268fd6404dbc110c3c277b48c.zip
import(life): IMPORT crupest/life COMPLETE.
Diffstat (limited to 'works/life/chuanzhi-cup/contest/3.cpp')
-rw-r--r--works/life/chuanzhi-cup/contest/3.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/works/life/chuanzhi-cup/contest/3.cpp b/works/life/chuanzhi-cup/contest/3.cpp
new file mode 100644
index 0000000..8f0769d
--- /dev/null
+++ b/works/life/chuanzhi-cup/contest/3.cpp
@@ -0,0 +1,46 @@
+#include <cstdio>
+#include <set>
+
+struct V {
+ V(int n, int t, int k) : n(n), t(t), k(k), c(t * k) {}
+
+ int n;
+ int t;
+ int k;
+ const int c;
+};
+
+struct C {
+ bool operator()(const V &left, const V &right) const {
+ if (left.c > right.c)
+ return true;
+ else if (left.c < right.c)
+ return false;
+ else if (left.t > right.t)
+ return true;
+ else if (left.t < right.t)
+ return false;
+ else if (left.n < right.n)
+ return true;
+ return false;
+ }
+};
+
+int main() {
+ std::set<V, C> data;
+
+ int n;
+ std::scanf("%d", &n);
+
+ for (int i = 1; i <= n; i++) {
+ int t, k;
+ std::scanf("%d%d", &t, &k);
+ data.insert(V{i, t, k});
+ }
+
+ for (const auto &v : data) {
+ std::printf("%d ", v.n);
+ }
+
+ return 0;
+} \ No newline at end of file