QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#274617 | #5259. Skills in Pills | ucup-team859# | WA | 102ms | 27464kb | C++17 | 1.2kb | 2023-12-03 18:28:04 | 2023-12-03 18:28:05 |
Judging History
answer
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
using ull = unsigned long long;
using ll = long long;
using namespace std;
int main() {
#ifdef HOME
ifstream cin("input.in");
ofstream cout("output.out");
#endif
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, a, b;
cin >> a >> b >> n;
if (a == b) {
int answer = 0;
for (int i = a; i <= n; i += a) {
answer++;
}
for (int i = a - 1; i <= n; i += a) {
answer++;
}
cout << answer << "\n";
return 0;
}
if (a > b) {
swap(a, b);
}
int offset = (n / b) * b - (n - b) - 1;
set<int> mst;
for (int i = 1; i <= n; i++) {
mst.insert(i);
}
int answer = 0;
int i = b;
while (i <= n) {
if (i % a == 0 && offset > 0) {
offset--;
i--;
}
mst.erase(i);
answer++;
i += b;
}
int pos = 0;
while (n - pos >= a) {
auto itr = mst.upper_bound(pos + a);
itr--;
pos = *itr;
answer++;
mst.erase(itr);
}
cout << answer;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3388kb
input:
3 9 20
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
8 2 12
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
2 5 15
output:
10
result:
ok single line: '10'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
10 8 13
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
6 6 19
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
2 3 5
output:
3
result:
ok single line: '3'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
4 2 8
output:
6
result:
ok single line: '6'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
5 5 5
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
3 8 11
output:
4
result:
ok single line: '4'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
5 8 16
output:
5
result:
ok single line: '5'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
9 7 279
output:
70
result:
ok single line: '70'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
8 3 56
output:
25
result:
ok single line: '25'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
5 9 46
output:
14
result:
ok single line: '14'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
8 4 251
output:
93
result:
ok single line: '93'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3428kb
input:
8 7 41
output:
10
result:
ok single line: '10'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
60 17 360
output:
27
result:
ok single line: '27'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
16 55 388
output:
31
result:
ok single line: '31'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
25 38 292
output:
18
result:
ok single line: '18'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
22 59 177
output:
11
result:
ok single line: '11'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
4 3 82
output:
50
result:
ok single line: '50'
Test #21:
score: -100
Wrong Answer
time: 102ms
memory: 27464kb
input:
77 18 511543
output:
35110
result:
wrong answer 1st lines differ - expected: '35070', found: '35110'