Submission #73480649


Source Code Expand

#include <bits/stdc++.h>
#define ll long long
const ll N = 2e5 + 5, MOD = 1e9 + 7, inf = 2e18;
using namespace std;
int dx[] = {0, 1, 1, -1, 1, 1, -1, -1};
int dy[] = {1, 0, 0, 0, 1, -1, 1, -1};
char di[] = {'R', 'L', 'D', 'U'};
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

void Ebraam() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
#endif
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> v(m + 5, 0);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        int bg = 0;
        for (int j = 0; j < x; j++) {
            int y;
            cin >> y;
            if (!v[y]&&!bg)bg = y, v[y] = 1;
        }
        cout << bg << '\n';
    }
}

int main() {
    Ebraam();
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        if (t)cout << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task B - Greedy Draft
User Ebraam_Yousef
Language C++23 (GCC 15.2.0)
Score 200
Code Size 1297 Byte
Status AC
Exec Time 2 ms
Memory 3640 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 20
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt
All 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 2 ms 3508 KiB
00-sample-02.txt AC 2 ms 3584 KiB
01-01.txt AC 2 ms 3436 KiB
01-02.txt AC 2 ms 3444 KiB
01-03.txt AC 2 ms 3436 KiB
01-04.txt AC 2 ms 3584 KiB
01-05.txt AC 2 ms 3524 KiB
01-06.txt AC 2 ms 3608 KiB
01-07.txt AC 2 ms 3580 KiB
01-08.txt AC 2 ms 3608 KiB
01-09.txt AC 1 ms 3584 KiB
01-10.txt AC 1 ms 3612 KiB
01-11.txt AC 1 ms 3608 KiB
01-12.txt AC 2 ms 3540 KiB
01-13.txt AC 1 ms 3612 KiB
01-14.txt AC 2 ms 3564 KiB
01-15.txt AC 2 ms 3608 KiB
01-16.txt AC 1 ms 3640 KiB
01-17.txt AC 1 ms 3608 KiB
01-18.txt AC 2 ms 3624 KiB