답안 #787347

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787347 2023-07-19T06:01:19 Z christinelynn Exhibition (JOI19_ho_t2) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
signed namespace std;
int main() { 
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m; cin >> n >> m;
    vector<pair<int, int>> a(n);
  vector<int> b(m);
    for(auto &p : a) cin >> p.second >> p.first;
    for(int &p : b) cin >> p;
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    int idx=0;
    for(int i=0; i<n && idx<m; i++) {
        if(a[i].second>b[idx]) continue;
        idx++;
    }
    cout << idx << '\n';
}

Compilation message

joi2019_ho_t2.cpp:3:8: error: expected unqualified-id before 'namespace'
    3 | signed namespace std;
      |        ^~~~~~~~~
cc1plus: error: '::main' must return 'int'
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:5:5: error: 'ios_base' has not been declared
    5 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |     ^~~~~~~~
joi2019_ho_t2.cpp:5:35: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                   ^~~
      |                                   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
joi2019_ho_t2.cpp:5:47: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                               ^~~~
      |                                               std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
joi2019_ho_t2.cpp:7:5: error: 'vector' was not declared in this scope
    7 |     vector<pair<int, int>> a(n);
      |     ^~~~~~
joi2019_ho_t2.cpp:7:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
joi2019_ho_t2.cpp:7:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 |     vector<pair<int, int>> a(n);
      |            ^~~~
      |            std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
joi2019_ho_t2.cpp:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
joi2019_ho_t2.cpp:7:17: note: in expansion of macro 'int'
    7 |     vector<pair<int, int>> a(n);
      |                 ^~~
joi2019_ho_t2.cpp:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
joi2019_ho_t2.cpp:8:10: note: in expansion of macro 'int'
    8 |   vector<int> b(m);
      |          ^~~
joi2019_ho_t2.cpp:9:19: error: 'a' was not declared in this scope
    9 |     for(auto &p : a) cin >> p.second >> p.first;
      |                   ^
joi2019_ho_t2.cpp:10:18: error: 'b' was not declared in this scope
   10 |     for(int &p : b) cin >> p;
      |                  ^
joi2019_ho_t2.cpp:11:10: error: 'a' was not declared in this scope
   11 |     sort(a.rbegin(), a.rend());
      |          ^
joi2019_ho_t2.cpp:11:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   11 |     sort(a.rbegin(), a.rend());
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
joi2019_ho_t2.cpp:12:10: error: 'b' was not declared in this scope
   12 |     sort(b.rbegin(), b.rend());
      |          ^