Submission #114237

# Submission time Handle Problem Language Result Execution time Memory
114237 2019-05-31T13:36:34 Z nvmdava Sails (IOI07_sails) C++17
0 / 100
1000 ms 1624 KB
#include <bits/stdc++.h>
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
#define N 100005

int cnt[N];

vector<pii> fru;

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

    int n;
    cin>>n;
    int now = 1;
    fru.resize(n);
    for(int i = 0; i < n; i++)
        cin>>fru[i].ff>>fru[i].ss;
    sort(fru.begin(), fru.end());

    for(auto s : fru){
        while(s.ss--){
            if(now > s.ff) now = 1;
            cnt[now++]++;
        }
    }

    long long res = 0;

    for(int i = 0; i < N; i++){
        res += 1LL * cnt[i] * (cnt[i] - 1) / 2;
    }
    cout<<res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 419 ms 820 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 555 ms 1056 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 1472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 1584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 1624 KB Time limit exceeded
2 Halted 0 ms 0 KB -