QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#597646 | #6339. Cookies | Dimash# | 0 | 4ms | 7540kb | C++17 | 1.4kb | 2024-09-28 18:18:29 | 2024-09-28 18:18:32 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 12, MOD = (int)1e9 + 7;
int n, m, b[N];
vector<pair<int,int>> a;
vector<vector<int>> cur;
void go(vector<pair<int, int>> x) {
sort(x.begin(), x.end());
reverse(x.begin(), x.end());
while(!x.empty() && x.back().first == 0) {
x.pop_back();
}
if(x.empty()) {
cout << (int)cur.size() << '\n';
for(auto i:cur) {
cout << (int)i.size() << ' ';
for(int j:i) {
cout << j << ' ';
}
cout << '\n';
}
exit(0);
}
reverse(x.begin(), x.end());
for(int i = m; i >= 1; i--) {
if(x.size() < b[i]) continue;
vector<int> t;
for(int j = 0; j < b[i]; j++) {
t.push_back(x[j].second);
x[j].first--;
}
cur.push_back(t);
go(x);
cur.pop_back();
for(int j = 0; j < b[i]; j++) {
x[j].first++;
}
}
}
void test() {
cin >> n;
for(int i = 1; i <= n; i++) {
int x;
cin >> x;
a.push_back({x, i});
}
cin >> m;
for(int i = 1;i <= m; i++) {
cin >> b[i];
}
go(a);
cout << -1 << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t = 1;
// cin >> t;
while(t--)
test();
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 6
Accepted
time: 1ms
memory: 3508kb
input:
1 1 1 1
output:
1 1 1
result:
ok good!
Test #2:
score: 6
Accepted
time: 0ms
memory: 3516kb
input:
2 1 1 1 1
output:
2 1 1 1 2
result:
ok good!
Test #3:
score: 6
Accepted
time: 0ms
memory: 3544kb
input:
2 1 1 1 2
output:
1 2 1 2
result:
ok good!
Test #4:
score: 6
Accepted
time: 0ms
memory: 3512kb
input:
2 1 1 2 1 2
output:
1 2 1 2
result:
ok good!
Test #5:
score: 6
Accepted
time: 0ms
memory: 3576kb
input:
4 1 1 1 1 2 2 3
output:
2 2 1 2 2 3 4
result:
ok good!
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3568kb
input:
8 1 1 1 1 1 1 1 1 3 1 4 5
output:
4 5 1 2 3 4 5 1 6 1 7 1 8
result:
wrong answer you used more buckets than jury
Subtask #2:
score: 0
Wrong Answer
Test #28:
score: 7
Accepted
time: 0ms
memory: 3576kb
input:
1 15 1 1
output:
15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok good!
Test #29:
score: 7
Accepted
time: 1ms
memory: 3660kb
input:
1 500 1 1
output:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
result:
ok good!
Test #30:
score: 7
Accepted
time: 1ms
memory: 4444kb
input:
1 3000 1 1
output:
3000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok good!
Test #31:
score: 7
Accepted
time: 4ms
memory: 7540kb
input:
1 15000 1 1
output:
15000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok good!
Test #32:
score: 7
Accepted
time: 0ms
memory: 3608kb
input:
2 2 1 1 1
output:
3 1 2 1 1 1 1
result:
ok good!
Test #33:
score: 7
Accepted
time: 0ms
memory: 3504kb
input:
2 1 2 1 2
output:
-1
result:
ok no solution
Test #34:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
3 1 2 3 1 2
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #3:
score: 0
Wrong Answer
Test #45:
score: 12
Accepted
time: 0ms
memory: 3548kb
input:
2 7 8 2 1 2
output:
8 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 1 2
result:
ok good!
Test #46:
score: 0
Wrong Answer
time: 0ms
memory: 3804kb
input:
3 5 4 6 2 2 3
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%