QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#470234#6376. LaLa and Lamplichenyu_acWA 1ms5160kbC++141.1kb2024-07-10 11:29:372024-07-10 11:29:38

Judging History

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

  • [2024-07-10 11:29:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5160kb
  • [2024-07-10 11:29:37]
  • 提交

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