답안 #109981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
109981 2019-05-08T14:01:07 Z Arturgo Exhibition (JOI19_ho_t2) C++14
100 / 100
128 ms 5072 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int nbObjets, nbCadres;
vector<pair<int, int>> objets;
vector<int> cadres;

bool estPossible(int premier) {
  int iCadre = premier;

  for(int iObjet = 0;iObjet < nbObjets;iObjet++) {
    if(iCadre != nbCadres && objets[iObjet].second <= cadres[iCadre]) {
      iCadre++;
    }
  }

  return (iCadre == nbCadres);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> nbObjets >> nbCadres;

  for(int iObjet = 0;iObjet < nbObjets;iObjet++) {
    int taille, valeur;
    cin >> taille >> valeur;
    objets.push_back({valeur, taille});
  }
  sort(objets.begin(), objets.end());

  for(int iCadre = 0;iCadre < nbCadres;iCadre++) {
    int taille;
    cin >> taille;
    cadres.push_back(taille);
  }
  sort(cadres.begin(), cadres.end());

  int deb = -1, fin = nbCadres + 1;
  while(fin - deb > 1) {
    int mil = (deb + fin) / 2;
    if(estPossible(mil))
      fin = mil;
    else
      deb = mil;
  }

  cout << nbCadres - fin << endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 4 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 4 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 76 ms 4928 KB Output is correct
39 Correct 128 ms 4976 KB Output is correct
40 Correct 67 ms 4976 KB Output is correct
41 Correct 64 ms 4972 KB Output is correct
42 Correct 64 ms 4972 KB Output is correct
43 Correct 67 ms 4944 KB Output is correct
44 Correct 61 ms 4956 KB Output is correct
45 Correct 56 ms 4884 KB Output is correct
46 Correct 53 ms 4844 KB Output is correct
47 Correct 51 ms 4464 KB Output is correct
48 Correct 60 ms 4464 KB Output is correct
49 Correct 49 ms 4208 KB Output is correct
50 Correct 64 ms 4084 KB Output is correct
51 Correct 61 ms 5072 KB Output is correct
52 Correct 63 ms 4952 KB Output is correct
53 Correct 60 ms 4976 KB Output is correct
54 Correct 54 ms 4972 KB Output is correct
55 Correct 68 ms 5072 KB Output is correct
56 Correct 43 ms 3312 KB Output is correct
57 Correct 25 ms 1920 KB Output is correct
58 Correct 38 ms 3184 KB Output is correct
59 Correct 39 ms 3192 KB Output is correct
60 Correct 21 ms 1920 KB Output is correct
61 Correct 37 ms 2940 KB Output is correct
62 Correct 75 ms 4972 KB Output is correct
63 Correct 72 ms 4976 KB Output is correct
64 Correct 71 ms 4976 KB Output is correct
65 Correct 59 ms 4888 KB Output is correct
66 Correct 76 ms 4976 KB Output is correct
67 Correct 64 ms 4972 KB Output is correct
68 Correct 71 ms 4976 KB Output is correct
69 Correct 75 ms 4972 KB Output is correct
70 Correct 61 ms 4976 KB Output is correct
71 Correct 65 ms 4952 KB Output is correct
72 Correct 95 ms 4976 KB Output is correct
73 Correct 77 ms 4976 KB Output is correct