Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; inline int lowbit(int x) { return x & (-x); } long long getsum(vector<long long> &V, int pos) { long long ret = 0; for (; pos; pos -= lowbit(pos)) ret += V[pos]; return ret; } void add(vector<long long> &V, int pos, int k) { for (; pos < (int)V.size(); pos += lowbit...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int x[N]; long long ans; pair<int, int> a[N]; int main(void) { std::ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i].second, x[i] = a[i].second; for (int i = 0; i < n; i++) cin >> a[i].first; sort(a, a...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int b[200005], m; long long tr[800005][2]; struct node { int x, v; bool operator<(const node t) const { return x < t.x; } } a[200005]; int lsh(long long x) { return lower_bound(b + 1, b + 1 + m, x) - b; } long long query(int l, int r, int x, int y, int k, int p) { if ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long int infinity = 9e18; pair<long long int, long long int> t1[4 * 200005] = {}; pair<long long int, long long int> t2[4 * 200005] = {}; struct SegmentTree { void update(pair<long long int, long long int> t[], int v, int tl, int tr, int pos, int ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n; int b[maxn]; struct node { int x, v; } a[maxn]; bool cmp(node q1, node q2) { return q1.v == q2.v ? q1.x < q2.x : q1.v < q2.v; } struct BIT { long long c[maxn][2]; void init() { memset(c, 0, sizeof(c)); } int lowbit(int x) { return x ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; pair<int, int> p[maxn]; int n; long long d[maxn]; long long e[maxn]; void add(long long *c, int i, int k) { while (i <= n) { c[i] += k; i += i & (-i); } } long long sum(long long *c, int i) { long long res = 0; while (i > 0) { r...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int II() { int q; scanf("%d", &q); return q; } long long LII() { long long q; scanf("%lld", &q); return q; } const long long Mx = 200005; long long N; vector<long long> tree[Mx * 4], cum[Mx * 4]; vector<pair<long long, long long> > v(Mx + 1); void update(long lo...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using db = double; using vi = vector<int>; const int inf = 0x3f3f3f3f; const db eps = 1e-8; const int mod = 1e9 + 7; ll qpow(ll a, ll b) { ll ret = 1; while (a) { if (b & 1) ret = ret * a % mod; a = a * a % mod; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long maxn = 200010; const long long N = 200000; long long n; struct Node { long long v, x; bool operator<(const Node& b) const { return x < b.x; } } p[maxn]; struct BIT { long long b[maxn]; inline long long lowbit(long long x) { return x & (-x); } void ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; const int N = 2e5 + 2; const int inf = 2e9; const long long linf = 4e18; long long val[N], cnt[N]; void upd(int x, long long v) { int z = 0; if (v < 0) z--; else z++; for (; x < N; x += x & (-x)) { cnt[x] += z; val[x]...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> struct fen { vector<T> fenwick; long long size; fen(long long sz) { size = sz; fenwick.resize(size); for (long long i = 0; i < size; i++) fenwick[i] = 0; } fen(vector<T> arr) { size = arr.size(); fenwick.resize(size); for...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long int get(vector<long long int> &arr, long long int ind, long long int n) { long long int ans = 0; for (; ind > 0; ind -= (ind & (-ind))) ans += arr[ind]; return ans; } void upd(vector<long long int> &arr, long long int ind, long long int x, ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
//package com.netease.music.codeforces.round624.div3; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * Created by dezhonger on 2020/2/27 */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> long double pi = acos(-1.0); const int mod = 1e9 + 7; using namespace std; const int N = 2e5 + 5; vector<long long> F(N), F2(N); long long sum(int r, vector<long long> &t) { long long result = 0; for (; r >= 0; r = (r & (r + 1)) - 1) result += t[r]; return result; } void inc(int i, long l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization("unroll-loops") using namespace std; using namespace chrono; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << "\n"; } template <typename Arg1, typename....
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct Point { long long x; long long v; }; vector<Point> points; long long SUM; void add_pairwise_dist(long long start, long long end) { int m, i, j; if (start == end) return; m = start + (end - start) / 2; add_pairwise_dist(start, m); add_pairwise_dist(m + 1...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 200000; int x[N + 5], v[N + 5], _v[N + 5]; pair<int, int> point[N + 5]; template <typename T, int N> struct Binary_Indexed_Tree { int n; T sumv[N + 5]; void init(int _n) { n = _n; memset(sumv, 0, (n + 4) * sizeof(T)); } void build(T A[], int ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys input = sys.stdin.readline from heapq import heappush, heappop, heapify def query(f, i): ret = 0 while i: ret += f[i] i -= (i & -i) return ret def update(f, i, d): n = len(f) while i < n: f[i] += d i += (i & -i) n = int(input()) X = list(map(int, input(...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> template <class C> inline void log_c(const C& c) {} template <class C> inline int sz(const C& c) { return static_cast<int>(c.size()); } using namespace std; using pii = pair<int, int>; using num = int64_t; using pll = pair<num, num>; const std::string eol = "\n"; using Ft = map<int, pair<int,...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, x[N], v[N]; vector<pair<int, int>> p; long long bit1[N], bit2[N], ans; void add(int p, int v, long long *bit) { for (p += 2; p < N; p += p & -p) bit[p] += v; } long long query(int p, long long *bit) { long long r = 0; for (p += 2; p; p -=...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys, math import io, os #data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline #from bisect import bisect_left as bl, bisect_right as br, insort #from heapq import heapify, heappush, heappop from collections import defaultdict as dd, deque, Counter #from itertools import permutations,combinations def data()...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Arrays; import java.util.Scanner; import java.util.Comparator; public class movinpoints { private static long sumaj(long[] arr,int index) { long result=0; while (index>=0) { result+=arr[index]; index=(index&(index+1))-1; } return result; } private static void apdejt (long[] t,int...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void dout() { cerr << '\n'; } template <typename Head, typename... Tail> void dout(Head H, Tail... T) { cerr << " " << H; dout(T...); } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 2e5 + 7; int n, m, cnt[N]; long long sum[N]; pair<i...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import java.io.*; import java.text.*; public class Main{ //SOLUTION BEGIN //Into the Hardware Mode void pre() throws Exception{} void solve(int TC)throws Exception { int n = ni(); TreeSet<Long> v = new TreeSet<>(); long[][] p = new long[n][2]; for(int ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10, inf = 1e9; const long long mod = (long long)1e9 + 7; set<int> setV; map<int, int> idV; pair<int, int> p[N]; int n; int treenum[N], num; long long treesum[N], sum; long long qry(long long tree[], int id) { long long ans = 0LL; for (; id; id -= (id...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long powmod(long long a, long long b, long long mod) { if (b == 0 || a == 1) { if (mod == 1) return 0; else return 1; } if (b % 2 == 0) { long long k = powmod(a, b / 2, mod); return (k * k) % mod; } else { long long k = powmod(a,...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
from bisect import bisect_right, bisect_left # instead of AVLTree class BITbisect(): def __init__(self, InputProbNumbers): # 座圧 self.ind_to_co = [-10**18] self.co_to_ind = {} for ind, num in enumerate(sorted(list(set(InputProbNumbers)))): self.ind_to_co.append(num) ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a > b) return a; else return b; } long long int min(long long int a, long long int b) { if (a < b) return a; else return b; } const int dx[4] = {-1, 1, 0, 0}; const int dy[4] = {0, 0, -1, 1}; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> template <class T> T sqr(T x) { return x * x; } template <class T> T lcm(T a, T b) { return a / __gcd(a, b) * b; } const long long mod = 1e9 + 7, oo = 1e12, N = 2e5 + 5; using namespace std; long long n, b[N], res, bit1[N], bit2[N]; pair<long long, long long> a[N]; inline long long lowbit(l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys input = sys.stdin.readline import bisect def query(f, i): ret = 0 while i: ret += f[i] i -= (i & -i) return ret def update(f, i, d): n = len(f) while i < n: f[i] += d i += (i & -i) n = int(input()) X = list(map(int, input().split())) V = list(map(int, in...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { std::cerr << name << " : " << arg1 << '\n'; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); std::cerr...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class ProblemF { public static InputStream inputStream = System.in; public static OutputStream outputStream = System.out; public static void main(String[] args) { Scanner scanner = new...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; pair<long long, long long> o[(int)2e5 + 10]; long long n, ts[(int)2e5 + 10], tc[(int)2e5 + 10]; int main(void) { scanf("%lld", &n); for (int i = 0; i < n; i++) { scanf("%lld", &o[i].second); } for (int i = 0; i < n; i++) { scanf("%lld", &o[i].first); } s...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 7; int n; vector<pair<int, int>> p; vector<int> vv1; long long get(vector<long long> &f, int pos) { long long res = 0; for (; pos >= 0; pos = (pos & (pos + 1)) - 1) { res += f[pos]; } return res; } void upd(vector<long long> &f, int pos...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1; const int NN = 1e3 + 1; const long long MOD = 1e9 + 7; const long long oo = 1e18 + 7; const int BASE = 10000; void solve() { int n; cin >> n; vector<int> x(n + 1); for (int i = 1; i <= n; i++) { cin >> x[i]; } vector<int> v(n + 1); f...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n; long long BIT[515151]; int BIT2[515151]; map<int, int> hs; void update(int x, int y) { for (int i = x; i <= 5e5; i += (i & (-i))) BIT[i] += y, BIT2[i]++; } long long query(int x) { long long tmp = 0; for (int i = x; i >= 1; i -= (i & (-i))) tmp += BIT[i]; ret...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 200009; int n, b[N], p[N], tot; long long c1[N], c2[N]; struct P { int x, v; bool operator<(const P &A) const { return x < A.x; } } a[N]; int lowbit(int x) { return x & (x ^ (x - 1)); } void add(int x, int k, long long c[]) { while (x <= tot) { c[x] ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; long long positions[maxn], speeds[maxn]; pair<long long, long long> pairs[maxn]; map<long long, long long> m; bool comp(pair<long long, long long>& a, pair<long long, long long>& b) { if (a.second == b.second) return a.first < b.first; return a...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; pair<long long, long long> a[200005]; long long sum[1000005], cnt[1000005]; long long querysum(long long pos) { long long ret = 0; for (; pos >= 0; pos = (pos & (pos + 1)) - 1) { ret += sum[pos]; } return ret; } long long querycnt(long long pos) { long long re...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 20; int n; pair<int, int> p[N]; struct node { long long sum, count; node(long long s = 0, long long c = 0) : sum(s), count(c) {} } bit[N]; void update(int x, int delta) { for (; x <= n; x += x & -x) { auto &[sum, count] = bit[x]; sum += del...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
//make sure to make new file! import java.io.*; import java.util.*; public class F624{ public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = Integer.parseI...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long read() { long long a = 0, b = getchar(), c = 1; while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar(); while (isdigit(b)) a = a * 10 + b - '0', b = getchar(); return a * c; } long long n, ans, p[200005]; pair<long long, long long> a[200005]; int main() ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 500; long long n, t1[N], t2[N]; void upd1(long long val, long long pos) { while (pos < n) { t1[pos] += val; pos = (pos | (pos + 1)); } } void upd2(long long val, long long pos) { while (pos < n) { t2[pos] += val; pos = (pos | ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cer...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e5 + 10, MAXM = 2e6 + 10; const int INF = INT_MAX, SINF = 0x3f3f3f3f; const long long llINF = LLONG_MAX; const int MOD = 1e9 + 7, mod = 998244353; long long tr[MAXN], tot, n, t[MAXN]; void add(int x, long long val) { while (x <= n) { tr[x] += val; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys input = sys.stdin.readline import bisect def query(f, i): ret = 0 while i: ret += f[i] i -= (i & -i) return ret def update(f, i, d): n = len(f) while i < n: f[i] += d i += (i & -i) n = int(input()) X = list(map(int, input().split())) V = list(map(int, in...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int b[200005], m; long long c[200005][2]; struct node { int x, v; bool operator<(const node t) const { return x < t.x; } } a[200005]; int lsh(long long x) { return lower_bound(b + 1, b + 1 + m, x) - b; } long long query(int x, int k) { long long ret = 0; for (int i ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = Integer.pars...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mx = 105; const long long mod = 1000000007; const long long maxn = 1e17; vector<long long> v1; vector<long long> v2; long long get(long long x, long long vt) { long long i, j, k; long long res = 0; for (i = x; i > 0; i -= (i & -i)) { if (vt == 1) {...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; import java.util.*; import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class MovingPoints { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Map; import java.io.BufferedReader; import ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void dout() { cerr << '\n'; } template <typename Head, typename... Tail> void dout(Head H, Tail... T) { cerr << " " << H; dout(T...); } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 2e5 + 7; int n, m, cnt[N]; long long sum[N]; pair<i...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; import java.util.*; import java.math.*; import java.awt.Point; public class Main { //static final long MOD = 998244353L; //static final long INF = -1000000000000000007L; static final long MOD = 1000000007L; //static final int INF = 1000000007; //static long[] factorial; public static void ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[][] xv = new int[n][2]; Integer[] v = new Integer...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5; int m; long long val[maxn + 11]; int cnt[maxn + 11]; pair<int, int> p[maxn + 11]; vector<int> v; int lowbit(int x) { return x & (-x); } void add(int x, int o) { for (; x <= m; x += lowbit(x)) { cnt[x] += 1; val[x] += o; } } pair<int, long l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; pair<int, int> p[maxn]; int n; long long d[maxn]; long long e[maxn]; void add(long long *c, int i, int k) { while (i <= n) { c[i] += k; i += i & (-i); } } long long sum(long long *c, int i) { long long res = 0; while (i > 0) { r...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long BIT[200009][4], N = 200009, n, ans, I; struct st { long long x, v; } a[200009]; bool cmp(st a, st b) { if (a.v == b.v) return a.x > b.x; return a.v > b.v; } bool cmp2(st a, st b) { if (a.v == b.v) return a.x > b.x; return a.v > b.v; } set<long long> s; m...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; pair<int, int> p[N]; struct fenwick { long long fen[N]; void add(int first, int d) { for (int i = first + 1; i < N; i += i & -i) { fen[i] += d; } } long long sum(int first) { long long ans = 0; for (int i = first + 1; i; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> t; pair<long long, long long> get(long long v, long long l, long long r, long long a, long long b) { if (l > b || a > r) { return {0, 0}; } if (a <= l && r <= b) { return t[v]; } long long m...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
class BIT(): def __init__(self, array): self.n = len(array) self.bit = [0] + array self.build() def build(self): for i in range(1, self.n): if i + (i & -i) > self.n: continue self.bit[i + (i & -i)] += self.bit[i] def _sum(self, i): ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStreamReader; import java.io.InputStream...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Arrays; import java.util.Scanner; import java.util.Comparator; public class R624_F { private static long sum (long[] t, int pos) { long result = 0; while (pos >= 0) { result += t[pos]; pos = (pos & (pos + 1)) - 1; } return result; } private static void upd (long[] t, int pos, int...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int b[200005], m; long long c[200005][2]; struct node { int x, v; bool operator<(const node t) const { return x < t.x; } } a[200005]; int lsh(long long x) { return lower_bound(b + 1, b + 1 + m, x) - b; } long long query(int x, int k) { long long ret = 0; for (int i ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.util.Random; import java.util.ArrayList; import java.util.Objects; import j...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct segtree { long long int M = 1, INIT; vector<long long int> dat; segtree(long long int N, long long int num) { INIT = num; while (M < N) M *= 2; for (int i = 0; i < M * 2 - 1; i++) dat.push_back(num); } void update(long long int x, long long int ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<vector<pair<long long, long long>>> mt(4 * 200005); vector<pair<long long, long long>> a; void buildTree(long long idx, long long second, long long se) { if (second == se) { mt[idx].push_back({a[second].second, a[second].first}); return; } long long mid...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int num[800005], m; long long b[200005], sum[200005], cnt[200005], tr[800005]; struct node { int x, v; bool operator<(const node t) const { return x < t.x; } } a[200005]; int lsh(long long x) { return lower_bound(b + 1, b + 1 + m, x) - b; } void build(int l, int r, int ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> class BIT { private: vector<T> dat; int n; public: BIT(int _n) : dat(_n + 1), n(_n) {} T sum(int i) { T s = 0; while (i > 0) s += dat[i], i -= i & -i; return s; } T sum(int l, int r) { return l > r ? 0 : sum(r) - sum(l - 1); } ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n; long long bit[200005][2]; void update(int x, long long val) { for (int i = x; i <= n; i += (i & -i)) bit[i][0] += val; for (int i = x; i <= n; i += (i & -i)) bit[i][1] += 1; } pair<long long, long long> query(int x) { long long ret1 = 0; long long ret2 = 0; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; map<int, int> mp; set<int> st; set<int>::iterator it; pair<int, int> arr[200005]; pair<long long, long long> tree[4 * 200005]; void update(int node, int b, int e, int i, long long v) { if (b > i || e < i) return; if (b == e && b == i) { tree[node].first += v; tr...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
//package psa.minrazdalja; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; public class minrazdalja { /*...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct node { int loc, v; } a[200010]; int n, m, b[200010]; long long c[200010], e[200010]; int cmp(node a, node b) { return a.loc < b.loc; } int lowbit(int x) { return x & -x; } void update(int pos, int delta, long long *d) { for (int i = pos; i <= n; i += lowbit(i)) d...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void dout() { cerr << '\n'; } template <typename Head, typename... Tail> void dout(Head H, Tail... T) { cerr << " " << H; dout(T...); } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 2e5 + 7; int n, m, cnt[N]; long long sum[N]; pair<i...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; const int MAX = 2e5 + 10; vector<pair<int, int>> v(MAX); vector<int> spdv(MAX), compress(MAX); long long n, bit[2][MAX]; void poe(int a, long long x, long long p) { for (; p <= n; p += p & -p) bit[a]...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long ts[(int)8e5 + 10], tc[(int)8e5 + 10], n; pair<long long, long long> o[(int)2e5 + 10]; void update(long long i, long long v, long long t = 1, long long nl = 1, long long nr = n) { if (i < nl || nr < i) return; if (nl == nr) { ts[t] += v; tc[...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; long long gcd(long long a, long long b) { for (; b; a %= b, swap(a, b)) ; return a; } const int N = 200002; pair<long long, long long> segTree[N * 4]; vector<long long> vIdx; void update(int ptr, int s, int e, in...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> using minheap = priority_queue<T, vector<T>, greater<T>>; template <typename T> void setmax(T& a, T b) { a = max(a, b); }; template <typename T> void setmin(T& a, T b) { a = min(a, b); }; template <typename T> bool in(T v, T lo, T hi) { return lo <=...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long int n, bit1[200050], bit2[200050]; vector<pair<long long int, long long int> > arr(200050); map<long long int, long long int> mp; long long int get1(int idx) { long long int ans = 0; while (idx > 0) { ans += bit1[idx]; idx -= (idx & -idx); } return...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; pair<int, int> p[N]; long long sum[N]; long long ans = 0; int n; pair<long long, long long> tree[N]; inline int lowbit(int x) { return x & (-x); } void update(int x, int v) { while (x <= n) { tree[x].first++; tree[x].second += v; x += lo...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count()); long long rnd(long long l, long long r) { return (mt_rnd_64() % (r - l + 1)) + l; } using ll = long long; using ld = long double; using ull = unsigned long long; const double PI = acos(-1.0); co...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python3
import operator import collections from sys import stdin N = int(input()) pos = list(map(int, stdin.readline().split())) speed = list(map(int, stdin.readline().split())) A = [] for i in range(N): A.append((pos[i], speed[i])) # organized A by position from least to greatest # We want to count, at each x_i, the n...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class Round624F { public static class node{ int pos; int neg; long negsum; long possu...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long n; pair<long long, long long> a[200001]; long long cnt[200001], sum[200001]; void update(long long x, long long val) { for (; x <= 200000; x += x & (-x)) { cnt[x]++; sum[x] += val; } } long long query(long long x, long long val) { long long ans = 0; ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import java.io.*; public class MovingPoints { public static void main(String[] args) { JS scan = new JS(); int n = scan.nextInt(); long[] xs = new long[n]; int[] vs = new int[n]; TreeSet<Integer> set = new TreeSet<Integer>(); HashMap<Integer, Integer> map = new HashMap<Integer, Intege...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> t[2 * 200004]; vector<long long> tpre[2 * 200004]; long long ans = 0; int cntlo = 0, cnthi = 0; void build(int n) { for (int i = n - 1; i > 0; i--) merge(t[i << 1].begin(), t[i << 1].end(), t[i << 1 | 1].begin(), t[i << 1 |...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; int n; long long ans = 0; vector<long long> T1(N, 0), T2(N, 0); pair<int, int> a[N]; vector<int> b; void update(vector<long long>& T, int x, long long v) { for (; x <= (int)b.size(); x += (x & (-x))) T[x] += v; } long long get(const vector<long long...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long N = 200005; long long n; pair<long long, long long> x[N]; long long ans; struct seg { long long vals[2 * N]; long long q(long long l, long long r) { long long ret = 0; for (l += n, r += n; l < r; l >>= 1, r >>= 1) { if (l & 1) ret += vals[l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct seg { vector<long long> tree; int n; seg(int n) { tree = vector<long long>(n); for (int i = 0; i < n; i++) tree[i] = 0; } void update(int node, int l, int r, int x, int y) { if (l > r) return; if (x > r || x < l) return; if (l == x && r ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n; long long ans; pair<long long, long long> a[N]; bool cmp(pair<long long, long long> x, pair<long long, long long> y) { if (x.second != y.second) { return x.second < y.second; } else { return x.first < y.first; } } vector<long long>...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > v; vector<long long> v1; long long a[200005], b[200005], c[200005], d[200005], n, m; map<long long, long long> mp; long long get(long long f[], long long pos) { long long res = 0; for (; pos >= 0; pos = (pos & (pos + 1)) - 1) res += f...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c> debug& operator<<(const c&...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dx[8] = {0, 0, 1, 1, 1, -1, -1, -1}; int dy[8] = {1, -1, -1, 0, 1, -1, 0, 1}; long long bit[1000005], bit1[1000005]; long long sum(long long x) { long long s = 0; while (x > 0) { s += bit[x]; x -= (x & (-x)); } return s; } void update(long long x, long l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; import java.math.BigInteger; import java.util.*; public class backup { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new InputReader(i...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
python2
import sys from collections import defaultdict range = xrange input = raw_input class segtree: def __init__(self, n): m = 1 while m < n: m *= 2 self.m = m self.data1 = [0.0]*(m + m) self.data2 = [0]*(m + m) def add(self, i, val): i += self.m while i: ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool test_cases_exist = false; class FenwickTree { public: vector<long long int> tree; long long int n; FenwickTree(long long int n) { this->n = n; tree.resize(n + 5); } void update(long long int ind, long long int delta) { while (ind <= n) { tr...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int b[200005], m; long long c[200005][2]; struct node { int x, v; bool operator<(const node t) const { return x < t.x; } } a[200005]; int lsh(int x) { return lower_bound(b + 1, b + 1 + m, x) - b; } long long query(int x, int k) { long long ret = 0; for (int i = x; i...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 4e5 + 1000; pair<long long, long long> p[maxn]; vector<long long> v; int getpos(long long V) { return lower_bound(v.begin(), v.end(), V) - v.begin() + 1; } long long C1[2][maxn]; long long C2[2][maxn]; void add(int x, long long K, long long C[][maxn], int...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct Scanner { bool hasNext = 1; bool hasRead = 1; int nextInt() { hasRead = 0; int res = 0; char flag = 1, ch = getchar(); while (ch != EOF && !isdigit(ch)) { hasRead = 1; flag = (ch == '-') ? -flag : flag; ch = getchar(); } ...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <typename T> using pr = pair<T, T>; const int mod = 1e9 + 7; struct SegTree { vector<pr<long long>> segtree; long long N; SegTree(long long n) { N = 1; while (N < n) N <<= 1; segtree = vector<pr<long long>>(2 * N); } void modify(long long k, l...
1311_F. Moving Points
There are n points on a coordinate axis OX. The i-th point is located at the integer point x_i and has a speed v_i. It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i-th point at the moment t (t can be non-integer) is calculated as x_i + t ...
{ "input": [ "3\n1 3 2\n-100 2 3\n", "2\n2 1\n-3 0\n", "5\n2 1 4 3 5\n2 2 2 3 4\n" ], "output": [ "3\n", "0\n", "19\n" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <typename T> struct BIT { int n; vector<T> bit; BIT(int n_ = 0) : n(n_), bit(n_ + 1) {} T sum(int i) { T ans = 0; for (; i > 0; i -= i & -i) ans += bit[i]; return ans; } void add(int i, T a) { if (i == 0) return; for (; i <= n; i += ...