7382 | 2024. 01. 08 12:54:39 | CWM | Kártyajáték | cpp17 | Forditási hiba |
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
#define ll long long
int main()
{
ll i1;
int n;
cin >> i1 >> n;
vector<ll> ord(n);
ll max = -1;
vector<ll> maxVec;
for (size_t i = 0; i < n; i++)
{
ll a;
cin >> a;
ord[i] = a;
if (a > max) {
maxVec.push_back(a);
max = a;
}
}
sort(ord.begin(), ord.end());
int res = 0;
if (maxVec[0] != ord[0]) res++;
int insVec = 1;
for (size_t i = 0; i < ord.size(); i++)
{
if (ord[i] == maxVec[insVec]) {
if (i == ord.size() - 1) {
res++;
break;
}
if (ord[i + 1] != maxVec[insVec + 1]) {
res++;
}
insVec++;
}
}
cout << res;
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:26:5: error: 'sort' was not declared in this scope; did you mean 'short'?
26 | sort(ord.begin(), ord.end());
| ^~~~
| short
Exited with error status 1