제출 #578889

#제출 시각아이디문제언어결과실행 시간메모리
578889Trisanu_DasLjeto (COCI21_ljeto)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ++ +=100 int main(){ int n; cin >> n; int a[n][3]; for(int i = 0; i < n; i++) cin >> a[n][0] >> a[n][1] >> a[n][2]; vector<int> moves(8, INT_MIN); sort(a, a + sizeof(a)); int pa = 0, pb = 0; for(int i = 0; i < n; i++){ if(a[i][1] <= 4){ pa++; if(moves[a[i][1]] + 10 >= a[i][0]) pa += 50; moves[a[i][1]] = a[i][0]; }else{ pb++; if(moves[a[i][1]] + 10 >= a[i][0]) pb += 50; moves[a[i][1]] = a[i][0]; } } cout << pa << ' ' << pb << '\n'; }

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

Main.cpp:3:9: error: macro names must be identifiers
    3 | #define ++ +=100
      |         ^~
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/10/bits/stl_algo.h:1886:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1977:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:4859:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[3]]'
Main.cpp:10:24:   required from here
/usr/include/c++/10/bits/stl_algo.h:1849:3: error: array must be initialized with a brace-enclosed initializer
 1849 |   __val = _GLIBCXX_MOVE(*__i);
      |   ^~~~~
/usr/include/c++/10/bits/stl_algo.h:1851:17: error: invalid array assignment
 1851 |        *__first = _GLIBCXX_MOVE(__val);
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algo.h:61,
                 from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/usr/include/c++/10/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/10/bits/stl_algo.h:1666:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1937:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1953:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int (*)[3]; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1974:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:4859:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[3]]'
Main.cpp:10:24:   required from here
/usr/include/c++/10/bits/stl_heap.h:354:15: error: array must be initialized with a brace-enclosed initializer
  354 |    _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
      |               ^~~~~~~
/usr/include/c++/10/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/10/bits/stl_algo.h:1669:19:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1937:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1953:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int (*)[3]; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:1974:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int (*)[3]; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:4859:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int (*)[3]]'
Main.cpp:10:24:   required from here
/usr/include/c++/10/bits/stl_heap.h:261:18: error: array must be initialized with a brace-enclosed initializer
  261 |       _ValueType __value = _GLIBCXX_MOVE(*__result);
      |                  ^~~~~~~
/usr/include/c++/10/bits/stl_heap.h:262:17: error: invalid array assignment
  262 |       *__result = _GLIBCXX_MOVE(*__first);
      |                 ^