답안 #948025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948025 2024-03-17T13:44:17 Z Zena_Hossam Vudu (COCI15_vudu) C++14
0 / 140
1000 ms 55768 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
using namespace std;
namespace __gnu_pbds
{
typedef tree<ll,
        null_type,
        less_equal<ll>,
        rb_tree_tag,
        tree_order_statistics_node_update> ordered_set;
}
using namespace __gnu_pbds;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double

#define ll1 long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int arr[1000001];ordered_set s;int x;ll c=0,ss=0,cc;int n;int i,j;
int main()
{
    //freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout);
    //cin>>T;ll oo=0;

        cin>>n;
        for(i=0; i<n; i++)
        {
            cin>>arr[i];
        }

        cin>>x;
        for(i=0; i<n; i++)
        {

            ss+=(arr[i]-x);
           // cout<<c<<" ";
           cc=0;
           for(j=0;j<=min(i,1000);j++){ cc+=(arr[j]-x);
            if(cc<ss+1)c++;
           }
            c+=(s.order_of_key(ss+1));
            if(ss>=0)c++;
            if(i>1000)
            s.insert(ss);
           // cout<<c<<"\n";
        }
        cout<<c;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 860 KB Output isn't correct
2 Incorrect 7 ms 604 KB Output isn't correct
3 Incorrect 8 ms 604 KB Output isn't correct
4 Execution timed out 1099 ms 48568 KB Time limit exceeded
5 Incorrect 743 ms 36820 KB Output isn't correct
6 Execution timed out 1067 ms 52240 KB Time limit exceeded
7 Execution timed out 1057 ms 53116 KB Time limit exceeded
8 Execution timed out 1029 ms 51672 KB Time limit exceeded
9 Execution timed out 1058 ms 55768 KB Time limit exceeded
10 Execution timed out 1054 ms 50656 KB Time limit exceeded