답안 #949081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949081 2024-03-19T00:29:45 Z sondos225 Vudu (COCI15_vudu) C++17
0 / 140
1000 ms 25840 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define yes "YES"
#define no "NO"
#define bigg INT_MAX
#define debug(x) cout<<(#x)<<" = " <<x<<endl;
#define all(x) x.begin(),x.end()
#define sz size()
#define nn '\n'
#define mms(x,y) memset(x,y,sizeof(x))
#define forr(i,j,n) for (int i=j; i<n; i++)
#define forn(i,j,n) for (int i=j; i>n; i--)
#define fi first
#define se second
#define la "LA"
#define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i];
#define pii pair<int,int>
signed main()
{
//    #ifndef LOCAL
//    freopen("lifeguards.in","r",stdin);
//    freopen("lifeguards.out","w", stdout);
//    #endif
    fast
    int n;
    cin>>n;
    int a[n];
    forr(i,0,n) cin>>a[i];
    int p;
    cin>>p;
    int sm[n];
    sm[0]=a[0];
    //int b[n];
    //b[0]=sm[0];
    vector<int> s;
    s.pb(0);
    s.pb(a[0]-p);

    int ans=0;
    forr(i,1,n)
    {
        sm[i]=sm[i-1]+a[i];
        int x=sm[i]-(p*(i+1));
s.pb(x);
        sort(all(s));
        //cout<<no<<x<<endl;
       // for(auto y:s) cout<<la<<y<<endl;
        int w=(lower_bound(all(s),x+1)-s.begin());
        w--;
       // int d=
      // if (w==s.sz) w=0;
     // w++;

      // cout<<w<<endl;
        ans+=max(0ll,w);


      //  b[i]=;
    }
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1059 ms 912 KB Time limit exceeded
2 Incorrect 435 ms 600 KB Output isn't correct
3 Incorrect 514 ms 592 KB Output isn't correct
4 Execution timed out 1047 ms 24948 KB Time limit exceeded
5 Execution timed out 1038 ms 14420 KB Time limit exceeded
6 Execution timed out 1028 ms 22408 KB Time limit exceeded
7 Execution timed out 1047 ms 23076 KB Time limit exceeded
8 Execution timed out 1075 ms 20076 KB Time limit exceeded
9 Execution timed out 1084 ms 25840 KB Time limit exceeded
10 Execution timed out 1103 ms 22488 KB Time limit exceeded