QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#95919 | #6136. Airdrop | CSU2023 | Compile Error | / | / | C++14 | 3.3kb | 2023-04-12 14:54:04 | 2023-04-12 14:54:04 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-04-12 14:54:04]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-04-12 14:54:04]
- 提交
answer
#include <bits/stdc++.h>
template <class T>
inline void read(T &res)
{
char ch; bool flag = false; res = 0;
while (ch = getchar(), !isdigit(ch) && ch != '-');
ch == '-' ? flag = true : res = ch ^ 48;
while (ch = getchar(), isdigit(ch))
res = res * 10 + ch - 48;
flag ? res = -res : 0;
}
template <class T>
inline void put(T x)
{
if (x > 9)
put(x / 10);
putchar(x % 10 + 48);
}
template <class T>
inline void _put(T x)
{
if (x < 0)
x = -x, putchar('-');
put(x);
}
template <class T>
inline void CkMin(T &x, T y) {x > y ? x = y : 0;}
template <class T>
inline void CkMax(T &x, T y) {x < y ? x = y : 0;}
template <class T>
inline T Min(T x, T y) {return x < y ? x : y;}
template <class T>
inline T Max(T x, T y) {return x > y ? x : y;}
template <class T>
inline T Abs(T x) {return x < 0 ? -x : x;}
template <class T>
inline T Sqr(T x) {return x * x;}
// 若传入 int x 同时结果可能爆 int 应这样写 Sqr((ll)x)
using std::map;
using std::set;
using std::pair;
using std::bitset;
using std::string;
using std::vector;
using std::complex;
using std::multiset;
using std::priority_queue;
typedef long long ll;
typedef long double ld;
typedef complex<ld> com;
typedef pair<int, int> pir;
const ld pi = acos(-1.0);
const ld eps = 1e-8;
const int N = 2e5 + 5;
const int Maxn = 1e9;
const int Minn = -1e9;
const int mod = 998244353;
const int lim = 1e5;
int T_data, n, y0, bm, top;
inline void add(int &x, int y)
{
x += y;
x >= mod ? x -= mod : 0;
}
inline void dec(int &x, int y)
{
x -= y;
x < 0 ? x += mod : 0;
}
using std::vector;
vector<int> v[N];
int stk[N], cnt[N], tl[N], tr[N], l[N], r[N], b[N];
int main()
{
read(T_data);
while (T_data--)
{
read(n); read(y0);
bm = 0;
for (int i = 1, x, y; i <= n; ++i)
{
read(x); read(y);
y = Abs(y - y0);
v[x].emplace_back(y);
b[++bm] = x;
}
std::sort(b + 1, b + bm + 1);
bm = std::unique(b + 1, b + bm + 1) - b - 1;
int add_tag = 0, coll = 0;
for (int i = 1; i <= bm; ++i)
{
if (i > 1)
add_tag += b[i] - b[i - 1];
for (int e : v[b[i]])
++cnt[stk[++top] = e - add_tag + lim];
l[i] = coll;
for (int e : v[b[i]])
if (cnt[e - add_tag + lim] > 1)
{
coll += cnt[e - add_tag + lim];
cnt[e - add_tag + lim] = 0;
}
tl[i] = coll;
}
while (top)
cnt[stk[top--]] = 0;
add_tag = 0, coll = 0;
for (int i = bm; i >= 1; --i)
{
if (i < bm)
add_tag += b[i + 1] - b[i];
for (int e : v[b[i]])
++cnt[stk[++top] = e - add_tag + lim];
r[i] = coll;
for (int e : v[b[i]])
if (cnt[e - add_tag + lim] > 1)
{
coll += cnt[e - add_tag + lim];
cnt[e - add_tag + lim] = 0;
}
tr[i] = coll;
}
while (top)
cnt[stk[top--]] = 0;
int maxv = 0, minv = Maxn;
for (int i = 1; i <= bm; ++i)
{
CkMax(maxv, n - l[i] - r[i]);
CkMin(minv, n - l[i] - r[i]);
if (i < bm && b[i] + 1 < b[i + 1])
{
CkMax(maxv, n - tl[i] - tr[i + 1]);
CkMin(minv, n - tl[i] - tr[i + 1]);
}
}
CkMax(maxv, n - tl[n]);
CkMax(maxv, n - tr[1]);
CkMin(minv, n - tl[n]);
CkMin(minv, n - tr[1]);
for (int i = 1; i <= bm; ++i)
v[b[i]].clear();
// puts("???");
put(minv), putchar(' '), put(maxv), putchar('\n');
}
return 0;
}
/*
1
3 3
2 1
2 5
4 3
*/
Details
answer.code:65:16: error: ‘int y0’ redeclared as different kind of entity 65 | int T_data, n, y0, bm, top; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571, from /usr/include/c++/11/cassert:43, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’ 220 | __MATHCALL (y0,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:93:35: error: invalid operands of types ‘int’ and ‘double(double) throw ()’ {aka ‘double(double)’} to binary ‘operator-’ 93 | y = Abs(y - y0); | ~ ^ ~~ | | | | int double(double) throw () {aka double(double)} answer.code: In instantiation of ‘void read(T&) [with T = double(double)]’: answer.code:88:16: required from here answer.code:6:41: error: assignment of read-only reference ‘res’ 6 | char ch; bool flag = false; res = 0; | ~~~~^~~ answer.code:8:39: error: assignment of read-only reference ‘res’ 8 | ch == '-' ? flag = true : res = ch ^ 48; | ~~~~^~~~~~~~~ answer.code:10:27: error: invalid operands of types ‘double(double)’ and ‘int’ to binary ‘operator*’ 10 | res = res * 10 + ch - 48; | ~~~~^~~~ answer.code:11:22: error: wrong type argument to unary minus 11 | flag ? res = -res : 0; | ^~~~