QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#374806 | #8311. Game on Sequence | PetroTarnavskyi# | WA | 1ms | 3504kb | C++20 | 1.8kb | 2024-04-02 18:29:54 | 2024-04-02 18:29:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
bool hasBit(int mask, int i)
{
return (mask >> i) & 1;
}
db area(int y, int h1, int h2)
{
if (h1 > h2)
swap(h1, h2);
if (h1 >= y)
return y;
if (h2 <= y)
return (h1 + h2) / 2.0;
return y - (y - h1) * (y - h1) / (2.0 * (h2 - h1));
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, w, h;
cin >> n >> w >> h;
VI a(n + 2);
FOR(i, 1, n + 1)
cin >> a[i];
int m = 2 * w - 1, fullMask = (1 << m) - 1;
vector f(n + 1, VI(fullMask + 1));
VI l(2 * w), r(2 * w);
FOR(i, 1, n + 1)
{
FOR(mask, 0, fullMask + 1)
{
l.assign(2 * w, max(0, a[i] - h));
r.assign(2 * w, a[i] + h);
FOR(j, 0, m)
{
if (!hasBit(mask, j))
continue;
int k = i - j - 1;
if (k < 1)
continue;
#warning
FOR(p, 0, 2 * w)
{
int index = i + p - w;
if (k - w <= index && index < k + w)
{
int& curL = l[index], curR = r[index];
if (curL <= a[k] - h && a[k] - h <= curR)
{
curR = a[k] - h;
}
if (curL <= a[k] + h && a[k] + h <= curR)
{
curL = a[k] + h;
}
}
}
}
FOR(p, 0, 2 * w)
{
int index = i + p - w;
if (l[p] < r[p] && index >= 0 && index + 1 < n + 2)
{
f[i][mask] += area(r[p], a[index], a[index + 1]) - area(l[p], a[index], a[index + 1]);
}
}
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3504kb
input:
5 5 1 2 3 4 5 1 6 2 5 1 7 2 5 2 1
output:
result:
wrong answer 1st lines differ - expected: 'Alice', found: ''