Submission #158252

# Submission time Handle Problem Language Result Execution time Memory
158252 2019-10-15T19:07:28 Z brcode Pairs (IOI07_pairs) C++14
0 / 100
77 ms 1224 KB
#include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
const int MAXN = 2e5+5;
long long ans;
stack<int> s1;
int arr[MAXN];
int main(){
    int b,n,d,m;
    cin>>b>>n>>d>>m;
    if(b==1){
        for(int i=1;i<=n;i++){
            cin>>arr[i];
        }
        sort(arr+1,arr+n+1);
        for(int i=1;i<=n;i++){

            while(s1.size() && s1.top()<arr[i]-d){
                s1.pop();
            }
            ans+=(s1.size());
            s1.push(arr[i]);
        }
        cout<<ans<<endl;

    }

}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 1120 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 1224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -