답안 #946455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946455 2024-03-14T16:44:35 Z Mohamed_Kachef06 Vudu (COCI15_vudu) C++17
112 / 140
467 ms 65536 KB
#include <bits/extc++.h>
#define int long long 
using namespace std; 
using namespace __gnu_pbds; 
int const mxN = 3e5+5;


signed main() {
   ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
   
   int n,p, ans = 0;
   cin>>n;
   int a[n+1];
   for(int i=0; i<n; i++) cin>>a[i];
   cin>>p;
   tree<int,null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> st;
   st.insert(p);
   for(int i=0; i<n; i++) {
      a[i] += (i? a[i-1]:0);
      int x = a[i] - p*i;
      ans += st.order_of_key(x+1);
      st.insert(x);
   }
   cout<<ans;
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 860 KB Output is correct
2 Correct 2 ms 860 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Runtime error 467 ms 65536 KB Execution killed with signal 9
5 Correct 240 ms 44008 KB Output is correct
6 Correct 408 ms 65536 KB Output is correct
7 Correct 414 ms 65536 KB Output is correct
8 Correct 371 ms 62036 KB Output is correct
9 Runtime error 384 ms 65536 KB Execution killed with signal 9
10 Correct 398 ms 65536 KB Output is correct