This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 100005
#define MOD ll(998244353)
using namespace std;
using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
typedef short int si;
typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set lf, rg, up, dw;
int calcer(int x, int y, int xr, int yr)
{
}
void add(int x, int y, int xr, int yr)
{
lf.insert(x);
rg.insert(xr);
up.insert(yr);
dw.insert(y);
}
int calc(int x, int y, int xr, int yr)
{
int kol = 0;
kol += rg.order_of_key(x + 1);
kol += up.order_of_key(y + 1);
kol += sz(lf) - lf.order_of_key(xr);
kol += sz(dw) - dw.order_of_key(yr);
return kol;
}
int main()
{
// freopen("input.txt", "r", stdin);// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
int x[n], y[n], xr[n], yr[n];
for (int i = 0; i < n; i++)
{
cin >> x[i] >> y[i] >> xr[i] >> yr[i];
xr[i] += x[i];
yr[i] += y[i];
}
bool ans[n];
for (int i = n - 1; i >= 0; i--)
{
int cx = x[i], cy = y[i], xc = xr[i], yc = yr[i];
int kol = calc(cx, cy, xc, yc) - calcer(cx, cy, xc, yc);
ans[i] = (kol == n - i - 1);
add(cx, cy, xc, yc);
}
for (int i = 0; i < n; i++) cout << (ans[i] ? "DA" : "NE") << '\n';
}
Compilation message (stderr)
suncanje.cpp: In function 'int calcer(int, int, int, int)':
suncanje.cpp:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |