/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 79ms 2.996 MiB
#3 Accepted 86ms 3.031 MiB
#4 Accepted 81ms 2.832 MiB
#5 Accepted 84ms 2.953 MiB
#6 Accepted 82ms 2.969 MiB
#7 Accepted 74ms 3.055 MiB
#8 Accepted 89ms 2.98 MiB
#9 Accepted 70ms 3.047 MiB
#10 Accepted 62ms 2.938 MiB
#11 Accepted 43ms 2.148 MiB
#12 Accepted 16ms 1.023 MiB

Code


#include <bits/stdc++.h>

#ifdef LOCAL
#include "../algo/debug.h"
#else 
#define debug(...) 0
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> m;
  int N = n + m;
  a.resize(N);
  for (int i = n; i < N; i++) {
    cin >> a[i];
  }
  vector<int> b(N);
  iota(b.begin(), b.end(), 0);
  sort(b.begin(), b.end(), [&](int i, int j) {
    if (a[i] != a[j]) {
      return a[i] > a[j];
    }
    return i < j;
  });
  vector<int> ans(m);
  for (int i = 0; i < N; i++) {
    if (b[i] >= n) {
      ans[b[i] - n] = i;
    }
  }
  for (int i = 0; i < m; i++) {
    if (i > 0) {
      cout << ' ';
    }
    cout << ans[i] + 1;
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 15:22:35
Judged At
2024-11-11 03:34:36
Judged By
Score
100
Total Time
89ms
Peak Memory
3.055 MiB