40分求助
查看原帖
40分求助
807950
xyvsvg楼主2022/11/26 09:24
#include<iostream>
#include<stack>
#include<string.h>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<climits>
#include<cstdio>
#include<ctype.h>
using namespace std;
inline void mr(int& theNumberToRead) { theNumberToRead = 0; int prn = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-')prn = -1; c = getchar(); }while (isdigit(c)) { theNumberToRead = 10 * theNumberToRead + c - 48; c = getchar(); }theNumberToRead *= prn; }
const int M = 1e5 + 10;
int n, k, t[M], x, p = 1, m[M], c[M], ans, e[3 * M], ti = 1;//c[i]表示国籍i最后出现的时间
//e[i]表示第i个人的国籍,m[i]表示第i艘船的第一个人
int main()
{
	mr(n);
	for (int i = 1; i <= n; ++i)
	{
		mr(t[i]);
		mr(k);
		m[i] = p;
		for (; ti<i && t[ti] + 86400 <= t[i]; ++ti)
			for (int j = m[ti]; j < m[ti + 1]; ++j)
				if (c[e[j]] + 86400 <= t[i])
					--ans;
		for (int j = 0; j < k; ++j, ++p)
		{
			mr(x);
			e[p] = x;
			if (!c[x] || c[x] + 86400 <= t[i])
				++ans;
			c[x] = t[i];
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

样例过了,但是只有40分

2022/11/26 09:24
加载中...