9307 | 2024-02-20 11:56:55 | Ablablabla | Ládapakolás raktárban (50) | csharp | Compilation error |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
set<int> benne;
int osszeg = 0;
int b = 0;
bool jo = 1;
int db = 1;
for(int i = 0; i < n; i++){
int a;
cin >> a;
if(!jo && a > b || a + osszeg > m || benne.count(a)){
db++;
jo = 1;
benne.clear();
osszeg = 0;
} else{
if(a < b) jo = 0;
}
b = a;
benne.insert(a);
osszeg += a;
}
cout << n - db << "\n";
}
exit status 1
main.cs(2,0): error CS1024: Wrong preproces