답안 #648975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648975 2022-10-08T21:21:47 Z tvladm2009 Vudu (COCI15_vudu) C++14
0 / 140
416 ms 65536 KB
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T> using oset = tree<T, null_type, std::less<T>, rb_tree_tag,tree_order_statistics_node_update>;

int const nmax = 1000000;

long long v[5 + nmax], sp[5 + nmax];

signed main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);

  long long n, p;
  std::cin >> n;
  for(int i = 1;i <= n; i++)
    std::cin >> v[i];
  std::cin >> p;
  for(int i = 1;i <= n; i++) {
    v[i] -= p;
    sp[i] = sp[i - 1] + v[i];
  }

  //oset<long long> s;
  //s.insert(0);
  long long ans = 0;
  //for(int i = 1;i <= n; i++) {
    // ans += s.order_of_key(sp[i]);
    // s.insert(sp[i]);
  //}
  std::map<long long, long long> mp;
  mp[0]++;
  for(int i = 1;i <= n; i++) {
    ans += mp.count(sp[i]);
    mp[sp[i]]++;
  }
  std::cout << ans;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 852 KB Output isn't correct
2 Incorrect 3 ms 724 KB Output isn't correct
3 Incorrect 2 ms 724 KB Output isn't correct
4 Runtime error 380 ms 65536 KB Execution killed with signal 9
5 Incorrect 233 ms 43120 KB Output isn't correct
6 Runtime error 416 ms 65536 KB Execution killed with signal 9
7 Runtime error 321 ms 65536 KB Execution killed with signal 9
8 Incorrect 349 ms 60656 KB Output isn't correct
9 Runtime error 383 ms 65536 KB Execution killed with signal 9
10 Runtime error 342 ms 65536 KB Execution killed with signal 9