답안 #875324

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
875324 2023-11-19T06:30:09 Z serifefedartar Vudu (COCI15_vudu) C++17
0 / 140
94 ms 33836 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll LOGN = 20; 
const ll MAXN = 5e5 + 100;
#define int long long

vector<int> A;
tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> s;
int pref[MAXN];

signed main() {
	fast
	int N, P;
	cin >> N;

	A = vector<int>(N+1);
	for (int i = 1; i <= N; i++)
		cin >> A[i];
	for (int i = 1; i <= N; i++)
		pref[i] = pref[i-1] + A[i];
	cin >> P;

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += s.order_of_key(make_pair(P * i - pref[i] + P, i));
		s.insert(make_pair(P * i - pref[i-1], i));
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1116 KB Output isn't correct
2 Incorrect 2 ms 860 KB Output isn't correct
3 Incorrect 2 ms 860 KB Output isn't correct
4 Runtime error 89 ms 33100 KB Execution killed with signal 11
5 Runtime error 51 ms 22356 KB Execution killed with signal 11
6 Runtime error 79 ms 30176 KB Execution killed with signal 11
7 Runtime error 79 ms 31216 KB Execution killed with signal 11
8 Runtime error 69 ms 28176 KB Execution killed with signal 11
9 Runtime error 94 ms 33836 KB Execution killed with signal 11
10 Runtime error 76 ms 30548 KB Execution killed with signal 11