Submission #76843872


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b;
  cin >> a;
  vector<vector<int>> A(a,vector<int>(2));
  for (int i=0; i<a; i++) {
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  cin >> b;
  vector<vector<int>> B(b,vector<int>(2));
  for (int i=0; i<b; i++) {
    B.at(i).at(1) = i;
    cin >> B.at(i).at(0);
  }
  
  sort(A.rbegin(),A.rend());
  sort(B.begin(),B.end());
  
  int max=0;
  for (int i=0; i<b; i++) {
    if (A.at(max).at(1) <= B.at(i).at(0)) {
      while (A.at(max).at(1) <= B.at(i).at(0)) {
        max++;
      }
    }
    B.at(i).at(0) = A.at(max).at(0);
    swap(B.at(i).at(0), B.at(i).at(1));
  }
  sort(B.begin(), B.end());
  
  for (int i=0; i<b; i++) {
    cout << B.at(i).at(1) << "\n";
  }
}

Submission Info

Submission Time
Task C - Tallest at the Moment
User Kane218
Language C++23 (GCC 15.2.0)
Score 300
Code Size 777 Byte
Status AC
Exec Time 364 ms
Memory 36780 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 28
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_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, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3592 KiB
00_sample_01.txt AC 1 ms 3552 KiB
01_random_02.txt AC 361 ms 36268 KiB
01_random_03.txt AC 359 ms 36264 KiB
01_random_04.txt AC 364 ms 36268 KiB
01_random_05.txt AC 363 ms 36268 KiB
01_random_06.txt AC 359 ms 36268 KiB
01_random_07.txt AC 153 ms 17992 KiB
01_random_08.txt AC 234 ms 25340 KiB
01_random_09.txt AC 354 ms 36268 KiB
01_random_10.txt AC 356 ms 36268 KiB
01_random_11.txt AC 353 ms 36272 KiB
01_random_12.txt AC 364 ms 36264 KiB
01_random_13.txt AC 364 ms 36268 KiB
01_random_14.txt AC 244 ms 24932 KiB
01_random_15.txt AC 78 ms 10976 KiB
01_random_16.txt AC 322 ms 36264 KiB
01_random_17.txt AC 328 ms 36264 KiB
01_random_18.txt AC 325 ms 36268 KiB
01_random_19.txt AC 324 ms 36296 KiB
01_random_20.txt AC 327 ms 36268 KiB
01_random_21.txt AC 161 ms 20068 KiB
01_random_22.txt AC 180 ms 21832 KiB
01_random_23.txt AC 328 ms 36780 KiB
01_random_24.txt AC 362 ms 36264 KiB
01_random_25.txt AC 362 ms 36260 KiB
01_random_26.txt AC 299 ms 36296 KiB
01_random_27.txt AC 1 ms 3628 KiB