# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
197525 | SamAnd | Fish (IOI08_fish) | C++17 | 3052 ms | 4276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 500005, K = 22;
struct ban
{
int x, t;
};
bool operator<(const ban& a, const ban& b)
{
return a.x < b.x;
}
int n, k, M;
ban a[N];
int q[K][K];
int u[K];
int main()
{
scanf("%d%d%d", &n, &k, &M);
for (int i = 1; i <= n; ++i)
{
scanf("%d%d", &a[i].x, &a[i].t);
--a[i].t;
}
sort(a + 1, a + n + 1);
for (int t = 0; t < k; ++t)
{
int maxu = 0;
for (int i = 1; i <= n; ++i)
{
if (a[i].t == t)
maxu = a[i].x;
}
for (int i = 1; i <= n; ++i)
{
if (a[i].x * 2 <= maxu)
++q[t][a[i].t];
}
++q[t][t];
}
int ans = 0;
for (int x = 1; x < (1 << k); ++x)
{
int qq = 0;
for (int i = 0; i < k; ++i)
u[i] = N;
for (int i = 0; i < k; ++i)
{
if ((x & (1 << i)))
{
++qq;
for (int j = 0; j < k; ++j)
{
if ((x & (1 << j)))
u[i] = min(u[i], q[i][j] - 1);
else
u[i] = min(u[i], q[i][j]);
}
}
}
int yans = 1;
for (int i = 0; i < k; ++i)
{
if (u[i] < 0)
yans = 0;
else
yans = (yans * 1LL * u[i]) % M;
}
if (qq % 2 == 1)
ans = (ans + yans) % M;
else
ans = (ans - yans + M) % M;
}
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |