QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#726490 | #5674. Sum of Remainders | Nika# | WA | 1ms | 3852kb | C++14 | 849b | 2024-11-09 01:42:36 | 2024-11-09 01:42:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n;
multiset<int> s;
vector<int> a(n+1);
for (int i = 1; i <=n; i++) {
cin >> a[i];
}
//sort(a.begin(), a.end());
int m = a[1];
// cout << "M: " << m << endl;
for (int i = 2; i <= n; i++) {
int ass = a[i-1] + m;
// cout << "SET: ";
// for (int x : s) cout << x << ' ';
// cout << endl;
for (int j = 2; j <= i; j++) {
if (i % j == 0) ass -= s.count(j);
}
// cout << i << ": " << ass << endl;
ass -= a[i];
int cnt = ass / i;
for (int j = 0; j < cnt; j++) {
s.insert(i);
}
}
cout << m << ' ';
for (int x : s) cout << x << ' ';
cout << endl;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t = 1;
//cin >> t;
while(t--){
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3544kb
input:
16 4 6 10 12 6 8 12 14 18 10 3 5 9 11 5 7
output:
4 2 5 5 11
result:
ok single line: '4 2 5 5 11 '
Test #2:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
20 3 6 6 9 12 6 2 5 5 8 11 5 8 4 4 7 10 4 7 10
output:
3 3 6 7
result:
ok single line: '3 3 6 7 '
Test #3:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
40 7 14 21 28 35 42 42 49 56 63 70 65 59 45 37 44 51 58 65 72 72 79 86 57 39 33 40 26 33 25 32 39 46 53 53 48 55 62 56 63
output:
7 7 12 13 14 15 24 25
result:
ok single line: '7 7 12 13 14 15 24 25 '
Test #4:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
60 7 14 21 28 35 42 49 56 63 70 77 72 79 86 93 100 90 97 85 92 99 106 113 108 115 122 102 109 116 123 99 106 113 103 110 105 112 100 107 114 121 86 93 56 63 70 77 72 79 86 76 83 90 70 77 84 72 79 86 81
output:
7 12 17 19 27 31 42 44
result:
ok single line: '7 12 17 19 27 31 42 44 '
Test #5:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
20 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 0 1 2
output:
1 9
result:
ok single line: '1 9 '
Test #6:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
30 2 4 6 8 10 12 14 16 18 20 11 13 2 4 6 8 10 12 14 16 18 9 11 13 15 4 6 8 10 12
output:
2 11 13
result:
ok single line: '2 11 13 '
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3852kb
input:
40 9 18 24 33 42 42 51 60 66 65 74 74 70 79 70 47 56 56 46 45 51 60 69 45 54 50 56 65 74 49 58 35 41 50 59 59 68 58 51 50
output:
9 3 6 10 13 15 16 16 19 24 30
result:
wrong answer 1st lines differ - expected: '9 3 6 10 13 15 16 16 19 24', found: '9 3 6 10 13 15 16 16 19 24 30 '