8019 2024. 01. 12 10:29:54 Boti Áruszállítás üres szakaszai csharp Forditási hiba
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a (m);
    vector<int> b (m);
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
    }
    int c = 0;
    int temp;
    for (int i = 0; i < m; i++)
    {
        for (int j = m -1; j > i; j--)
        {
            if (a[j] < a[j -1])
            {
                temp = a[j];
                a[j] = a[j -1];
                a[j -1] = temp;
                temp = b[j];
                b[j] = b[j -1];
                b[j -1] = temp;
            }
            else if (a[j] == a[j -1] && b[j] < b[j -1])
            {
                temp = a[j];
                a[j] = a[j -1];
                a[j -1] = temp;
                temp = b[j];
                b[j] = b[j -1];
                b[j -1] = temp;
            }
        }
    }
    int e = 0;
    for (int i = 1; i <= n; i++)
    {
        while (b[e] < i)
        {
            e++;
        }
        if (a[e] > i)
        {
            c++;
        }
    }
    /*for (int i = 0; i < m; i++)
    {
        cout << a[i] << " - " << b[i] << endl;
    }*/
    cout << c;
    return 0;
}
Forditási hiba
exit status 1
main.cs(2,0): error CS1024: Wrong preproces