# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
763647 |
2023-06-22T14:49:52 Z |
Kripton |
Fish (IOI08_fish) |
C++14 |
|
3000 ms |
5736 KB |
#include <bits/stdc++.h>
using namespace std;
pair <int, int> v[500001];
int vf[500001], maxi[500001];
bitset <500001> checc, dezact;
int k, m;
int recalc()
{
int rez = 1;
for(int i = 1; i <= k; i++)
if(!dezact[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)
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--;
for(int i = 1; i <= k; i++)
maxi[i] = vf[i];
int cate = 0;
for(int i = n; i >= 1; i--)
{
while(j >= 1 && 2 * v[j].first > v[i].first)
vf[v[j--].second]--;
if(!checc[v[i].second])
{
checc[v[i].second] = 1;
bool ok = 0;
if(vf[v[i].second] == maxi[v[i].second])
{
cate = (cate + recalc_fara(v[i].second)) % m;
vf[v[i].second]--;
ok = 1;
}
cate = (cate + recalc()) % m;
dezact[v[i].second] = 1;
if(ok == 1)
vf[v[i].second]++;
}
//cout << cate << " ";
}
cout << cate;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
240 ms |
4316 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
97 ms |
1880 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
364 KB |
Output is correct |
2 |
Incorrect |
9 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
256 ms |
4168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
247 ms |
2688 KB |
Output is correct |
2 |
Incorrect |
565 ms |
4276 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1106 ms |
3916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2586 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3055 ms |
3832 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3022 ms |
5128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3068 ms |
5016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3049 ms |
5736 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |