QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546568 | #6607. Rise of Shadows | ucup-team1001# | WA | 0ms | 3708kb | C++20 | 1.7kb | 2024-09-04 09:37:44 | 2024-09-04 09:37:45 |
Judging History
answer
/*
Author: Haze
2024/9/4
*/
#include <bits/stdc++.h>
#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
#define IOS ios::sync_with_stdio(false), cin.tie(nullptr);
using namespace std;
typedef long long ll;
inline ll readL() {
ll s = 0;
bool fl = false;
char ch = (char) getchar();
while (!isdigit(ch)) {
if (ch == '-')fl = true;
ch = (char) getchar();
}
while (isdigit(ch)) {
s = s * 10 + (ch ^ 48);
ch = (char) getchar();
}
return fl ? -s : s;
}
inline ll read() {
return (readL());
}
const int mod = 1000000000 + 7;
const int itinf = 1000000999;
const ll llinf = 2e18;
const int N = 500099;
void solve() {
ll n = read(), m = read(), s = readL();
ll ans = 0;
ll Rd = s / (n - 1), Ld = 0, Lr = 0, Rr = s % (n - 1), t1 = m / (n - 1), t2 = m % (n - 1);
if(n - 2 - s >= 0)Ld = (n - 2 - s) / (n - 1), Lr = (n - 2 - s) % (n - 1);
else Ld = 0, Lr = n - 2 - s;
auto update =
[&n](ll &d, ll &r, ll &vd, ll &vr){
d += vd, r += vr;
while(r >= n - 1)
++ d, r -= n - 1;
};
for(ll i = 0; i < n; ++ i){
// ll tim = i * m;
// ll r = (s + tim) / (n - 1), l = (tim - s + n - 2) / (n - 1);
// r = min(r, m - 1);
// l = max(l, 0ll);
Rd = min(Rd, m - 1);
ans += (Rd - Ld + 1);
// cerr << Ld << ' ' << Lr<< ' ' << Rd << ' ' << Rr<< endl << l << ' ' << r << endl;
update(Ld, Lr, t1, t2);
update(Rd, Rr, t1, t2);
}
cout << ans;
}
int main() {
// IOS
int T = 1;
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3516kb
input:
5 5 4
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
3 5 1
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5 5 0
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5 5 1
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
5 5 2
output:
5
result:
ok 1 number(s): "5"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
5 5 3
output:
7
result:
ok 1 number(s): "7"
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3708kb
input:
5 5 5
output:
9
result:
wrong answer 1st numbers differ - expected: '11', found: '9'