답안 #257081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
257081 2020-08-03T15:18:18 Z uacoder123 Vudu (COCI15_vudu) C++14
112 / 140
714 ms 65540 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
  
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
  ordered_set se;
  lli arr[1000001];
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lli n,k,co=0,cs=1,ans=0;
  cin>>n;
  for(lli i=0;i<n;++i)
    cin>>arr[i];
  cin>>k;
  for(lli i=0;i<n;++i)
  {
    arr[i]-=k;
    cs+=arr[i];
    se.insert(mp(arr[i]-cs,co));
    ans+=se.size()-se.order_of_key(mp(-cs,0*1LL));
    co++;
  }
  cout<<ans<<endl;
  return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 896 KB Output is correct
2 Correct 3 ms 768 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
4 Runtime error 714 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Correct 363 ms 38904 KB Output is correct
6 Correct 616 ms 60636 KB Output is correct
7 Correct 595 ms 63344 KB Output is correct
8 Correct 524 ms 54780 KB Output is correct
9 Runtime error 590 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Correct 602 ms 61560 KB Output is correct