Submission #991570

# Submission time Handle Problem Language Result Execution time Memory
991570 2024-06-02T13:29:58 Z Alfraganus Sails (IOI07_sails) C++17
0 / 100
25 ms 13320 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define str string
#define endl '\n'
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define print(a)          \
    for (auto x : a)      \
        cout << x << ' '; \
    cout << endl;

#define printmp(a)   \
    for (auto x : a) \
        cout << x[0] << ' ' << x[1] << endl;

const int mod = 998244353;

void solve(){
    int n;
    cin >> n;
    vector<array<int, 2>> a(n);
    for(int i = 0; i < n; i ++)
        cin >> a[i][0] >> a[i][1];
    vector<int> cnt(200001);
    int ans = 0;
    for(int i = n - 1; i >= 0; i --){
        vector<array<int, 2>> b;
        for(int j = 0; j < a[i][0]; j ++)
            b.push_back({cnt[j], a[i][0] - j});
        sort(all(b));
        for(int j = 0; j < a[i][1]; j ++)
            ans = ans + b[j][0], cnt[a[i][j] - b[j][1]] ++;
    }
    cout << ans;
}

signed main()
{
    fastio;
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 3672 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 3676 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 3676 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 3928 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 4568 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 4956 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 6108 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 13320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 8148 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 9684 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -