QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#642357#6607. Rise of ShadowspotentialWA 0ms3832kbC++201.8kb2024-10-15 13:29:332024-10-15 13:29:34

Judging History

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

  • [2024-10-15 13:29:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-10-15 13:29:33]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
# define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
# define int long long
# define lowbit(x) (x & (-x))
# define fi first
# define se second
# define all(x) x.begin(), x.end()
// # define endl '\n'

inline int Read();

typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
const int N = 1e6 + 10;
const double eps = 1e-8;

int sgn(double x, double y){
    if(fabs(x - y) < eps) return 0;
    if(x < y) return -1;
    else return 1;
}

map <int, int> mp;
vector <int> v;

void Solve(){
    int h, m, a;
    cin >> h >> m >> a;
    double t = (double)a * 2 / (h - 1);
    int ans = (h - 2) * (int)t;
    if(h == 5 && m == 5 && a == 2)cout << ans <<"\n";
    ans += 1 + a / (h - 1) * 2;
    if(h == 5 && m == 5 && a == 2) cout << ans <<"\n";
    int l = 0, r = h / 2, mid;
    while(l < r){
        mid = l + r + 1 >> 1;
        int k = h * m % (h - 1) * mid % (h - 1);
        if(sgn((double) a  / (h - 1) - (int)(a  / (h - 1)), (double) k / (h - 1)) >= 0) l = mid;
        else r = mid - 1;
    }
    int k = h * m % (h - 1) * l % (h - 1);
    // cout << (double) a  / (h - 1) - (int)(a  / (h - 1)) <<'\n';
    if(h == 5 && m == 5 && a == 2) cout << l <<" " << k <<" " << (double) k / (h - 1)<<"\n";
    if(h & 1){
        if(l == h / 2) ans += (l - 1) * 2 + 1;
        else ans += l * 2;
    }else{
        ans += l * 2;
    }
    cout << ans <<"\n";
}
signed main(){
    IOS;
    int T = 1;
    // cin >> T;
    while (T--) 
        Solve();
    return 0;
}
inline int Read(){
    int x = 0, f = 1; char c = getchar();
    while (c < '0' || c > '9'){ if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

5 5 4

output:

9

result:

ok 1 number(s): "9"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

3 5 1

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

5 5 0

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

5 5 1

output:

3

result:

ok 1 number(s): "3"

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3832kb

input:

5 5 2

output:

3
4
2 2 0.5
7

result:

wrong answer 1st numbers differ - expected: '5', found: '3'