Submission #53606210


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  cin >> N;
  map<pair<int, int>, int> M;
  for (int i = 0; i < N; i++) {
    int A, C;
    cin >> A >> C;
    M[{-A, C}] = i + 1;
  }

  vector<int> ans;
  int c_min = INT32_MAX;
  for (auto &&M_i : M) {
    if (M_i.first.second >= c_min) continue;
    ans.push_back(M_i.second);
    c_min = M_i.first.second;
  }
  sort(ans.begin(), ans.end());

  int m = ans.size();
  cout << m << endl;
  cout << ans[0];
  for (int i = 1; i < m; i++) {
    cout << " " << ans[i];
  }
  cout << endl;

  return 0;
}

Submission Info

Submission Time
Task C - AtCoder Magics
User koshikura
Language C++ 23 (gcc 12.2)
Score 350
Code Size 573 Byte
Status AC
Exec Time 163 ms
Memory 16764 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 17
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_hand_00.txt, 01_hand_01.txt, 01_hand_02.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3616 KiB
00_sample_01.txt AC 1 ms 3476 KiB
00_sample_02.txt AC 1 ms 3612 KiB
01_hand_00.txt AC 144 ms 15960 KiB
01_hand_01.txt AC 163 ms 16764 KiB
01_hand_02.txt AC 121 ms 16400 KiB
02_random_00.txt AC 143 ms 15988 KiB
02_random_01.txt AC 142 ms 16104 KiB
02_random_02.txt AC 142 ms 16032 KiB
02_random_03.txt AC 143 ms 15976 KiB
02_random_04.txt AC 143 ms 15976 KiB
02_random_05.txt AC 142 ms 15996 KiB
02_random_06.txt AC 143 ms 15940 KiB
02_random_07.txt AC 144 ms 16044 KiB
02_random_08.txt AC 146 ms 15976 KiB
02_random_09.txt AC 143 ms 16028 KiB
02_random_10.txt AC 145 ms 16180 KiB