/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 1ms 516.0 KiB
#3 Accepted 1ms 540.0 KiB
#4 Runtime Error Fatal glibc error: malloc.c:2599 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0) 2ms 796.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;

void solve(){
    int n; cin >> n;
    vector<int>v(n);
    for(int i=1; i<=n; i++){
        cin >> v[i];
    }
    int cnt=0;
    vector<int>cpy=v;
    sort(cpy.begin(), cpy.end());
    if(v!=cpy){
        cout << 0 << endl;
        return;
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            if(v[i]<v[j]){
                if(((v[i]*v[j])%mod)%(v[i]+v[j])==0){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
}

signed main(){
    ios_base::sync_with_stdio;
    cin.tie();
    cout.tie();
    //int t; cin >> t;
    //while(t--){
        solve();
    //}

}

Information

Submit By
Type
Submission
Problem
P1131 Count Special Pairs
Contest
LU IUJPC : Sylhet Division 2024, Mock Round
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-07 10:37:05
Judged At
2024-12-07 10:37:05
Judged By
Score
30
Total Time
2ms
Peak Memory
796.0 KiB