Submission #1101251

# Submission time Handle Problem Language Result Execution time Memory
1101251 2024-10-15T22:36:07 Z andro Sails (IOI07_sails) C++17
15 / 100
1000 ms 2900 KB
#include <bits/stdc++.h>


using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> h(n + 1);
    vector<int> c(n + 1);
    for(int i = 1; i <= n; i++) {
        int u, v;
        cin >> u >> v;
        h[n - i + 1] = u;
        c[n - i + 1] = v;
    }
    int ans = 0;
    vector<int> M(n + 1, 0);
    for(int i = 1; i <= n; i++) {
        int br = 0;
        vector<int> mark(h[i] + 1, 0);
        while(c[i]--) {
            br += 1;
            //cout << "za :::" << i << "za" << br << " jedro stavljam na :::";
            int mn = n + 1;
            for(int j = h[i]; j >= 1; j--) {
                if(mark[j]) {
                    continue;
                }
                mn = min(mn, M[j]);
            }
            ans += mn;
            //cout << "stub ::: " << i << " za " << br << "jedro resenje min je::: {" << mn;
            for(int j = h[i]; j >= 1; j--) {
                if(mark[j]) {
                    continue;
                }
                if(M[j] == mn) {
                    M[j] += 1;
                    mark[j] = 1;
                    //cout << " " << j << "} \n";
                    break;
                }
            }
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 596 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 357 ms 848 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 1108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 1652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 2532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 2556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 2900 KB Time limit exceeded
2 Halted 0 ms 0 KB -