Submission #228980

# Submission time Handle Problem Language Result Execution time Memory
228980 2020-05-03T08:14:57 Z kartel Sunčanje (COCI18_suncanje) C++14
0 / 130
4000 ms 3448 KB
#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;
    }

    for (i = 1; i <= n; i++) cout << (ans[i] ? "DA" : "NE") << el;
}



# Verdict Execution time Memory Grader output
1 Incorrect 138 ms 660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 746 ms 1052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2641 ms 1548 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4048 ms 1920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4053 ms 2552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4070 ms 2560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4062 ms 2552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4059 ms 2936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4074 ms 3064 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4097 ms 3448 KB Time limit exceeded
2 Halted 0 ms 0 KB -