QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#309629#7750. Revenge on My Bosskaruna#WA 23ms6548kbC++201.2kb2024-01-20 19:21:362024-01-20 19:21:36

Judging History

你现在查看的是最新测评结果

  • [2024-01-20 19:21:36]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:6548kb
  • [2024-01-20 19:21:36]
  • 提交

answer

#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 101010;

int n, t[MAXN];
ll a[MAXN], b[MAXN], c[MAXN];


int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);
	int T;
	cin >> T;
	while (T--) {
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> a[i] >> b[i] >> c[i];
			t[i] = a[i] > b[i];
		}

		vector<int> w(n);
		iota(w.begin(), w.end(), 1);

		sort(w.begin(), w.end(), [&](auto i, auto j) {
			if (t[i] != t[j])
				return t[i] < t[j];
			else {
				if (!t[i])
					return c[i] < c[j];
				else
					return c[i] > c[j];
			}
		});

		for (int i = 0; i < n; i++) {
			cout << w[i] << ' ';
		}
		cout << '\n';

		// w = vector<int> {3, 8, 4, 2, 5, 9, 7, 1, 6};
		// w = vector<int> {3, 8, 4, 2, 9, 5, 1, 6, 7};

		// ll ans = 0;
		// for (int i = 0; i < n; i++) {
		// 	ll sum = 0;
		// 	for (int j = 0; j <= i; j++) sum += a[w[j]];
		// 	for (int j = i; j < n; j++) sum += b[w[j]];
		// 	sum *= c[w[i]];

		// 	ans = max(ans, sum);
		// 	cout << sum << ' ';
		// }
		// cout << ans << "?\n";
	}
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

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 4 8 2 5 9 7 1 6 

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 23ms
memory: 6548kb

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:

35058 82422 57821 35047 35048 82420 35050 35051 82419 35053 57820 35055 82417 82423 57818 35060 35061 35062 82414 35064 71065 82412 35067 82411 57816 82409 35029 35016 82437 35018 35019 57827 35021 35022 57826 35024 82434 35026 35027 82408 82431 82430 82429 82428 82427 35038 35039 82424 35041 35042 ...

result:

wrong answer Wrong Answer on Case#1