#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#define F first
#define S second
#define pb push_back
#define N +100500
#define M ll(1e9 + 7)
#define sz(x) (int)x.size()
#define re return
#define oo ll(1e18)
#define el '\n'
using namespace std;
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
int xr[N], xl[N], yl[N], yr[N], lx, ly, i, j, n, ans[N];
int main()
{
srand(time(0));
ios_base::sync_with_stdio(0);
iostream::sync_with_stdio(0);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
// in("input.txt");
// out("output.txt");
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> xl[i] >> yl[i] >> lx >> ly;
xr[i] = xl[i] + lx;
yr[i] = yl[i] + ly;
ans[i] = 1;
}
for (i = 1; i <= n; i++)
for (j = i + 1; j <= n; j++)
{
if (xr[i] >= xl[j] && xr[i] <= xr[j] && yr[i] <= yr[j] && yr[i] >= yr[j]) ans[i] = 0;
if (xr[i] >= xl[j] && xr[i] <= xr[j] && yl[i] <= yr[j] && yl[i] >= yr[j]) ans[i] = 0;
if (xl[i] >= xl[j] && xl[i] <= xr[j] && yr[i] <= yr[j] && yr[i] >= yr[j]) ans[i] = 0;
if (xl[i] >= xl[j] && xl[i] <= xr[j] && yl[i] <= yr[j] && yl[i] >= yr[j]) ans[i] = 0;
if (yr[i] >= yl[j] && yr[i] <= yr[j] && xr[i] <= yr[j] && xr[i] >= yr[j]) ans[i] = 0;
if (yr[i] >= yl[j] && yr[i] <= yr[j] && xl[i] <= yr[j] && xl[i] >= yr[j]) ans[i] = 0;
if (yl[i] >= yl[j] && yl[i] <= yr[j] && xr[i] <= yr[j] && xr[i] >= yr[j]) ans[i] = 0;
if (yl[i] >= yl[j] && yl[i] <= yr[j] && xl[i] <= yr[j] && xl[i] >= yr[j]) ans[i] = 0;
if (xl[i] >= xl[j] && xr[i] <= xr[j] && yl[i] >= yl[j] && yr[i] <= yr[j]) ans[i] = 0;
if (min(xr[i], xr[j]) > max(xl[i], xl[j])) ans[i] = 0;
if (min(yr[i], yr[j]) > max(yl[i], yl[j])) ans[i] = 0;
}
for (i = 1; i <= n; i++) cout << (ans[i] ? "DA" : "NE") << el;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
833 ms |
760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2884 ms |
836 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4075 ms |
896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4053 ms |
1280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4070 ms |
1448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4074 ms |
1408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4081 ms |
1784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4090 ms |
1912 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4082 ms |
2296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |