Submission #229049

# Submission time Handle Problem Language Result Execution time Memory
229049 2020-05-03T10:04:05 Z VEGAnn Sunčanje (COCI18_suncanje) C++14
0 / 130
42 ms 3712 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PB push_back
#define pii pair<int,int>
#define MP make_pair
#define ft first
#define sd second
#define sz(x) ((int)x.size())
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
const int N = 10100;
const int PW = 22;
const int oo = 2e9;
bool mrk[N];
int x1[N], Y1[N], x2[N], y2[N], n;
ordered_set<pii> up, down, Left, Right;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n;

    for (int i = 0; i < n; i++){
        int X, Y; cin >> x1[i] >> Y1[i] >> X >> Y;
        x2[i] = x1[i] + X;
        y2[i] = Y1[i] + Y;
    }

    up.clear();
    down.clear();
    Left.clear();
    Right.clear();

    for (int i = n - 1; i >= 0; i--){
        if (i < n - 1){
            int kol = 0;
            kol += sz(up) - up.order_of_key(MP(y2[i] - 1, oo));
            kol += Left.order_of_key(MP(x1[i], oo));
            kol += down.order_of_key(MP(Y1[i], oo));
            kol += sz(Right) - Right.order_of_key(MP(x2[i] - 1, oo));

            if (kol < n - i - 1)
                mrk[i] = 1;
        }

        // add new elements
        up.insert(MP(Y1[i], i));
        down.insert(MP(y2[i], i));
        Left.insert(MP(x2[i], i));
        Right.insert(MP(x1[i], i));
    }

    for (int i = 0; i < n; i++)
        cout << (mrk[i] ? "NE\n" : "DA\n");

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 3712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -