QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#257415 | #7750. Revenge on My Boss | ucup-team484# | WA | 18ms | 6188kb | C++17 | 1.1kb | 2023-11-19 03:59:18 | 2023-11-19 03:59:19 |
Judging History
answer
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
void solve() {
int n; cin >> n;
vector<ll> a(n), b(n), c(n);
ll sm = 0;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i] >> c[i];
sm += min(a[i], b[i]);
}
ll tot = 0;
for (int i = 0; i < n; i++)
tot = max(tot, (sm + max(a[i], b[i])) * c[i]);
vector<int> lh, rh;
for (int i = 0; i < n; i++) {
if (tot != (sm + max(a[i], b[i])) * c[i])
continue;
for (int j = 0; j < n; j++) {
if (j == i) continue;
if (a[j] <= b[j])
lh.push_back(j);
else
rh.push_back(j);
}
sort(all(lh), [&](int x, int y) {
return b[x] > b[y];
});
sort(all(rh), [&](int x, int y) {
return b[x] < b[y];
});
lh.push_back(i);
for (int j: rh)
lh.push_back(j);
for (int j = 0; j < n; j++)
cout << lh[j] + 1 << " \n"[j + 1 == n];
break;
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int t; cin >> t; while (t--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3816kb
input:
2 4 1 1 4 5 1 5 1 9 1 9 8 1 9 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 8 3 2 7
output:
3 1 2 4 3 8 2 4 5 1 6 9 7
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 18ms
memory: 6188kb
input:
1 100000 581297 102863 1 742857 42686 1 676710 233271 1 443055 491162 1 442056 28240 1 769277 331752 1 8608 369730 1 495112 525554 1 787449 938154 1 441186 850694 1 84267 925450 1 740811 32385 1 834021 37680 1 257878 564126 1 90618 914340 1 239641 463103 1 40687 343062 1 587737 458554 1 103684 48666...
output:
34165 58976 76404 97462 81944 63569 22053 24693 82043 7559 68501 35301 39883 11448 91985 42218 73062 38913 60104 61747 17135 39691 48773 76455 53224 928 82878 21243 40729 98834 2119 26666 44145 1844 67247 94650 78710 92428 758 81020 70922 1714 62638 25132 88997 54154 80672 33568 69608 44151 77582 44...
result:
wrong answer Wrong Answer on Case#1