# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
53744 |
2018-07-01T06:23:56 Z |
윤교준(#1438) |
Fish (IOI08_fish) |
C++11 |
|
3000 ms |
32952 KB |
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define rb(x) ((x)&(-(x)))
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MAXN = 500005;
const int MAXK = 7005;
int D[MAXK][MAXK];
int C[MAXK], O[MAXK], RO[MAXK];
int A[MAXN], B[MAXN];
ll Ans;
int N, K, MOD;
int main() {
ios::sync_with_stdio(false);
cin >> N >> K >> MOD;
for(int i = 1; i <= N; i++) cin >> B[i] >> A[i];
for(int i = 1; i <= N; i++)
upmax(C[A[i]], B[i]);
iota(O, O+K+1, 0);
sort(O+1, O+K+1, [&](int a, int b) {
return C[a] > C[b];
});
for(int i = 1; i <= K; i++) RO[O[i]] = i;
fill(C, C+K+1, 0);
for(int i = 1; i <= N; i++) {
A[i] = RO[A[i]];
upmax(C[A[i]], B[i]);
}
for(int i = 1; i <= K; i++) {
for(int j = 1; j <= N; j++)
if(B[j]*2 <= C[i])
D[i][A[j]]++;
}
fill(D[0], D[0]+K+1, -1);
for(int i = 1; i <= K; i++) {
ll ret = D[i][i] + 1;
for(int j = i+1; j <= K; j++)
ret = ret * (D[i][j] + 1) % MOD;
Ans = (Ans + ret) % MOD;
if(D[i][i] == D[i-1][i]) {
ret = 1;
for(int j = 1; j <= K; j++)
if(i != j)
ret = ret * D[i][j] % MOD;
Ans = (Ans + ret) % MOD;
}
}
cout << Ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
560 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
640 KB |
Output is correct |
2 |
Incorrect |
2 ms |
640 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
640 KB |
Output is correct |
2 |
Incorrect |
226 ms |
4564 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4564 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4564 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
343 ms |
4564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
132 ms |
4564 KB |
Output is correct |
2 |
Correct |
71 ms |
8596 KB |
Output is correct |
3 |
Incorrect |
127 ms |
18876 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3025 ms |
18876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1768 ms |
28196 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3084 ms |
28196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3022 ms |
32952 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
155 ms |
32952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
359 ms |
32952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2261 ms |
32952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1327 ms |
32952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3023 ms |
32952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |