답안 #950149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
950149 2024-03-20T05:55:29 Z vjudge1 Vudu (COCI15_vudu) C++17
42 / 140
1000 ms 19904 KB
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std;
using namespace __gnu_pbds; 
 
#define int long long
#define ff first
#define ss second
#define rep(i,s,f) for(int i = s;i < f;i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> 

const int N = 1e3 + 1;
const double INF = 1e18;
const int prime = 31,m = 1e9 + 9,MOD7 = 1e9 + 7;

int binpow(int n,int k){	
	if(k == 0){
		return 1 ;
	} else if(k % 2 == 0){
		int b = binpow(n,k / 2);
		return b * b ;
	} else{
		return n * binpow(n,k - 1) ;
	}

}

void solve(){
	
	int n;
	cin >> n;
	int a[n];
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	int x;
	cin >> x;
	int pref[n + 1];
	pref[0] = 0;
	for(int i = 0;i < n;i++){
		pref[i + 1] = pref[i] + a[i];
	}
	int cnt = 0;
	for(int i = 0;i < n;i++){
		for(int j = i;j < n;j++){
			if((pref[j + 1] - pref[i]) / (j - i + 1) >= x){
				cnt++;
			}
		}
	}
	cout << cnt;
	
}

signed main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	
	int t = 1;
	//~ cin >> t;
	while(t--){
		solve();
	}
	
}
	
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 348 KB Output is correct
2 Correct 102 ms 520 KB Output is correct
3 Correct 94 ms 348 KB Output is correct
4 Execution timed out 1091 ms 19284 KB Time limit exceeded
5 Execution timed out 1012 ms 10320 KB Time limit exceeded
6 Execution timed out 1004 ms 16760 KB Time limit exceeded
7 Execution timed out 1012 ms 17812 KB Time limit exceeded
8 Execution timed out 1103 ms 15440 KB Time limit exceeded
9 Execution timed out 1091 ms 19904 KB Time limit exceeded
10 Execution timed out 1086 ms 16912 KB Time limit exceeded