Submission #996651

# Submission time Handle Problem Language Result Execution time Memory
996651 2024-06-11T03:35:39 Z ezzzay Sails (IOI07_sails) C++14
0 / 100
1000 ms 5824 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=2e6+5;
int h[N];
signed main(){
    int n;
    cin>>n;
    vector<pair<int,int>>vc;
    for(int i=1;i<=n;i++){
        int m,k;
        cin>>m>>k;
        vc.pb({m,k});
        
    }
    sort(vc.begin(),vc.end());
    for(auto p:vc){
        int m= p.ff;
        int k= p.ss;
        
        vector<pair<int,int>>v;
        for(int j=m;j>=1;j--){
            v.pb({-h[j], -j});
        }
        sort(v.begin(),v.end());
        for(int j=0;j<k;j++){
            int idx=v[j].ss *-1;
            h[idx]++;
        }
    }
    int k=0;
    for(int i=1;i<=2e6;i++){
        k+= (h[i]-1)*(h[i])/2;
    }
    cout<<k;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 174 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 1532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 1588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 1620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 5824 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 2500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 2748 KB Time limit exceeded
2 Halted 0 ms 0 KB -