map超时(70分)
查看原帖
map超时(70分)
728122
Masdsasa楼主2022/8/4 22:21

我恨超时!

#include <bits/stdc++.h>

using namespace std;
int n, ans;
map<int, int> c[100001];
long long t[100001];
int p, r;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> t[i] >> p;
        for (int j = 0; j < p; j++)
        {
            cin >> r;
            c[i][r] += 1;
        }
        map<int, int> temp = c[i];
        if (i > 0)
        {
            for (int z = i - 1; z >= 0; z--)
            {
                if (t[z] + 86400 > t[i])
                {
                    for (auto it: c[z])
                    {
                        temp[it.first] += 1;
                    }
                }
            }
        }
        cout << temp.size() << endl;
    }


    return 0;
}
2022/8/4 22:21
加载中...