답안 #681462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681462 2023-01-13T06:36:24 Z tegshzaya Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a,b,c[1000010],d,e,f,g,h,i,j,k,l;
map<ll> m;
main(){ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    cin>>a>>b;
    for (i=1; i<=a; i++)
    {cin>>h;
    if (m[h]==0) m[h]++,c[++l]=h;
    }
    for (i=1; i<=b; i++)
    {cin>>d>>e>>f;
        for (j=d; j<=e; j++)
        {
            for (k=j+1; k<=e; k++)
            if (c[j]>c[k]){if (c[j]+c[k]>f) {cout<<"0"<<" ";g=100; break;}}
        if (g==100) break;
        }
    if (g!=100){cout<<'1'<<" "; continue;}
    g=0;
    }
}

Compilation message

sortbooks.cpp:5:7: error: wrong number of template arguments (1, should be at least 2)
    5 | map<ll> m;
      |       ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from sortbooks.cpp:1:
/usr/include/c++/10/bits/stl_map.h:100:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  100 |     class map
      |           ^~~
sortbooks.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){ios::sync_with_stdio(false);
      | ^~~~
sortbooks.cpp: In function 'int main()':
sortbooks.cpp:12:10: error: invalid types 'int[int]' for array subscript
   12 |     if (m[h]==0) m[h]++,c[++l]=h;
      |          ^
sortbooks.cpp:12:19: error: invalid types 'int[int]' for array subscript
   12 |     if (m[h]==0) m[h]++,c[++l]=h;
      |                   ^