제출 #1146845

#제출 시각아이디문제언어결과실행 시간메모리
1146845fzyzzz_zBodyguard (JOI21_bodyguard)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <ios>
#include <iostream>
using namespace std;

using ll = long long; 

const int N = 2800; 
const int Q = 3000000; 

struct path {
    ll t, a, b, c; 
};

int n, q; 

set<array<ll, 3>> nodes; 
vector<array<ll, 7>> edges; 
vector<path> paths;  
vector<set<pair<ll, ll>>> pois; 

void add(int i, int j, ll ix, ll iy, ll jx, ll jy) {
    edges.push_back({i, ix, iy, j, jx, jy, 0LL});
    pois[i].insert({ix, iy}); 
    pois[j].insert({jx, jy});
}

pair<ll, ll> get_is(ll a, ll b) { // x+y, x-y
    ll y = (a - b) / 2LL; 
    ll x = a - y;
    return {x, y}; 
}

void addedge(int i, int j) {
    // add edge i->j 
    ll six = paths[i].t; 
    ll siy = paths[i].a; 
    ll eix = paths[i].t + abs(paths[i].a - paths[i].b); 
    ll eiy = paths[i].b; 
    ll di = paths[i].b - paths[i].a; 

    ll sjx = paths[j].t; 
    ll sjy = paths[j].a; 
    ll ejx = paths[j].t + abs(paths[j].a - paths[j].b); 
    ll ejy = paths[j].b; 
    ll dj = paths[j].b - paths[j].a; 

    // d: + -> 1 , -> 0 
    // if the two lines intersect, must be that point 
    if (di != dj) {
        ll a = (dj ? six + siy : sjx + sjy); // x + y constant 
        ll b = (di ? six - siy : sjx - sjy); // x - y constant

        auto [x, y] = get_is(a, b); 
        if (six <= x && x <= eix && sjx <= x && x <= ejx) {
            add(i, j, x, y, x, y); 
            return; 
        }
    }

    if (sjx - eix >= abs(eiy - sjy)) {
        add(i, j, eix, eiy, sjx, sjy);
        return; 
    }

    if (di && dj) { // lines: / /  
        { // end of i 
            ll a = eix + eiy; // x + y const 
            ll b = sjx - sjy; // x - y const 
            auto [x, y] = get_is(a, b);
            if (sjx <= x && x <= ejx) add(i, j, eix, eiy, x, y);  
        }
        { // start of j 
            ll a = sjx + sjy; // x + y const 
            ll b = eix - eiy; // x - y const 
            auto [x, y] = get_is(a, b);
            if (six <= x && x <= eix) add(i, j, x, y, sjx, sjy); 

        }
    } else if (di) {

    } else if (dj) {

    } else { // lines \ \ 
        { // end of i 
            ll a = sjx + sjy; // x + y const 
            ll b = eix - eiy; // x - y const 
            auto [x, y] = get_is(a, b);
            if (sjx <= x && x <= ejx) add(i, j, eix, eiy, x, y);  
        }
        { // start of j 
            ll a = six + siy; // x + y const 
            ll b = sjx - sjy; // x - y const 
            auto [x, y] = get_is(a, b);
            if (six <= x && x <= eix) add(i, j, x, y, sjx, sjy); 

        }
    }
    
}

void makegraph() {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i != j) {
                addedge(i, j); 
            }
        }
    }

    for (auto e: edges) {
        nodes.insert({e[0], e[1]});
        nodes.insert({e[2], e[3]});
    }

    



}

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

    cin >> n >> q; 

    for (int i = 0; i < n; ++i) {
        ll t, a, b, c; 
        cin >> t >> a >> b >> c; 
        paths.push_back({t * 2LL, a * 2LL, b * 2LL, c / 2LL});
    }

    pois.assign(n, {}); 
    makegraph(); 
    

    // make graph N^2 
    // make graph N 

    // for each ending do sweep line 
    // 


}

컴파일 시 표준 에러 (stderr) 메시지

bodyguard.cpp:100:1: error: expected declaration before '}' token
  100 | }
      | ^