Submission #23446965


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;


#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision13 cout << fixed << setprecision(13)
const double PI=3.14159265358979323846;
const int MAX = 510000;
const int MOD = 1000000007;
const int INF = 1<<29;
using Graph = vector<vector<char>>;


int main(){
  
  ll n,q;
  cin >> n >> q;

  vector<ll> a(n);
  vector<ll> k(q);

  REP(i,n){
    cin >> a.at(i);
  }

  REP(i,q){
    cin >> k.at(i);
  }

  for(ll i=0;i<q;i++){

    auto syaku = a.begin();

    while(true){
      bool flag = false;
      auto it = upper_bound(syaku, a.end(), k.at(i));
      ll index = it - syaku;
      k.at(i) += index;
      if(index == 0){
        cout << k.at(i) << endl;
        flag = true;
      }

      if(flag){
        break;
      }
      syaku = it;

    }
  }
  
  
}

Submission Info

Submission Time
Task D - Kth Excluded
User takkey
Language C++ (GCC 9.2.1)
Score 400
Code Size 1057 Byte
Status AC
Exec Time 292 ms
Memory 4628 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 19
Set Name Test Cases
Sample example_00.txt, example_01.txt
All block_00.txt, block_01.txt, block_02.txt, block_03.txt, block_04.txt, example_00.txt, example_01.txt, killer_00.txt, killer_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt
Case Name Status Exec Time Memory
block_00.txt AC 252 ms 4608 KiB
block_01.txt AC 198 ms 4156 KiB
block_02.txt AC 141 ms 3836 KiB
block_03.txt AC 133 ms 3552 KiB
block_04.txt AC 51 ms 3516 KiB
example_00.txt AC 4 ms 3536 KiB
example_01.txt AC 2 ms 3512 KiB
killer_00.txt AC 292 ms 4628 KiB
killer_01.txt AC 266 ms 4624 KiB
random_00.txt AC 259 ms 4596 KiB
random_01.txt AC 38 ms 3624 KiB
random_02.txt AC 189 ms 4412 KiB
random_03.txt AC 210 ms 4508 KiB
random_04.txt AC 75 ms 3976 KiB
random_05.txt AC 224 ms 4344 KiB
random_06.txt AC 67 ms 3568 KiB
random_07.txt AC 96 ms 3812 KiB
random_08.txt AC 193 ms 4412 KiB
random_09.txt AC 231 ms 4444 KiB