QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#542759#8936. Team Arrangementucup-team1766#WA 0ms3828kbC++23939b2024-09-01 05:13:072024-09-01 05:13:07

Judging History

This is the latest submission verdict.

  • [2024-09-01 05:13:07]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3828kb
  • [2024-09-01 05:13:07]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
	cin.tie(0)->sync_with_stdio(0);

	int n; cin >> n;
	vector<pair<int,int>> students(n); for (auto &[l, r] : students) cin >> l >> r, l--, r--; ranges::sort(students);
	vector<int> w(n); for (auto &x : w) cin >> x;
	
	set<vector<int>> s {vector<int>(n)};
	for (auto [l, r] : students) {
		set<vector<int>> t;
		
		for (auto x : s) {
			int last = n-1;
			while (last and not x[last]) last--;

			if (x[last] % (last+1)) {
				x[last]++;
				t.emplace(x);
			} else {
				l = max(l, last);
				while (l <= r) {
					x[l]++;
					t.emplace(x);
					x[l]--;
					l++;
				}
			}
		}
		s = std::move(t);
	}

	long long mx = LLONG_MIN;
	for (auto x : s) {
		long long sum = 0;
		bool ok = 1;
		for (int i = 0; i < n; i++) sum += 1LL * x[i]/(i+1) * w[i], ok &= x[i] % (i+1) == 0;
		if (ok) mx = max(mx, sum);
	}
	if (mx == LLONG_MIN) cout << "impossible\n";
	else cout << mx << '\n';
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3564kb

input:

3
2 3
1 2
2 2
4 5 100

output:

9

result:

ok single line: '9'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

3
1 3
3 3
2 3
1 1 100

output:

100

result:

ok single line: '100'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

2
1 1
2 2
1 1

output:

impossible

result:

ok single line: 'impossible'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

3
2 3
1 2
2 2
-100 -200 100000

output:

-300

result:

ok single line: '-300'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3560kb

input:

9
1 4
2 5
3 4
1 5
1 1
2 5
3 5
1 3
1 1
1 1 1 1 1 1 1 1 1

output:

5

result:

wrong answer 1st lines differ - expected: '6', found: '5'