Submission #42330408


Source Code Expand

Copy
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
/** DRAFT
placeholder
**/
#define MULTI_TEST 0
constexpr int MOD = 1e9 + 7;
constexpr int N = 2e5 + 5;
void solve() {
//cout << "Case #" << test_case++ << ": ";
int n;
cin >> n;
vector<int> a(n * 3);
vector<int> cnt(n + 1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "bits/stdc++.h"

using namespace std;

using lint = long long;

/** DRAFT
  placeholder
**/

#define MULTI_TEST 0

constexpr int MOD = 1e9 + 7;
constexpr int N = 2e5 + 5;

void solve() {
  //cout << "Case #" << test_case++ << ": ";
  int n;
  cin >> n;
  vector<int> a(n * 3);
  vector<int> cnt(n + 1);
  vector<pair<int, int>> pos;
  for (int i = 0; i < n * 3; i++) {
    cin >> a[i];
    cnt[a[i]]++;
    if (cnt[a[i]] == 2) pos.push_back({i, a[i]});
  }

  sort(pos.begin(), pos.end());
  for (auto& e : pos) cout << e.second << ' ';
}

signed main() {
  if (fopen("iii.txt", "r"))
    freopen("iii.txt", "r", stdin),
    freopen("ooo.txt", "w", stdout);
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cerr << __cplusplus << '\n';

  int t = 1;
  if (MULTI_TEST) cin >> t;
  while (t --> 0) {
    solve();
    cout << '\n';
  }
  cerr << 1.0 * clock() / CLOCKS_PER_SEC * 1000.0 << " ms\n";

  return 0;
}

/**
--------------------------------------------------
X                     INPUT                      X
--------------------------------------------------

--------------------------------------------------
X                     OUTPUT                     X
--------------------------------------------------

**/

Submission Info

Submission Time
Task C - Centers
User Maikyou
Language C++ (GCC 9.2.1)
Score 250
Code Size 1298 Byte
Status AC
Exec Time 42 ms
Memory 5772 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:35:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   35 |     freopen("iii.txt", "r", stdin),
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
./Main.cpp:36:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   36 |     freopen("ooo.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

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 10 ms 3628 KB
00_sample_01.txt AC 2 ms 3668 KB
00_sample_02.txt AC 2 ms 3664 KB
01_random_00.txt AC 25 ms 4280 KB
01_random_01.txt AC 11 ms 3964 KB
01_random_02.txt AC 10 ms 3996 KB
01_random_03.txt AC 26 ms 4416 KB
01_random_04.txt AC 15 ms 3904 KB
01_random_05.txt AC 21 ms 4388 KB
01_random_06.txt AC 18 ms 4292 KB
01_random_07.txt AC 42 ms 5772 KB
01_random_08.txt AC 42 ms 5696 KB
01_random_09.txt AC 41 ms 5696 KB
01_random_10.txt AC 26 ms 4496 KB
01_random_11.txt AC 35 ms 5644 KB
01_random_12.txt AC 42 ms 5772 KB
01_random_13.txt AC 35 ms 5396 KB
01_random_14.txt AC 37 ms 5396 KB
01_random_15.txt AC 41 ms 5628 KB


2025-02-28 (Fri)
11:14:58 +00:00