Submission #237304

# Submission time Handle Problem Language Result Execution time Memory
237304 2020-06-05T19:42:52 Z marlicu Unija (COCI17_unija) C++14
60 / 100
379 ms 23256 KB
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define X first
#define Y second

typedef pair <int, int> pii;

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

    int n;
    cin>> n;

    vector <pii> v;
    v.resize(n);

    for (int i = 0; i < n; i++) {
        cin >> v[i].X >> v[i].Y;
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    long long povrsina = 0;
    int maks = 0;

    for (int i = 0; i < n; i++) {
        if (v[i].Y > maks) {
            povrsina += (v[i].Y - maks) * v[i].X;
            maks = v[i].Y;
        }
    }

    cout << povrsina;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 23256 KB Output is correct
2 Correct 360 ms 23220 KB Output is correct
3 Correct 355 ms 23160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 6776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 362 ms 23208 KB Output isn't correct
2 Halted 0 ms 0 KB -