Submission #1101253

# Submission time Handle Problem Language Result Execution time Memory
1101253 2024-10-15T22:56:03 Z andro Sails (IOI07_sails) C++14
30 / 100
1000 ms 5696 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int,int>> a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin() + 1, a.end());
    vector<int> cnt(n + 1, 0);
    for(int i = 1; i <= n; i++) {
        vector<pair<int,int>> upd;
        for(int j = 1; j <= a[i].first; j++) {
            upd.push_back({cnt[j], j});
        }
        sort(upd.begin(), upd.end());
        for(int j = 0; j < a[i].second; j++) {
            cnt[upd[j].second] += 1;
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        ans += cnt[i] * (cnt[i] - 1);
    }
    ans /= 2;
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 7 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1588 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 3092 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1032 ms 1880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 5696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 2848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 3232 KB Time limit exceeded
2 Halted 0 ms 0 KB -