Submission #703061

# Submission time Handle Problem Language Result Execution time Memory
703061 2023-02-25T20:46:33 Z LucaLucaM Sails (IOI07_sails) C++17
5 / 100
1000 ms 3404 KB
#include <bits/stdc++.h>

using namespace std;

/**
luam fiecare sail in ordine crescatoare dupa inaltime:
luam cele mai putin frecvente k inaltimi
adunam la raspuns
**/

const int NMAX = 1e5;

struct sail
{
    int x, y;

    bool operator < (const sail aux) const
    {
        if (x == aux.x)
            return y > aux.y;
        return x < aux.x;
    }
};

sail a[NMAX + 5];

int f[NMAX + 5];


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    for (int i=1; i<=n; i++)
        cin >> a[i].x >> a[i].y;

    long long ans = 0;

    for (int i=1; i<=n; i++)
    {
        vector<pair<int, int>>v;
        for (int j=1; j<=a[i].x; j++)
            v.push_back({f[j], j});
        sort(v.begin(), v.end());

        for (int j=0; j<a[i].y; j++)
            ans += v[j].first, f[v[j].second]++;
    }

    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 232 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 303 ms 404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 1008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 1380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 1968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 3184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 3360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 3404 KB Time limit exceeded
2 Halted 0 ms 0 KB -