제출 #1317455

#제출 시각아이디문제언어결과실행 시간메모리
1317455midariTenis (COCI20_tenis)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int main() { int n; cin>>n; int r[n][3],x; for (int j=0;j<3;j++) for (int i=0;i<n;i++) { cin>>x; r[x-1][j]=i; } vector<int> bestr(n); for (int i=0;i<n;i++) { int mn=r[i][0]; for (int j=1;j<3;j++) mn=min(mn,r[i][j]); bestr[mn].push_back(i); } int wins[n],court[3]={},cnt=0; for (int i=n-1;i>=0;i--) { for (int j:bestr[i]) wins[j]=cnt; cnt+=bestr[i].size(); for (int j=0;j<bestr[i].size();j++) for (int k=j+1;k<bestr[i].size();k++) { int cor=-1,mn=n; for (int c=0;c<3;c++) { if (r[bestr[i][j]][c]>i && r[bestr[i][k]][c]>i) continue; if (r[bestr[i][j]][c]==i) if (mn>r[bestr[i][k]][c]) cor=c,mn=r[bestr[i][k]][c]; if (r[bestr[i][k]][c]==i) if (mn>r[bestr[i][j]][c]) cor=c,mn=r[bestr[i][j]][c]; } court[cor]++; if (r[bestr[i][j]][cor]==i) wins[bestr[i][j]]++; else wins[bestr[i][k]]++; } } cnt=0; int idk[3][3]={},bst[3]={}; for (int i=n-1;i>=0;i--) { for (int j:bestr[i]) { vector<int> v; for (int c=0;c<3;c++) if (r[j][c]==i) v.push_back(c); if (v.size()==1) court[v[0]]+=cnt; else if(v.size()==2) { court[v[0]]+=idk[v[0]][v[1]]; court[v[1]]+=idk[v[1]][v[0]]; } else { for (int k:v) court[k]+=bst[k]; } } for (int j:bestr[i]) { for (int c=0;c<3;c++) for (int c1=0;c1<3;c1++) { if (c==c1 || r[j][c]>r[j][c1]) continue; if (r[j][c]<r[j][c1]) idk[c][c1]++; else if(c<c1) idk[c][c1]++; } int cor; for (int c=2;c>=0;c--) if (r[j][c]==i) cor=c; bst[cor]++; } cnt+=bestr[i].size(); } for (int j=0;j<3;j++) cout<<court[j]<<' '; cout<<endl; for (int j=0;j<n;j++) cout<<wins[j]<<' '; cout<<endl; return 0; }

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

cc1plus: error: '::main' must return 'int'
tenis.cpp: In function 'int main()':
tenis.cpp:24:27: error: request for member 'push_back' in 'bestr.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)mn))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   24 |                 bestr[mn].push_back(i);
      |                           ^~~~~~~~~
tenis.cpp:29:35: error: 'begin' was not declared in this scope
   29 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:29:35: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166,
                 from tenis.cpp:1:
/usr/include/c++/13/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/13/bits/ranges_algobase.h:38,
                 from /usr/include/c++/13/bits/ranges_algo.h:38,
                 from /usr/include/c++/13/algorithm:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/ranges_base.h:489:44: note:   'std::ranges::__cust::begin'
  489 |     inline constexpr __cust_access::_Begin begin{};
      |                                            ^~~~~
In file included from /usr/include/c++/13/filesystem:50,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200:
/usr/include/c++/13/bits/fs_dir.h:607:3: note:   'std::filesystem::__cxx11::begin'
  607 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
In file included from /usr/include/c++/13/bits/stl_iterator_base_types.h:71,
                 from /usr/include/c++/13/bits/stl_algobase.h:65,
                 from /usr/include/c++/13/algorithm:60:
/usr/include/c++/13/bits/iterator_concepts.h:984:10: note:   'std::ranges::__cust_access::begin'
  984 |     void begin(const auto&) = delete;
      |          ^~~~~
tenis.cpp:29:35: error: 'end' was not declared in this scope
   29 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:29:35: note: suggested alternatives:
/usr/include/c++/13/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/13/bits/ranges_base.h:490:42: note:   'std::ranges::__cust::end'
  490 |     inline constexpr __cust_access::_End end{};
      |                                          ^~~
/usr/include/c++/13/bits/fs_dir.h:612:3: note:   'std::filesystem::__cxx11::end'
  612 |   end(recursive_directory_iterator) noexcept
      |   ^~~
/usr/include/c++/13/bits/ranges_base.h:137:10: note:   'std::ranges::__cust_access::end'
  137 |     void end(const auto&) = delete;
      |          ^~~
tenis.cpp:31:31: error: request for member 'size' in 'bestr.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   31 |                 cnt+=bestr[i].size();
      |                               ^~~~
