# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
473612 |
2021-09-15T17:20:08 Z |
OttoTheDino |
Fish (IOI08_fish) |
C++17 |
|
268 ms |
24328 KB |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for (ll i = s; i <= e; ++i)
#define pb push_back
#define fi first
#define se second
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
const ll mx = 5e5+5;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll f, k, m, ans = 0; cin >> f >> k >> m;
vii bois;
rep (i,0,f-1) {
ll l, tp; cin >> l >> tp;
bois.pb({l, tp});
}
sort(all(bois));
ll last[mx], cnt[mx] = {}, num[mx] = {}, done[mx] = {}, id = 0;
rep (i,0,f-1) last[bois[i].se] = bois[i].fi;
set<ll> st;
rep (i,0,f-1) {
ll l = bois[i].fi, tp = bois[i].se;
while (l>=2*bois[id].fi) {
ll c = ++cnt[bois[id].se];
if (done[bois[id].se]) {
if (--num[c-1]==0) st.erase(c-1);
if (++num[c]==1) st.insert(c);
}
++id;
}
if (last[tp]==l) {
ll res = cnt[tp]+1;
for (ll el : st) res = res*(el+1)%m*num[el]%m;
ans = (ans+res)%m;
done[tp] = 1;
if (cnt[tp] && ++num[cnt[tp]]==1) st.insert(cnt[tp]);
}
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
15872 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
15948 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
15948 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
15948 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
15948 KB |
Output is correct |
2 |
Incorrect |
11 ms |
15948 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
15948 KB |
Output is correct |
2 |
Incorrect |
170 ms |
24240 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
15948 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
16072 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
20120 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
15948 KB |
Output is correct |
2 |
Incorrect |
11 ms |
16204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
111 ms |
24240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
24232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
119 ms |
24240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
176 ms |
24212 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
198 ms |
24296 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
154 ms |
24328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
196 ms |
24220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
24244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
268 ms |
24240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |