# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
763725 |
2023-06-22T17:27:15 Z |
Kripton |
Fish (IOI08_fish) |
C++14 |
|
3000 ms |
11300 KB |
#include <bits/stdc++.h>
using namespace std;
pair <int, int> v[500001];
int vf[500001];
int done[500001], last_drop[500001];
bitset <500001> checc, deact;
int k, m;
int recalc()
{
int rez = 1;
for(int i = 1; i <= k; i++)
if(!checc[i])
rez = 1LL * rez * (vf[i] + 1) % m;
return rez;
}
int recalc_fara(int j)
{
int rez = 1;
for(int i = 1; i <= k; i++)
if(i != j && (!checc[i] || done[i] < 2 * last_drop[j]))
rez = 1LL * rez * (vf[i] + 1) % m;
return rez;
}
int main()
{
#ifdef HOME
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif // HOME
int n;
cin >> n >> k >> m;
for(int i = 1; i <= n; i++)
cin >> v[i].first >> v[i].second;
sort(v + 1, v + n + 1);
int j = 1;
while(j <= n && 2 * v[j].first <= v[n].first)
{
vf[v[j].second]++;
j++;
}
j--;
for(int i = 1; i <= k; i++)
last_drop[i] = 1e9;
int cate = 0;
for(int i = n; i >= 1; i--)
{
while(j >= 1 && 2 * v[j].first > v[i].first)
{
vf[v[j].second]--;
last_drop[v[j].second] = v[j].first;
j--;
}
if(!checc[v[i].second])
{
cate = (cate + recalc_fara(v[i].second)) % m;
vf[v[i].second]--;
cate = (cate + recalc()) % m;///this is good
vf[v[i].second]++;
checc[v[i].second] = 1;
done[v[i].second] = v[i].first;
}
//cout << cate << " ";
}
cout << cate;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
246 ms |
4140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
1780 KB |
Output is correct |
2 |
Correct |
123 ms |
5412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
372 KB |
Output is correct |
2 |
Correct |
10 ms |
340 KB |
Output is correct |
3 |
Correct |
22 ms |
388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
183 ms |
2588 KB |
Output is correct |
2 |
Correct |
294 ms |
10876 KB |
Output is correct |
3 |
Correct |
307 ms |
10920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
4132 KB |
Output is correct |
2 |
Correct |
316 ms |
11300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
264 ms |
2692 KB |
Output is correct |
2 |
Correct |
672 ms |
4308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1419 ms |
3972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3004 ms |
4448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3061 ms |
3880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3076 ms |
5580 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
5368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3083 ms |
6548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |