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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int mini(int a, int b, int* x, int* v) { if (x[a] < x[b]) { if (v[a] <= v[b]) return x[b] - x[a]; } else { if (v[a] >= v[b]) return x[a] - x[b]; } return 0; } int main() { int t; scanf("%d", &t); int x[t], v[t], i = 0; while (i < t) { scanf("%d", x + i); 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mx = 2 * 1e5 + 5; const long long mod = 1e9 + 7; pair<long long, long long> arr[mx * 4]; void update(int node, int left, int right, int pos, long long val) { if (left == right) { arr[node].first++; arr[node].second += val; return; } int 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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; constexpr int MAXN = 5 + 200000; constexpr int MINV = 1 + 100000000; struct Bit { ll b[MAXN]; void upd(int x, ll val) { for (; x < MAXN; x += (x & -x)) b[x] += val; } ll query(int x) { ll ans = 0LL; 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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,-O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; const int oo = 2e9; const long long OO = 4e18; const int md = 0x3b800001; 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double movingPt(double x[], double v[], int j) { double d = 0; for (int g = 0; g < j - 1; g++) { for (int h = g + 1; h < j; h++) { if (v[g] == v[h]) { d += abs(x[g] - x[h]); } else if (x[g] > x[h] and v[h] - v[g] > 0) { d += 0; } el...
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": [] }
IN-CORRECT
cpp
/* author : Anubhav Dinesh Patel date : 14.11.2020 01:17:17 IST */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL) #define endl '\n' #define pb push_back #define mp make_pa...
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": [] }
IN-CORRECT
java
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader scan = new FastReader(); //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out"))); PrintWriter out = new PrintWriter(new BufferedWrit...
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": [] }
IN-CORRECT
cpp
/* "With age, comes wisdom. With travel, comes understanding. Remember that happiness is a way of travel – not a destination" */ #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 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; constexpr int maxN = 2e5 + 43; int n; vector<pair<int, int>> point; vector<int> val, cnt, cval; int LSOne(int k) { return (k & (-k)); } void update(vector<int>& f, int pos, int val) { for (; pos <= n; pos += LSOne(pos)) f[pos] += val; } long long rsq(vector<int>& f, int 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int d(int &x1, int &v1, int &x2, int &v2) { if (v1 == v2) { return abs(x1 - x2); } float t = (float)(x2 - x1) / ((float)(v1 - v2)); if (t < 1e-6) { return abs(x1 - x2); } return 0; } int main() { int n; cin >> n; vector<int> x(n); vector<int> v(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": [] }
IN-CORRECT
python3
numberofpoints=int(input()) initcoords=input().split(" ") speeds=input().split(" ") initcoords=tuple(map(int,initcoords)) speeds=tuple(map(int,speeds)) def twopoints(coords,velos): firstv=velos[0] secondv=velos[1] firstc=coords[0] secondc=coords[1] dif=abs(firstc-secondc) nextdif=abs((firstc+(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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long process1(vector<pair<int,int> >&arr){ long long sum[arr.size()+5]={}; long long positiveCount[arr.size()+5]={}; for(int i=arr.size()-1;i>=0;i--){ if(arr[i].second>=0){ positiveCount[i]=1; sum[i]=arr[i].first; }...
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": [] }
IN-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; public class minrazdalja { /** * Uvozena abstraktna funk...
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": [] }
IN-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": [] }
IN-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": [] }
IN-CORRECT
python3
from math import factorial from collections import Counter from heapq import heapify, heappop, heappush import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesI...
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": [] }
IN-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; public class minrazdalja { /** * Uvozena abstraktna funk...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int mx = 2e5 + 1; long long int n, compressV[mx]; pair<long long int, long long int> v[mx], x[mx]; long long int sumBIT[mx] = {0}, cntBIT[mx] = {0}; long long int getSum(long long int BIT[], int ind) { long long int sum = 0; while (ind > 0) { sum += BIT[ind]; ...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; pair<int, int> arr[n]; long long int counter = 0; pair<long long int, int> arrr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i].first; } for (int i = 0; i < n; ++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": [] }
IN-CORRECT
python3
import sys input=sys.stdin.readline def getsum(BITTree,i): s = 0 while i > 0: s += BITTree[i] i -= i & (-i) return(s) def updatebit(BITTree , n , i ,v): while i <= n: BITTree[i] += v i += i & (-i) n=int(input()) x=[int(i) for i in input().split() if i!='\n'] v=[int(i) fo...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int sum = 0; int n; cin >> n; float x[n], u[n]; for (int i = 0; i < n; ++i) { cin >> x[i]; } for (int i = 0; i < n; ++i) { cin >> u[i]; } for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; j++) { if (x[i] < x[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": [] }
IN-CORRECT
python3
import random import decimal # 5 # 2 1 4 3 5 # 2 2 2 3 4 n = 5 xs = [2,1,4,3,5] vs = [2,2,2,3,4] min_sum = sum(xs) summation = 0 for i in range(n): for j in range(n-1): if vs[j] != vs[i]: t_min = (xs[i]-xs[j])/(vs[j]-vs[i]) else: t_min = 0 summation += abs((xs[j]-xs...
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": [] }
IN-CORRECT
cpp
#include<bits/stdc++.h> /*#include<iostream> #include<vector> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> */ //using namespace __gnu_pbds; #define PB push_back using namespace std; #define N 400000; #define loop(i , x , n) for(ll i = x;i< n;i++) #define loopr(i , x , n) for(ll i = 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, c[200005]; long long ans; struct t { long long x, y; int z; } a[200005]; int lowbit(int x) { return x & (-x); } void update(int x) { for (int i = x; i <= n; i += lowbit(i)) c[i]++; } int query(int x) { int s = 0; for (int i = x; i >= 1; i -= lowbit(i)) 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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; inline int lowbit(int x) { return x & -x; } const int MAXN = 2e5 + 5; int f1[MAXN << 2], f2[MAXN << 2]; pair<int, int> a[MAXN]; int lsh[MAXN]; int n; long long sum(int x, int *arr) { long long ret = 0; while (x > 0) { ret += arr[x]; x -= lowbit(x); } 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MOD = int(1e9) + 7; const long long int MOD64 = (long long int)(1e18) + 7; const int INF = 0x7fffffff; const long long int INF64 = 0x7fffffffffffffff; const int N = 2e5 + 10; struct node { long long int x, v; int ind; } p[N]; bool compv(node a, node b) { 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": [] }
IN-CORRECT
cpp
/* File created on 08/05/2021 at 18:39:44. Link to problem: Description: Time complexity: O() Space complexity: O() Status: DEV (most of the time I don't update status, so it stays DEV which is the default value) Copyright: β’Έ 2021 Francois Vogel */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #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": [] }
IN-CORRECT
python3
import sys,math,itertools from collections import Counter,deque,defaultdict from bisect import bisect_left,bisect_right from heapq import heappop,heappush,heapify, nlargest from copy import deepcopy mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin....
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MOD = int(1e9) + 7; const long long int MOD64 = (long long int)(1e18) + 7; const int INF = 0x7fffffff; const long long int INF64 = 0x7fffffffffffffff; const int N = 2e5 + 10; struct node { long long int x, v; int ind; } p[N]; bool compv(node a, node b) { 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": [] }
IN-CORRECT
java
import java.util.*; /** * Created by Acesine on 2/24/20. */ public class F { static class Point { int x; int v; public Point() {} public Point(int x, int v) { this.x = x; this.v = v; } } public static void main(String[] args) { Scan...
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": [] }
IN-CORRECT
java
//package psa.minrazdalja; import java.util.ArrayList; import java.util.Scanner; // Import the Scanner class public class minrazdalja { static class MinStruktua { private int x; private int v; public MinStruktua(int x, int v) { this.x = x; this.v = v; } public void dodajx(int x) { this.x = 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int n2 = n; queue<int> q; set<int> inc, dec, cte; map<int, int> mp; while (n--) { int x; cin >> x; q.push(x); } while (n2--) { int x; cin >> x; int y = q.front(); mp[y] = x; if (x > 0) inc...
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": [] }
IN-CORRECT
cpp
#define _CRT_SECURE_NO_WARNINGS 1 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <cctype> #include <cstddef> #include <string> #include <vector> #include <iostream> #include <iomanip> #include <algorithm> #include <numeric> #include <functional> #include <iterator> #include <memory> ...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using LL = long long int; template <class T> struct Binary_Indexed_Tree { int maxSize; T* data; Binary_Indexed_Tree(int init_Size) : maxSize(init_Size) { data = new T[maxSize + 5]; memset(data, 0, sizeof(T) * (maxSize + 5)); } ~Binary_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": [] }
IN-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; public class minrazdalja { /** * Uvozena abstraktna funk...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 15; int tot = 1, N; const int L = -2e8; const int R = 2e8; struct Node { int l, r, num; long long sum; Node() { l = 0, r = 0, num = 0, sum = 0; } } E[maxn * 40]; struct Point { long long x, v; bool operator<(const Point &T) const { 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N; int get(vector<int> &tree, int pos) { int ret = 0; while (pos) { ret += tree[pos]; pos -= (pos & -pos); } return ret; } void update(vector<int> &tree, int pos, int diff) { while (pos < tree.size()) { tree[pos] += diff; pos += (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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { return 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int a1[5000005]; void update(int index, int value) { while (index > 0) { a1[index] += value; index -= index & (-index); } } int query(int index) { int sum = 0; while (index < 5000005) { sum += a1[index]; index += index & (-index); } return sum; }...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int n; long long vv[maxn]; long long num1[maxn], num2[maxn]; struct xiao { long long x, v; } a[maxn]; long long lowbit(long long x) { return x & (-x); } void updata(long long i, long long k, long long num[]) { while (i < n) { num[i] += k;...
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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long maxn = 200005; map<long long, long long> g; map<long long, long long> invG; long long tree[4][maxn]; long long sum(long long k, long long t) { long long res = 0; for (long long i = k; i >= 1; i -= i & -i) res += tree[t][i]; return res; } void add(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": [] }
IN-CORRECT
java
//package CodeforcesJava; import java.io.*; import java.util.*; public class Main { public void solve(InputProvider in, PrintWriter out) throws IOException { int pointCount = in.nextInt(); MovingPoint[] points = new MovingPoint[pointCount]; for (int i = 0; i < points.length; 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<pair<long long int, long long int> > t[1000005]; vector<long long int> sm[1000005], act[1000005]; vector<pair<long long int, long long int> > v1, vv; void build1(long long int v, long long int tl, long long int tr) { if (tl == tr) { t[v] = vector<pair<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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class Ch, class Tr, class Container> basic_ostream<Ch, Tr>& operator<<(basic_ostream<Ch, Tr>& os, Container const& x) { os << "{ "; for (auto& y : x) os << y << " "; return os << "}"; } template <class X, class Y> ostream& o...
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": [] }
IN-CORRECT
cpp
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<climits> #include<cmath> #include<ctime> #include<vector> #include<queue> #include<stack> #include<list> #include<set> #include<map> #include<utility> #include<algorithm> using namespace std; #define FOR(i,a,b) for(register int i=(a);i<(b...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class Ch, class Tr, class Container> basic_ostream<Ch, Tr>& operator<<(basic_ostream<Ch, Tr>& os, Container const& x) { os << "{ "; for (auto& y : x) os << y << " "; return os << "}"; } template <class X, class Y> ostream& o...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> long long *pos = new long long[(int)(2e5 + 5)], *vel = new long long[(int)(2e5 + 5)]; using namespace std; vector<int> perm; long long solve(int le, int ri) { if (le == ri) { return 0; } if (le == ri - 1) { long long ans = 0; if (vel[perm[le]] <= vel[perm[ri]]) ans +...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1}; int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1}; vector<pair<int, int> > vec; int n; int tree[(int)(2 * 1e5 + 1)], tree2[(int)(2 * 1e5 + 1)]; void atualiza(int x, int v) { for (; x <= 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": [] }
IN-CORRECT
cpp
//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; // #define mp make_pair #define ff first #define ss second #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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 4; int n, nef[maxn]; pair<int, int> a[maxn]; long long fen[maxn]; void _accepted_by_one_hit_() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } long long get(int u) { long long res = 0; for (int i = u; i >= 1; i -= i & (-i)) 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": [] }
IN-CORRECT
cpp
//#pragma comment(linker, "/stack:200000000") #include<bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long const LL INF=1LL<<60; const double PI = acos(-1.0); typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vi; typedef vector<LL> vl; typedef vector<pii> vii;...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); solve(); return 0; } inline long long max(long long a, int b) { return max(a, (long long)b); } inline long long max(int a, long long b) { return max((long long)a, b); } inline 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": [] }
IN-CORRECT
python3
import sys,math,itertools from collections import Counter,deque,defaultdict from bisect import bisect_left,bisect_right from heapq import heappop,heappush,heapify, nlargest from copy import deepcopy mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin....
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1}; int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1}; vector<pair<long long int, long long int> > vec; int n; int tree[(int)(2 * 1e5 + 1)], tree2[(int)(2 * 1e5 + 1)]; void atualiza(int x, 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; pair<int, int> p[N]; long long cnt[N << 2], val[N << 2]; void update(int a, int b, int l, int r, int rt, int v) { if (a <= l && b >= r) { val[rt] += v, cnt[rt]++; return; } int mid = l + r >> 1; if (a <= mid) update(a, b, l, mid, rt <<...
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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using ll = long long; using namespace std; template <class T> class SegmentTree { private: int _size = 1; T _def; std::vector<T> _nodes; std::function<T(T, T)> _op; std::function<T(T, T)> _update_op; public: SegmentTree(int size, T default_value, std::function<T(T, T)> op, ...
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": [] }
IN-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": [] }
IN-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; public class minrazdalja { /** * Uvozena abstraktna funk...
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": [] }
IN-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.TreeMap; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.util.TreeSet; 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct newdata { long long x, v, label; }; int n; long long tree1[200001]; long long tree2[200001]; newdata a[200001]; bool cmp1(newdata i, newdata j) { return i.x < j.x; } bool cmp2(newdata i, newdata j) { return i.v < j.v; } long long lowbit(long long 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": [] }
IN-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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mx = 2 * 1e5 + 5; const long long mod = 1e9 + 7; pair<long long, long long> arr[mx * 4]; void update(int node, int left, int right, int pos, int val) { if (left == right) { arr[node].first++; arr[node].second += val; return; } int mid = (le...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, mx, mxp; cin >> n; vector<long long int> m(n), left(n), right(n), minl(n), minr(n); map<long long int, long long int> last; set<long long int> s; set<long long int>::iterator itr; for (i = 0; i < n; i++) cin >> m[i]; left[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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.write(nam...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 22, inf = 1e9 + 7; int n; long long s[4 * N], cursum; vector<pair<int, int> > t[4 * N]; vector<int> p[4 * N]; pair<int, int> a[N]; void build(int v, int tl, int tr) { if (tl == tr) { s[v] = a[tl].first; t[v].push_back({a[tl].second, a[tl].first...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; pair<int, long long> a[200005]; int t[200005]; map<int, int> M; pair<int, long long> f[200005]; int n; void update(int gt) { int x = M[gt]; while (x <= n) { f[x] = {f[x].first + 1, f[x].second + gt}; x += x & -x; } } pair<int, long long> get(int x) { int cnt...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; const int xn = 2e5 + 10; const int xm = 5e5; const int SQ = 320; const int sq = 1e3 + 10; const long long inf = 1e18 + 10; long long power(long long a, long long b) { return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2) % md ...
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": [] }
IN-CORRECT
python3
n=int(input()) x=list(map(int,input().split())) v=list(map(int,input().split())) l=[] for i in range(n): l.append((x[i],v[i])) l.sort() #print(*l) ans=0 for i in range(n): for j in range(i+1,n): if l[i][1]>=0 and l[j][1]>=0: if l[i][1]<=l[j][1]: ans+=(l[j][0]-l[i][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": [] }
IN-CORRECT
java
import java.util.*; import java.lang.*; import java.io.*; public class ct1{ static class Point{ int ip, speed; } public static void main(String[] args) { Scanner inp = new Scanner(System.in); int a = inp.nextInt(); Point[] points = new Point[a]; // int a = inp.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": [] }
IN-CORRECT
java
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; public class C1311F_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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> struct fen { vector<T> fenwick; int size; fen(int sz) { size = sz; fenwick.resize(size); for (int i = 0; i < size; i++) fenwick[i] = 0; } fen(vector<T> arr) { size = arr.size(); fenwick.resize(size); for (int i = 0; i < 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": [] }
IN-CORRECT
java
import java.util.*; public class S { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { a[i]=in.nextInt(); ...
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": [] }
IN-CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define x first #define v second using namespace std; using ll = long long; using pll = pair<ll, ll>; template <class T> struct SegTree { T f(T a, T b) { return a + b; } vector<T> s; int n; SegTree(int n) : 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void fio() {} void pti() { double timeuse = clock() * 1000.0 / CLOCKS_PER_SEC; cerr << "Timeuse " << timeuse << "ms" << endl; } void end() { exit(0); } namespace io { const int SIZ = 55; int que[SIZ], op, qr; char ch; template <class I> inline void gi(I& w) { ch = get...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; const int xn = 2e5 + 10; const int xm = 5e5; const int SQ = 320; const int sq = 1e3 + 10; const long long inf = 1e18 + 10; long long power(long long a, long long b) { return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2) % md ...
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": [] }
IN-CORRECT
python3
numberofpoints=int(input()) initcoords=input().split(" ") speeds=input().split(" ") initcoords=list(map(int,initcoords)) speeds=list(map(int,speeds)) def twopoints(coords,velos): firstv=velos[0] secondv=velos[1] firstc=coords[0] secondc=coords[1] if firstv==secondv: return abs(firstc-second...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long int ans = 0; void merger(vector<pair<long long int, long long int> > &v, long long int l, long long int mid, long long int r) { long long int n1 = mid - l + 1, n2 = r - mid; pair<long long int, long long int> larr[n1], rarr[n2]; long long int lsu...
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": [] }
IN-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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mx = 2 * 1e5 + 5; const long long mod = 1e9 + 7; pair<long long, long long> arr[mx * 4]; void update(int node, int left, int right, int pos, long long val) { if (left == right) { arr[node].first++; arr[node].second += val; return; } int 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": [] }
IN-CORRECT
java
import java.util.Scanner; import java.util.Stack; import java.util.Arrays; import java.util.HashMap; import java.util.Comparator; public class F{ // static final int max = 10000; static class Pair{ int x; int speed; public String toString(){ return "[" + x + ", " + speed + "]"; } } static class FenvikTr...
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": [] }
IN-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 (a > b) { return {0, 0}; } if (l > b || a > r) { return {0, 0}; } if (a <= l && r <= b...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace __gnu_pbds; #define ordered_set tree<pair<long,long>, null_type,less<pair<long,long>>, rb_tree_tag,tree_order_sta...
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": [] }
IN-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": [] }
IN-CORRECT
python3
import collections def ff(x, d): res = 0 for i in d.keys(): if i < x: res += 1 else: break return res n = int(input()) x = list(map(int, input().split())) v = list(map(int, input().split())) d = [(x[i], v[i]) for i in range(n)] d.sort(key=lambda x: x[0]) ''' 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int b, long long int m) { long long int ans = 1; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; } vector<pair<long long int, long long int> > v; long long int n; 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int M = 200005; int n, m, w[M]; long long ans, c[M][2]; struct node { int x, v; } p[M]; bool cmp(node a, node b) { return a.x < b.x; } long long query(int x, int t) { long long r = 0; for (int i = x; i; i -= i & -i) r += c[i][t]; return r; } void upd(int x, 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; pair<int, long long> a[200005]; int t[200005]; map<int, int> M; pair<int, long long> f[200005]; int n; void update(int gt) { int x = M[gt]; while (x <= n) { f[x] = {f[x].first + 1, f[x].second + gt}; x += x & -x; } } pair<int, long long> get(int x) { int cnt...
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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 200200; int n; long long ans, bit[2][MAXN]; pair<int, int> a[MAXN]; void compress() { map<int, int> m; for (int i = 1; i <= n; ++i) m[a[i].second]; int cnt = 1; for (auto& [key, val] : m) val = cnt++; for (int i = 1; i <= n; ++i) a[i].second = m[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": [] }
IN-CORRECT
java
import java.util.Scanner; public class Moving { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int [] x = new int [n]; int [] v = new int [n]; for (int i = 0; i < n; i++) { x[i] = scan.nextInt(); } for (int i = 0; i < n; i++) { v[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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct Point { long x; long v; }; vector<Point> points; long SUM; void add_pairwise_dist(long start, long end) { long m, i, j; if (start == end) return; m = start + (end - start) / 2; add_pairwise_dist(start, m); add_pairwise_dist(m + 1, end); vector<long> 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": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using LL = long long int; template <class T> struct Binary_Indexed_Tree { int maxSize; T* data; Binary_Indexed_Tree(int init_Size) : maxSize(init_Size) { data = new T[maxSize + 5]; memset(data, 0, sizeof(T) * (maxSize + 5)); } ~Binary_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": [] }
IN-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; } int query(int p, long long *bit) { int r = 0; for (p += 2; p; p -= p & -p) 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": [] }
IN-CORRECT
cpp
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<climits> #include<cmath> #include<ctime> #include<vector> #include<queue> #include<stack> #include<list> #include<set> #include<map> #include<utility> #include<algorithm> using namespace std; #define FOR(i,a,b) for(register int i=(a);i<(b...