社区讨论
TLE70pt求调
P2058[NOIP 2016 普及组] 海港参与者 2已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @mmhf83t4
- 此快照首次捕获于
- 2026/03/08 15:18 前天
- 此快照最后确认于
- 2026/03/08 19:20 前天
CPP
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 1e5+10;
int indexx[N];
struct ship {
unsigned long long t;
int country[3001];
}Ship[N];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int cnt = 0;
int t;
int k;
cin >> t;
cin >> k;
Ship[i].t = t;
for (int j = 0; j < k; j++) {
int x;
cin >> x;
Ship[i].country[j] = x;
}
for (int j = 1; j <= n; j++) {
if (Ship[j].t <= Ship[i].t&& Ship[j].t> Ship[i].t-86400) {
for (int m = 0; Ship[j].country[m] != 0; m++) {
if (indexx[Ship[j].country[m]] == 0) {
cnt++;
indexx[Ship[j].country[m]]++;
}
}
}
}
memset(indexx, 0, sizeof(indexx));
cout << cnt << endl;
}
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...