Submission #3246212


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef struct{
    int x;
    int y;
} ax;
int main(){
    int n;
    cin >> n;
    vector<ax> r(n),b(n);
    for(int i = 0; i < n; i++)
        cin >> r[i].x >> r[i].y;
    for(int i = 0; i < n; i++)
        cin >> b[i].x >> b[i].y;
    sort(b.begin(),b.end(),[](auto c,auto d){return c.x < d.x;});
    int count = 0;
    for(int i = 0; i < n; i++){
        int j,max=-1,ab;
        for(j = 0; j < r.size(); j++){
            if(r[j].x < b[i].x && r[j].y < b[i].y){
                if(r[j].y > max){
                    max = r[j].y;
                    ab = j;
                }
            }
        }
        if(max != -1){
            r.erase(ab+r.begin());
            count++;
        }
    }
    cout << count;
}

Submission Info

Submission Time
Task C - 2D Plane 2N Points
User fullcstm
Language C++14 (GCC 5.4.1)
Score 400
Code Size 799 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 5
AC × 17
Set Name Test Cases
Sample example_0, example_1, example_2, example_3, example_4
All example_0, example_1, example_2, example_3, example_4, line_0, line_1, line_2, line_3, maxrand_0, maxrand_1, maxrand_2, maxrand_3, maxrand_4, rand_0, rand_1, rand_2
Case Name Status Exec Time Memory
example_0 AC 1 ms 256 KB
example_1 AC 1 ms 256 KB
example_2 AC 1 ms 256 KB
example_3 AC 1 ms 256 KB
example_4 AC 1 ms 256 KB
line_0 AC 1 ms 256 KB
line_1 AC 1 ms 256 KB
line_2 AC 1 ms 256 KB
line_3 AC 1 ms 256 KB
maxrand_0 AC 1 ms 256 KB
maxrand_1 AC 1 ms 256 KB
maxrand_2 AC 1 ms 256 KB
maxrand_3 AC 1 ms 256 KB
maxrand_4 AC 1 ms 256 KB
rand_0 AC 1 ms 256 KB
rand_1 AC 1 ms 256 KB
rand_2 AC 1 ms 256 KB