QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#470234 | #6376. LaLa and Lamp | lichenyu_ac | WA | 1ms | 5160kb | C++14 | 1.1kb | 2024-07-10 11:29:37 | 2024-07-10 11:29:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int kx[512];
ll dis[200005];
int main()
{
cin.tie(0)->sync_with_stdio(0);
ll n, k, x;
cin >> n >> x >> k;
for (int i = 1; i <= k; i++)
cin >> kx[i], kx[i] %= n;
memset(dis, 0x3f, sizeof dis);
dis[0] = dis[n] = 0;
queue<int> q;
q.push(0);
while (q.size())
{
auto t = q.front();
q.pop();
for (int i = 1; i <= k; i++)
{
int s = t - kx[i] + n;
s %= n;
if (dis[s] >= 1e9)
{
dis[s] = dis[t] + 1;
q.push(s);
}
}
}
// cerr << dis[x];
ll up = min(dis[x], n), down = 1;
sort(dis + 1, dis + n + 1);
ll sum = 0;
for (int i = 1; i < n; i++)
{
if (dis[i] >= 1e9)
break;
sum += dis[i];
if (up * i > (sum + n) * down)
{
up = sum + n;
down = i;
}
}
ll gc = __gcd(up, down);
cout << up / gc << ' ' << down / gc;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5160kb
input:
6 0 00 000 0110 00100 000000
output:
0 1
result:
wrong output format YES or NO expected, but 0 found