Submission #403543

# Submission time Handle Problem Language Result Execution time Memory
403543 2021-05-13T09:19:41 Z lyc None (KOI16_laser) C++14
19 / 100
1 ms 336 KB
#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int mxN = 1005;

int N;
struct Point { int x, y, c, i; };
vector<Point> v;
vector<int> ans[mxN];

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin >> N;
    FOR(i,1,N){
        int X, Y;
        cin >> X >> Y;
        v.push_back({ X,Y,0,i });
        v.push_back({ X,Y,0,i });
    }
    FOR(i,1,2*N){
        int X, Y;
        cin >> X >> Y;
        v.push_back({ X,Y,1,i });
    }

    sort(ALL(v), [](Point a, Point b){
            return a.x < b.x; });

    vector<Point> stk;
    for(auto& x : v) {
        if (stk.empty() || stk.back().c == x.c) {
            stk.push_back(x);
        } else {
            if (stk.back().c == 0) ans[stk.back().i].push_back(x.i);
            else ans[x.i].push_back(stk.back().i);
            stk.pop_back();
        }
    }

    FOR(i,1,N){
        assert(SZ(ans[i]) == 2);
        cout << ans[i][0] _ ans[i][1] << '\n';
    }
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -