QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#765115#8268. Tycho_8_8_#0 1ms5772kbC++20737b2024-11-20 12:16:452024-11-20 12:16:46

Judging History

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

  • [2024-11-20 12:16:46]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5772kb
  • [2024-11-20 12:16:45]
  • 提交

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 - 1) * d, res = all + b;
    for(int i  = 1; i <= p; i++) {
        res = min(res, (get(0, b - 1) - 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;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 0ms
memory: 3656kb

input:

1000000000000 1 1000000 0

output:

1000000999999000000

result:

ok single line: '1000000999999000000'

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 5684kb

input:

100 10 11 10
10
11
20
30
38
49
50
60
70
90

output:

132

result:

wrong answer 1st lines differ - expected: '122', found: '132'

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 5
Accepted
time: 1ms
memory: 5708kb

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: 5700kb

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #13:

score: 0
Wrong Answer
time: 1ms
memory: 5772kb

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: 15
Accepted
time: 0ms
memory: 3712kb

input:

1000000000000 1 1000000 0

output:

1000000999999000000

result:

ok single line: '1000000999999000000'

Test #110:

score: 15
Accepted
time: 1ms
memory: 5692kb

input:

108 100 10000 5
10
20
30
40
98

output:

110

result:

ok single line: '110'

Test #111:

score: 15
Accepted
time: 1ms
memory: 5720kb

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #112:

score: 0
Wrong Answer
time: 1ms
memory: 5640kb

input:

206 100 10000 5
10
20
30
98
196

output:

10208

result:

wrong answer 1st lines differ - expected: '210', found: '10208'

Subtask #5:

score: 0
Skipped

Dependency #2:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%