tenis.cpp:32:41: error: request for member 'size' in 'bestr.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   32 |                 for (int j=0;j<bestr[i].size();j++)
      |                                         ^~~~
tenis.cpp:33:51: error: request for member 'size' in 'bestr.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   33 |                         for (int k=j+1;k<bestr[i].size();k++)
      |                                                   ^~~~
tenis.cpp:38:55: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   38 |                                         if (r[bestr[i][j]][c]>i && r[bestr[i][k]][c]>i)
      |                                                       ^
tenis.cpp:38:78: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   38 |                                         if (r[bestr[i][j]][c]>i && r[bestr[i][k]][c]>i)
      |                                                                              ^
tenis.cpp:40:55: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   40 |                                         if (r[bestr[i][j]][c]==i)
      |                                                       ^
tenis.cpp:41:66: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   41 |                                                 if (mn>r[bestr[i][k]][c])
      |                                                                  ^
tenis.cpp:42:76: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   42 |                                                         cor=c,mn=r[bestr[i][k]][c];
      |                                                                            ^
tenis.cpp:43:55: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   43 |                                         if (r[bestr[i][k]][c]==i)
      |                                                       ^
tenis.cpp:44:66: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   44 |                                                 if (mn>r[bestr[i][j]][c])
      |                                                                  ^
tenis.cpp:45:76: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   45 |                                                         cor=c,mn=r[bestr[i][j]][c];
      |                                                                            ^
tenis.cpp:48:47: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   48 |                                 if (r[bestr[i][j]][cor]==i)
      |                                               ^
tenis.cpp:49:54: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   49 |                                         wins[bestr[i][j]]++;
      |                                                      ^
tenis.cpp:51:54: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[long long int]' for array subscript
   51 |                                         wins[bestr[i][k]]++;
      |                                                      ^
tenis.cpp:58:35: error: 'begin' was not declared in this scope
   58 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:58:35: note: suggested alternatives:
/usr/include/c++/13/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/13/bits/ranges_base.h:489:44: note:   'std::ranges::__cust::begin'
  489 |     inline constexpr __cust_access::_Begin begin{};
      |                                            ^~~~~
/usr/include/c++/13/bits/fs_dir.h:607:3: note:   'std::filesystem::__cxx11::begin'
  607 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
/usr/include/c++/13/bits/iterator_concepts.h:984:10: note:   'std::ranges::__cust_access::begin'
  984 |     void begin(const auto&) = delete;
      |          ^~~~~
tenis.cpp:58:35: error: 'end' was not declared in this scope
   58 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:58:35: note: suggested alternatives:
/usr/include/c++/13/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/13/bits/ranges_base.h:490:42: note:   'std::ranges::__cust::end'
  490 |     inline constexpr __cust_access::_End end{};
      |                                          ^~~
/usr/include/c++/13/bits/fs_dir.h:612:3: note:   'std::filesystem::__cxx11::end'
  612 |   end(recursive_directory_iterator) noexcept
      |   ^~~
/usr/include/c++/13/bits/ranges_base.h:137:10: note:   'std::ranges::__cust_access::end'
  137 |     void end(const auto&) = delete;
      |          ^~~
tenis.cpp:77:35: error: 'begin' was not declared in this scope
   77 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:77:35: note: suggested alternatives:
/usr/include/c++/13/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/13/bits/ranges_base.h:489:44: note:   'std::ranges::__cust::begin'
  489 |     inline constexpr __cust_access::_Begin begin{};
      |                                            ^~~~~
/usr/include/c++/13/bits/fs_dir.h:607:3: note:   'std::filesystem::__cxx11::begin'
  607 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
/usr/include/c++/13/bits/iterator_concepts.h:984:10: note:   'std::ranges::__cust_access::begin'
  984 |     void begin(const auto&) = delete;
      |          ^~~~~
tenis.cpp:77:35: error: 'end' was not declared in this scope
   77 |                 for (int j:bestr[i])
      |                                   ^
tenis.cpp:77:35: note: suggested alternatives:
/usr/include/c++/13/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/13/bits/ranges_base.h:490:42: note:   'std::ranges::__cust::end'
  490 |     inline constexpr __cust_access::_End end{};
      |                                          ^~~
/usr/include/c++/13/bits/fs_dir.h:612:3: note:   'std::filesystem::__cxx11::end'
  612 |   end(recursive_directory_iterator) noexcept
      |   ^~~
/usr/include/c++/13/bits/ranges_base.h:137:10: note:   'std::ranges::__cust_access::end'
  137 |     void end(const auto&) = delete;
      |          ^~~
tenis.cpp:95:31: error: request for member 'size' in 'bestr.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   95 |                 cnt+=bestr[i].size();
      |                               ^~~~