QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#765108 | #8268. Tycho | _8_8_# | 0 | 1ms | 5704kb | C++20 | 729b | 2024-11-20 12:13:46 | 2024-11-20 12:13:47 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = (int)1e6 + 12;
const ll inf = (ll)1e18;
ll b, p, d, n, a[N], dp[N], t[N];
ll get(ll l, ll r) {
return r / p - max(0ll, (l - 1)) / p;
}
ll col[N];
void test() {
cin >> b >> p >> d >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
col[a[i] % p]++;
}
ll all = get(0, b) * d, res = all + b;
for(int i = 1; i <= p; i++) {
res = min(res, (get(0, b) - col[p - i]) * d + i + b);
}
cout << res << '\n';
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin >> t;
while(t--)
test();
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
input:
1000000000000 1 1000000 0
output:
1000001000000000000
result:
wrong answer 1st lines differ - expected: '1000000999999000000', found: '1000001000000000000'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 5
Accepted
time: 1ms
memory: 5704kb
input:
108 100 10000 5 10 20 30 40 98
output:
110
result:
ok single line: '110'
Test #12:
score: 5
Accepted
time: 1ms
memory: 5664kb
input:
118 100 10000 5 10 20 30 98 108
output:
120
result:
ok single line: '120'
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 5696kb
input:
206 100 10000 5 10 20 30 98 196
output:
10208
result:
wrong answer 1st lines differ - expected: '210', found: '10208'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #109:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
1000000000000 1 1000000 0
output:
1000001000000000000
result:
wrong answer 1st lines differ - expected: '1000000999999000000', found: '1000001000000000000'
Subtask #5:
score: 0
Skipped
Dependency #2:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%