QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#46781 | #3007. Intersecting Rectangles | Ufowoqqqo | Compile Error | / | / | C++ | 1.9kb | 2022-09-01 21:00:08 | 2022-09-01 21:00:11 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-09-01 21:00:11]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-09-01 21:00:08]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 400040;
struct Query
{
int x, t, y1, y2;
bool operator <(const Query &rhs) const
{
return x < rhs.x;
}
};
int x1[N], y1[N], x2[N], y2[N];
vector<int> v;
vector<Query> op;
int m, ft[N];
int lowbit(int x)
{
return x & -x;
}
int query(int p)
{
int res = 0;
while(p)
{
res += ft[p];
p -= lowbit(p);
}
return res;
}
void update(int p, int v)
{
while(p <= m)
{
ft[p] += v;
p += lowbit(p);
}
}
int main()
{
int n;
int i;
scanf("%d", &n);
for(i = 0; i < n; i ++)
scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]);
for(i = 0; i < n; i ++)
{
v.push_back(x1[i]);
v.push_back(y1[i]);
v.push_back(x2[i]);
v.push_back(y2[i]);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
for(i = 0, m = v.size(); i < n; i ++)
{
x1[i] = lower_bound(v.begin(), v.end(), x1[i]) - v.begin() + 1;
y1[i] = lower_bound(v.begin(), v.end(), y1[i]) - v.begin() + 1;
x2[i] = lower_bound(v.begin(), v.end(), x2[i]) - v.begin() + 1;
y2[i] = lower_bound(v.begin(), v.end(), y2[i]) - v.begin() + 1;
}
for(i = 0; i < n; i ++)
{
op.push_back({x1[i], 1, y1[i], y2[i]});
op.push_back({x2[i], -1, y1[i], y2[i]});
}
sort(op.begin(), op.end());
for(auto it : op)
{
if(it.t == -1)
{
update(it.y1, -1);
update(it.y2, 1);
}
if(query(it.y2 - 1) - query(it.y1 - 1))
{
puts("1");
return 0;
}
if(it.t == 1)
{
update(it.y1, 1);
update(it.y2, -1);
}
}
puts("0");
return 0;
}
Details
answer.code:16:16: error: ‘int y1 [400040]’ redeclared as different kind of entity 16 | int x1[N], y1[N], x2[N], y2[N]; | ^ In file included from /usr/include/features.h:424, 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/math-finite.h:100:1: note: previous declaration ‘double y1(double)’ 100 | __MATH_REDIRCALL (y1, , (_Mdouble_)); | ^~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:56:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 56 | scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]); | ^ answer.code:56:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘double (*)(double) noexcept’ [-Wformat=] 56 | scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]); | ~^ ~~~~~~ | | | | int* double (*)(double) noexcept answer.code:61:25: warning: pointer to a function used in arithmetic [-Wpointer-arith] 61 | v.push_back(y1[i]); | ^ answer.code:61:20: error: no matching function for call to ‘push_back(double (&)(double) noexcept)’ 61 | v.push_back(y1[i]); | ~~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/functional:62, from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from answer.code:1: /usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]’ (near match) 1187 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1187:7: note: conversion of argument 1 would be ill-formed: answer.code:61:25: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::vector<int>::value_type’ {aka ‘int’} [-fpermissive] 61 | v.push_back(y1[i]); | ~~~~^ | | | double (*)(double) noexcept In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/functional:62, from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from answer.code:1: /usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: ‘void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]’ (near match) 1203 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1203:7: note: conversion of argument 1 would be ill-formed: answer.code:61:25: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::vector<int>::value_type’ {aka ‘int’} [-fpermissive] 61 | v.push_back(y1[i]); | ~~~~^ | | | double (*)(double) noexcept answer.code:70:13: warning: pointer to a function used in arithmetic [-Wpointer-arith] 70 | y1[i] = lower_bound(v.begin(), v.end(), y1[i]) - v.begin() + 1; | ^ answer.code:70:53: warning: pointer to a function used in arithmetic [-Wpointer-arith] 70 | y1[i] = lower_bound(v.begin(), v.end(), y1[i]) - v.begin() + 1; | ^ answer.code:70:15: error: assignment of read-only location ‘*(y1 + ((sizetype)i))’ 70 | y1[i] = lower_bound(v.begin(), v.end(), y1[i]) - v.begin() + 1; | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:77:37: warning: pointer to a function used in arithmetic [-Wpointer-arith] 77 | op.push_back({x1[i], 1, y1[i], y2[i]}); | ^ answer.code:77:21: error: no matching function for call to ‘std::vector<Query>::push_back(<brace-enclosed initializer list>)’ 77 | op.push_back({x1[i], 1, y1[i], y2[i]}); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/vector:67, from /usr/include/c++/11/functional:62, from /usr/inc...