제출 #424887

#제출 시각아이디문제언어결과실행 시간메모리
424887ollel팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> #include "teams.h" using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; struct seg { int a, b; bool marked = false; seg(int A, int B) {a = A; b = B;} }; vector<seg> s; void init(int n, int a[], int b[]) { s.resize(n); rep(i,0,n) { s[i].a = a[i]; s[i].b = b[i]; } sort(s.begin(), s.end(), [](seg x, seg y) { return x.b < y.b; }) } int can(int m, int k[]) { vi p(m); rep(i,0,m) p[i] = k[i]; sort(p.begin(), p.end()); rep(i,0,n) s[i].marked = false; rep(i,0,m) { int t = p[i], left = p[i]; rep(j, 0, n) { if((!s[j].marked) && s[j].a <= t && s[j].b >= t) { left--; s[j].marked = true; if (left == 0) break; } } if (left > 0) return 0; } return 1; }

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:29:5: error: expected ';' before '}' token
   29 |   })
      |     ^
      |     ;
   30 | }
      | ~    
teams.cpp: In function 'int can(int, int*)':
teams.cpp:36:11: error: 'n' was not declared in this scope
   36 |   rep(i,0,n) s[i].marked = false;
      |           ^
teams.cpp:6:39: note: in definition of macro 'rep'
    6 | #define rep(i,a,b) for(int i = a; i < b; i++)
      |                                       ^
teams.cpp:40:15: error: 'n' was not declared in this scope
   40 |     rep(j, 0, n) {
      |               ^
teams.cpp:6:39: note: in definition of macro 'rep'
    6 | #define rep(i,a,b) for(int i = a; i < b; i++)
      |                                       ^
In file included from /usr/include/c++/10/bits/alloc_traits.h:33,
                 from /usr/include/c++/10/ext/alloc_traits.h:34,
                 from /usr/include/c++/10/bits/basic_string.h:40,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from teams.cpp:1:
/usr/include/c++/10/bits/stl_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = seg; _Args = {}]':
/usr/include/c++/10/bits/stl_uninitialized.h:567:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = seg*; _Size = long unsigned int; bool _TrivialValueType = false]'
/usr/include/c++/10/bits/stl_uninitialized.h:623:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = seg*; _Size = long unsigned int]'
/usr/include/c++/10/bits/stl_uninitialized.h:685:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&) [with _ForwardIterator = seg*; _Size = long unsigned int; _Tp = seg]'
/usr/include/c++/10/bits/vector.tcc:627:35:   required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = seg; _Alloc = std::allocator<seg>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
/usr/include/c++/10/bits/stl_vector.h:940:4:   required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = seg; _Alloc = std::allocator<seg>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
teams.cpp:22:13:   required from here
/usr/include/c++/10/bits/stl_construct.h:109:7: error: no matching function for call to 'seg::seg()'
  109 |     { ::new(static_cast<void*>(__p)) _Tp(std::forward<_Args>(__args)...); }
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teams.cpp:17:3: note: candidate: 'seg::seg(int, int)'
   17 |   seg(int A, int B) {a = A; b = B;}
      |   ^~~
teams.cpp:17:3: note:   candidate expects 2 arguments, 0 provided
teams.cpp:14:8: note: candidate: 'constexpr seg::seg(const seg&)'
   14 | struct seg {
      |        ^~~
teams.cpp:14:8: note:   candidate expects 1 argument, 0 provided
teams.cpp:14:8: note: candidate: 'constexpr seg::seg(seg&&)'
teams.cpp:14:8: note:   candidate expects 1 argument, 0 provided