/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 544.0 KiB
#2 Wrong Answer 95ms 3.09 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;
  }
  cout << '\n';
  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:20:55
Judged At
2024-11-11 03:34:38
Judged By
Score
0
Total Time
95ms
Peak Memory
3.09 MiB