As I know this problem is provided by miaorunhao in Luogu, and I don't have a standard code.

If anyone has the standard code, could you please give me?

4 条评论

  • @ 2025-8-15 16:09:26

    英语人……

    • @ 2025-3-20 19:30:40

      @ And I forgot to tell you that the background (at the bottom) was deleted here.

      • @ 2025-3-20 19:31:27

        No problem. I think the background is too naive.

    • @ 2025-3-20 19:28:35

      (And I mixed up the origins of P40 and P41 in the notes before. Fixed.)

      • @ 2025-3-20 19:25:30

        @

        A bucket sort is enough.

        #include <bits/stdc++.h>
        using namespace std;
        int a[4512], b[8912];
        int main()
        {
            int n, m, k;
            cin >> n >> m >> k;
            for (int i = 1; i <= n; i++)
            {
                int x;
                cin >> x;
                a[x]++;
            }
            for (int i = 1; i <= m; i++)
            {
                int s;
                cin >> s;
                while (s--)
                {
                    int x;
                    cin >> x;
                    b[x] += a[i];
                }
            }
            int mp = 0, mi = 0;
            for (int i = 1; i <= k; i++)
                if (b[i] > mi) mi = b[i], mp = i;
            cout << mp << endl;
            return 0;
        }
        
      • 1

      信息

      ID
      83
      时间
      1000ms
      内存
      256MiB
      难度
      4
      标签
      递交数
      7
      已通过
      2
      上传者