#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
137 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
825 ms |
760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2797 ms |
868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4077 ms |
1024 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4075 ms |
1280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4077 ms |
1400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4080 ms |
1280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4054 ms |
1784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4062 ms |
1912 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4059 ms |
2296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |