Submission #1327855


Source Code Expand

Copy
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;
int64_t K;
int64_t a[200001];
int64_t v[200001];

//i以降からとる
int32_t func(int i, int now)
{
	if (i >= N) {
		return now >= 0 ? 1 : 0;
	}
	return func(i + 1, now + a[i]) + (now >= 0 ? 1 : 0);
}

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N >> K;
	for (int32_t i = 1; i <= N; ++i)
	{
		in >> a[i];
		a[i] -= K;
	}
	for (int32_t i = 1; i <= N; ++i)
	{
		a[i] += a[i - 1];
	}

	int64_t count = 0;
	auto v_end = v + 1;
	v[0] = 0;
	for (int32_t i = 1; i <= N; ++i)
	{
		count += std::upper_bound(v, v_end, a[i])-v;
		*v_end++ = a[i];
	}
	/*
	for (int32_t num = 1; num <= N; ++num)
	{
		for (int32_t i = num; i <= N; ++i)
		{
			if ((a[i] - a[i - num]) >= 0) {
				++count;
			}
		}
	}
	*/

	out << count << endl;

	return 0;
}
#endif

Submission Info

Submission Time
Task E - Meaningful Mean
User eiya
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1299 Byte
Status
Exec Time 231 ms
Memory 3456 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03
All 0 / 600 a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23
Case Name Status Exec Time Memory
a01 1 ms 256 KB
a02 1 ms 256 KB
a03 1 ms 256 KB
b04 1 ms 256 KB
b05 223 ms 3328 KB
b06 218 ms 3328 KB
b07 214 ms 3328 KB
b08 217 ms 3328 KB
b09 169 ms 3456 KB
b10 159 ms 3328 KB
b11 1 ms 256 KB
b12 2 ms 256 KB
b13 81 ms 1408 KB
b14 227 ms 3328 KB
b15 96 ms 3328 KB
b16 225 ms 3328 KB
b17 231 ms 3328 KB
b18 225 ms 3328 KB
b19 223 ms 3328 KB
b20 222 ms 3328 KB
b21 214 ms 3328 KB
b22 214 ms 3328 KB
b23 218 ms 3328 KB