Submission #42330881


Source Code Expand

#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

#include <unordered_set>
#include <unordered_map>
#include <array>
#include <iomanip>

#include <atcoder/all>

using namespace std;

#define LL long long

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

inline void write(int x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static int sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
}

inline void writeln(int x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static int sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
	putchar('\n');
}

inline LL readll() {
    LL x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

inline void writell(LL x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static LL sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
}

inline void writellln(LL x) {
	if (x < 0) {
		putchar('-'); x = -x;
	}
    static LL sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48); 
	putchar('\n');
}
template<class DataType1, class DataType2>
void write(pair<DataType1, DataType2> a, char endSplit = ' ') {
    cout << "(" << a.first << ", " << a.second << ")" << endSplit;
}
template<class DataType>
void write(vector<DataType> &a, char split = ' ', char endSplit = '\n') {
    for (int i = 0; i < a.size(); ++i) {
        cout << a[i] << split;
    }
    cout << endSplit;
}

using mint = atcoder::modint998244353;

int main() {
	// std::ios::sync_with_stdio(false);
    // std::cin.tie(0);
    int n = read();
    vector<int> a(3 * n);
    for (int i = 0; i < 3 * n; ++i) {
        a[i] = read() - 1;
    }
    vector<int> occ(n, 0);
    vector<pair<int, int> > f(n);
    for (int i = 0; i < 3 * n; ++i) {
        if (occ[a[i]] == 0) {
            ++occ[a[i]];
        } else if (occ[a[i]] == 1) {
            f[a[i]] = {i, a[i]};
            ++occ[a[i]];
        } else {
            continue;
        }
    }
    // for (int i = 0; i < n; ++i) {
    //     cout << f[i].first << ' ' << f[i].second << endl;
    // }
    sort(f.begin(), f.end());
    for (int i = 0; i < n; ++i) {
        cout << (f[i].second + 1) << ' ';
    }
    cout << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Centers
User AliceNan
Language C++ (GCC 9.2.1)
Score 250
Code Size 3208 Byte
Status AC
Exec Time 39 ms
Memory 5616 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 19
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 2 ms 3508 KiB
00_sample_01.txt AC 2 ms 3528 KiB
00_sample_02.txt AC 2 ms 3452 KiB
01_random_00.txt AC 23 ms 3804 KiB
01_random_01.txt AC 7 ms 3784 KiB
01_random_02.txt AC 6 ms 3776 KiB
01_random_03.txt AC 21 ms 3952 KiB
01_random_04.txt AC 12 ms 3760 KiB
01_random_05.txt AC 17 ms 4292 KiB
01_random_06.txt AC 17 ms 3796 KiB
01_random_07.txt AC 35 ms 5560 KiB
01_random_08.txt AC 39 ms 5552 KiB
01_random_09.txt AC 37 ms 5616 KiB
01_random_10.txt AC 19 ms 4296 KiB
01_random_11.txt AC 34 ms 5520 KiB
01_random_12.txt AC 34 ms 5376 KiB
01_random_13.txt AC 31 ms 5044 KiB
01_random_14.txt AC 32 ms 4952 KiB
01_random_15.txt AC 37 ms 5480 KiB