eolymp
bolt
Try our new interface for solving problems
Problems

Saucepans and lids

published at 12/28/16, 9:50:37 am

ВТФ почему 4, есди там 3 кршки

published at 1/25/17, 9:28:16 pm

<ВТФ почему 4, есди там 3 кршки>

"Крышка может покрыть кастрюлю, если только радиус крышки не меньше радиуса кастрюли."

published at 1/2/24, 8:54:34 pm

include <iostream>

include <algorithm>

using namespace std;

int main() { int n, m; cin >> n >> m;

int c = 1000;
int a[c], b[c];

for (int i = 0; i < n; i++) {
    cin >> a[i];
}

for (int i = 0; i < m; i++) {
    cin >> b[i];
}

sort(a, a + n);
sort(b, b + m);

int e = 0;
int g = 0;

for (int i = 0; i < n; i++) {
    while (g < m && b[g] < a[i]) {
        g++;
    }
    if (g == m) {
        break;
    }
    e++;
    g++;
}

cout << e << endl;

return 0;

}