Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using pil = pair<int, ll>; using pli = pair<ll, int>; using piii = pair<int, pii>; using plll = pair<ll, pll>; using pib = pair<int, bool>; using pdi = pair<double, int>; using pid = pair<int, doubl...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.*; import java.math.*; import java.util.*; public class CODEFORCES { private InputStream is; private PrintWriter out; public static long gcd(long a, long b) { if (b == 0) return a; return gcd(b, a % b); } public static class Pair implements Comparable<Pair> { long u, v; public Pair(...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int n, m, k, d[100001], f[100001], t[100001], c[100001], I[100001]; inline int Min(int x, int y) { return x < y ? x : y; } inline long long Min(long long x, long long y) { return x < y ? x : y; } inline bool cmp(int p1, int p2) { return d[p1] < d[p2]; } int Dep[100001], Dep...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct A { int d, f, t, c; bool operator<(const A& a) const { return d < a.d; } }; A v[100005]; int bestLef[100005], bestRig[100005], nxt[100005], pos[100005]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= m; ++i) cin >> v[i].d >> v[i].f >> v[...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; inline void read(long long &x) { char c = getchar(); x = 0; while (c > '9' || c < '0') c = getchar(); while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } } const long long N = 1000005, mxd = 1000000; const long long inf = 2e11; long long ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; inline int mini(int a, int b) { return (a > b) ? b : a; } inline int maxi(int a, int b) { return (a < b) ? b : a; } vector<pair<int, int> > to[100010], bak[100010]; int tos[100010], bas[100010]; long long pre[1000010], suf[1000010]; int ear, lat = 100000000; int main(void) ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 1E6, M = 1E5; int n, q, k; pair<int, long long> dpto0[N + 7], dpleave0[N + 7]; struct node { int day, u, v, cost; bool operator<(const node &x) const { return day < x.day; } } a[M + 7]; struct P { int to, cost; }; vector<P> visto0[N + 7], visleave0[N + 7...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e6 + 100; const int mod = 1e9 + 7; int n, m, k; long long dp1[MAXN], dp2[MAXN]; struct fc { int d, u, v; long long cost; }; vector<fc> v1; vector<fc> v2; bool vis[MAXN]; long long pre[MAXN]; bool cmp(fc a, fc b) { return a.d < b.d; } bool cmp2(fc a, fc...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > ar[1000009], dep[1000009]; long long pre[1000009], suf[1000009], pr[100009], prsz[1000009], sufsz[1000009]; int main() { long long n, m, k, d, f, t, s; cin >> n >> m >> k; for (int i = 0; i < m; i++) { cin >> d >> f >> t >> s; ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > f[100005], t[100005]; vector<int> fmx[100005], tmx[100005]; int ptf[100005] = {}, ptt[100005] = {}; vector<int> goingt; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); while (m--) { int d, fx, tx, c; scanf("%d%d%d%d", &d, &fx, &t...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long int inf = 1e17; long long int n, m, k, i, st, l = 0, ind, e = 0, d, c, j, f, r, bg = 0, lv = 0, mini[100005], ans = inf; vector<pair<long long int, pair<long long int, long long int> > > qu[1000005]; multiset<long long int> lea[100005...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
from bisect import * from sys import * n,m,k=[int(i) for i in input().split()] pln=[] if m==0: print(-1) exit(0) for i in range(m): pln.append([int(i) for i in input().split()]) pln.sort() grp=[[pln[0]]];gt=0; for i in range(1,m): if pln[i][0]!=pln[i-1][0]: gt=gt+1 grp.append([]) gr...
PYTHON3
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxn = 1000005; const int limit = 1000000; struct Info { int id; int cost; Info() {} Info(int i, int c) : id(i), cost(c) {} }; Info info; int n, m, k; int arrived[maxn], totol_arrived[2][maxn]; long long totol_arrived_cost[2][maxn]; vector<Info> arrived_st...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct flight { int u, v, c; flight(int U, int V, int C) : u(U), v(V), c(C) {} }; int n, m, k; long long pre[1111000], suf[1111000], best[1111000], INF = 15e11, tot; vector<flight> vet[1111000]; int main() { scanf("%d%d%d", &n, &m, &k); for (int(i) = (0); (i) < (m);...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; struct node1 { int f, ti; long long c; } a[N]; struct node2 { int to, ti; long long c; } b[N]; bool cmp1(node1 a, node1 b) { return a.ti < b.ti; }; bool cmp2(node2 a, node2 b) { return a.ti > b.ti; }; bool vis[N]; long long pre[N]; long long ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxx = 1000010; priority_queue<long long, vector<long long>, greater<long long> > q[maxx / 10 + 10000]; long long t, n, m, k; long long ans = 0, total = 0, sum = 0, cnt = 0, l = 0, l1 = 0, r1 = 0; long long a[maxx], sum1[maxx], sum2[maxx], bj1[maxx], bj2[maxx]...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long>> in[1000010], out[1000010]; long long inc[1000010], outc[1000010], was[100010]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n, m, k; cin >> n >> m >> k; for (long long i = 0; i < m; i++) { long lon...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxN = (int)1e5 + 100; const int INF = 1e9; const int maxD = 1e6 + 100; const int modulo = maxN; int d[maxN], f[maxN], t[maxN], c[maxN]; int start[maxN], finish[maxN]; long long cost0[maxD], costN[maxD]; vector<pair<int, int> > FROM[maxD], TO[maxD]; long long rsq[...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comp...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct Flight { long long d, f, t, c; }; const int MAXN = 1e5; int n, m, k; Flight p[MAXN + 1]; multiset<long long> mnl[MAXN + 1], mnr[MAXN + 1]; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 1; i <= m; i++) { scanf("%lld%lld%lld%lld", &p[i].d, &p[i].f, &...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> const int MAXINT = 2147483640; const long long MAXLL = 9223372036854775800LL; const long long MAXN = 1123456; using namespace std; pair<pair<long long, long long>, pair<long long, long long> > a[MAXN]; vector<long long> v[2][MAXN]; set<pair<long long, long long> > S[MAXN]; long long kol[2], c[2...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 8; struct data { int s, f; long long c; }; long long l[N], r[N], nl[N], nr[N]; long long Min[N]; vector<data> day[N]; int trv[N]; int main() { int n, m, k; scanf("%d %d %d", &n, &m, &k); int M = 0; for (int i = 1; i <= m; i++) { int d; ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int intinf = 1e9; const long long inf = 1e18; const int N = 1e5 + 5; const int M = 1e6 + 5; int n; vector<pair<int, int>> out[N], in[N]; vector<int> suf[N], pref[N]; vector<pair<int, int>> q[M]; int getbest(int i, int l, int r) { int res1; int l1 = 0; int r1 = i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(T x) { return x * x; } template <class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a % b) : a); } template <class T> T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); } template <class T> inline T bigmod(T p, T e, T M) { if (e == 0) retur...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:16777216") using namespace std; const int inf = (int)1e9 + 5; const long long MAXN = 300005; const long long MAXVAL = 10000000; const long long INF = (long long)1e18 + 50; const long long MOD = (long long)1e9 + 7; const unsigned long long HASH_MOD = 2305843009213...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; using namespace std; long long powm(long long base, long long exp, long long mod = 1000000007) { long long ans = 1; while (exp) { if (exp & 1) ans = (ans * base) % mod; exp >>= 1, base = (base * base) % mod; } return ans; } long long pref[2000005], suff[2000...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
N,M,K = map(int,input().split()) INF = 10**6+1 from collections import defaultdict incoming = defaultdict(list) outgoing = defaultdict(list) for _ in range(M): d,f,t,c = map(int,input().split()) if t == 0: incoming[d].append((c,f-1)) if f == 0: outgoing[d].append((c,t-1)) incoming_dates = sorted(incom...
PYTHON3
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
/** * Created by Aminul on 9/6/2017. */ import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class CF85D_3 { public static int index; public static void main(String[] args)throws Exception { InputReader in = new InputR...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 10; int n, m, k, sum1, sum2; long long st[MAX], en[MAX]; int amin[MAX], bmin[MAX]; struct node { int d; int f; int t; int v; } a[MAX], b[MAX]; bool cmp1(node x, node y) { return x.d < y.d; } bool cmp2(node x, node y) { return x.d > y.d; } int m...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Objects; impo...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; im...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 1000100; vector<pair<int, int> > e0[N], e1[N]; int v0[N], v1[N], ml, mr; long long s0[N], s1[N]; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); for (register int i = 1; i <= m; i++) { int d, f, t, c; scanf("%d%d%d%d", &d, &f, &t, &c); ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; } int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; } const long long int MAXN = 1e5 + 10; long long int d[MAXN], first[MAXN], t[MAXN], c[MAXN]; long long int ind[MAXN]; const ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct N { int d, a, b, c; bool operator<(const N ot) const { return c > ot.c; } }; int n, m, k; N v[100005]; priority_queue<N> pq[100005]; bitset<1000005> pos; long long mn[1000005]; void salida() { long long acu = 0; int c = 0, j = 1; for (int i = 1; i <= n; i++...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> const int N = 1e6 + 10; using namespace std; int n, m, k; bool ok[N]; long long costi[N]; long long costo[N]; long long in[N]; long long out[N]; bool S[N], E[N]; struct node { int d, s, e, w; node() {} node(int dd, int ss, int ee, int ww) { d = dd; s = ss; e = ee; w = ww; ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 100000; const int M = 1000000; const int INF = 1000001; struct flight_t { int date, idx, cost; flight_t() = default; flight_t(const int& date, const int& idx, const int& cost) : date(date), idx(idx), cost(cost) {} bool operator<(const flight_t& t...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; vector<pair<pair<long long, long long>, pair<long long, long long>>> q; long long const inf = 1e17; long long const N = 1e6 + 10; long long pre[N]; long long suf[N]; vector<pair<long long, long long>> Df[N], Db[N]; long long costto[N]; signed main() { ios::sync_with_stdio...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct Flight { int d, s, t, c; bool operator<(const Flight &o) const { return d < o.d; } }; int ct[100008]; long long int d1[100008]; long long int d2[100008]; Flight fl[100008]; int main() { int C, F, D, n, i, j; long long int c; scanf("%d %d %d", &C, &F, &D); ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int n, m, k; struct F { int u, cost; }; vector<F> to0[maxn], left0[maxn]; int d, u, v, cost, mxt; long long mn[maxn]; long long arr[maxn], dep[maxn]; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 1; i <= m; ++i) { scanf("%d%d%d%d...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; tuple<int, int, int> t[maxn]; multiset<long long> h[maxn]; const long long inf = 0x3f3f3f3f3f; long long mn[maxn]; int n, m, k; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < m; i++) { int d, u, v, c; scanf("%d%d%d%d", &d...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MAX = 1 << 20; const long long INF = 1e12; int dan[MAX], poc[MAX], kraj[MAX], cost[MAX]; long long pref[MAX], suf[MAX]; vector<pair<int, int> > Tamo[MAX], Nazad[MAX]; int nope() { printf("-1\n"); exit(0); } int main() { int n, m, k; scanf("%d%d%d", &n, &m,...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct node { int day, from, to, cost; }; const bool operator<(node a, node b) { if (a.day < b.day) return 1; return 0; } struct triple { int first, second, th; }; const bool operator<(triple a, triple b) { if (a.first < b.first) return 1; if (a.first > b.first)...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long val[112345], valf[112345]; struct node { int d, f, t, c; node() {} node(int d, int f, int t, int c) : d(d), f(f), t(t), c(c) {} void print() { printf("%d %d %d %d\n", d, f, t, c); } } flightTo[112345], flightFrom[112345]; struct node2 { int t; long lon...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int n, m, k; pair<pair<int, int>, pair<int, int> > a[100005]; int sl[100005], sr[100005], pl = 1000000, pr; long long l[1000005], r[1000005]; int ll, rr; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 1; i <= m; i++) { scanf("%d%d%d%d", &a[i].first.first, &a...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.BufferedInputStream; import java.util.*; /** * Created by leen on 23/09/2017. */ public class _853B { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in, 1024*1024)); int n = scan.nextInt(), m = scan.nextInt(), k = scan.nextInt();...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const int INF = 0x3f3f3f3f; const long long llINF = 0x3f3f3f3f3f3f3f3f; const int mod = 998244353; void read(int &ans) { long long x = 0, w = 1; char ch = 0; while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); } while (isdi...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long int cons; long long int check(long long int a) { if (a >= cons || a <= -cons) a %= cons; return a; } long long int check2(long long int a) { if (a > 0) return a; long long int b = a / cons; a -= b * cons; if (a < 0) a += cons; return a; } long long i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 1e5, M = 1e6; const double EPS = 1e-9; const int INF = 1e9; const long long INFL = 1000000000000000LL; int n, m, k; int minCostFirst[N + 5]; int minCostLast[N + 5]; long long prefCost[N + 5]; long long suffCost[N + 5]; struct trip { ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.Set; import java.util.InputMismatchException; import java.io.IOException; import java.util.HashSet; impor...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Pr...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; constexpr int MOD = 1000000007; template <typename T, typename U> std::istream& operator>>(std::istream& i, pair<T, U>& p) { i >> p.first >> p.second; return i; } template <typename T> std::istream& operator>>(std::istream& i, vector<T>& t) { for (auto& v : t) { i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; void write(long long x) { if (x < 0) { putchar('-'); x = -x; } if (x > 9) write(x / 10); putchar(x % 10 + '0'); } long long read() { long long d = 0, w = 1; char c = getchar(); for (; c < '0' || c > '9'; c = getchar()) if (c == '-') w = -1; for (...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int n, m, k; struct Flight { int d, f, t, c; bool operator<(const Flight &ot) const { return d < ot.d; } } v[1000002]; int costJ[100002]; long long cost[1000002]; int firstV; long long ans; void getJury() { cost[0] = 1LL * 1000000002 * n; for (int i = 1; i <= n; ++i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct item { int d, f, t, c; bool operator<(const item &o) const { return d < o.d; } void read() { cin >> d >> f >> t >> c; } }; void solve(int n) { int m, k; cin >> m >> k; vector<item> v(m); for (int i = 0; i < (int)(m); ++i) v[i].read(); sort((v).begin()...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
/* * DA-IICT * Author: Jugal Kalal */ import java.util.*; import java.io.*; import java.math.*; public class Codeforces{ static long mod=(long)Math.pow(10,9)+7l; public static void main(String args[]){ new Thread(null, new Runnable() { public void run() { try{ ...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.*; import java.util.*; import java.util.Map.Entry; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static long oo = (long)1e12; public static void main(String[] args) { int n = in.nextInt(); int m = in.nextIn...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int n, m, k; int d[100005]; int f[100005]; int t[100005]; int c[100005]; long long to[1000005], from[1000005]; long long cost[100005]; int main() { cin >> n >> m >> k; for (int i = (int)(0); i < (int)(m); ++i) cin >> d[i] >> f[i] >> t[i] >> c[i]; { for (int i = (i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /** * @author Don Li */ public class JuryMeeting { int N = (int) 1e6 + 10; int INF = (int) 1e9; void solve() { int n = in.nextInt(), m = in.nextIn...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> int n, m, k; int d1[100010], f1[100010], t1[100010], c1[100010]; int d2[100010], f2[100010], t2[100010], c2[100010]; int idx[100010]; long long cs1[1000010], cs2[1000010]; int vis[100010], num; int m1, m2; int cost1[100010]; int sign1[1000010]; int cost2[100010]; int sign2[1000010]; long long r...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Template { long MODULO = 1L * 1000 * 1000 * 1000 * 1000 * 1000 ; long b = 31; String fileName = ""; class Point{ int x, y; Point(int x, int y){ this.x = x; ...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int inf = 1e9; const int maxn = 2e6 + 5; void read(long long &x) { char ch; bool flag = 0; for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1); ch = getchar()) ; for (x = 0; isdigit(ch); x = (x << 1) + (x ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
/** * DA-IICT * Author : Savaliya Sagar */ import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.fill; import static java.lang.Math.*; import static java.util.Arrays.sort; import static java.util.Collections.sort; public class D854 { InputStream is; PrintWriter out; String INP...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
/** * Created by Aminul on 9/6/2017. */ import java.io.*; import java.util.*; public class CF854D_uwi_reader { public static int index; public static void main(String[] args)throws Exception { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
from sys import stdin, stdout n,m,k = map(int,stdin.readline().rstrip().split()) arrivalFlightList = [] departureFlightList = [] for _ in range(m): d,f,t,c = map(int,stdin.readline().rstrip().split()) d-=1 if f==0: t-=1 departureFlightList.append((d,t,c)) else: f-=1 arri...
PYTHON3
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long costin0[1000110]; long long costout0[1000110]; int nrajuns[1000110]; int nrplecat[1000110]; void set_ajuns(vector<pair<int, int>>& v) { sort(v.begin(), v.end()); if (v.empty()) return; nrajuns[v[0].first]++; for (int i(0); i < v.size(); i++) { if (i) v...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; inline int read() { int x; char c; while ((c = getchar()) < '0' || c > '9') ; for (x = c - '0'; (c = getchar()) >= '0' && c <= '9';) x = (x << 3) + (x << 1) + c - '0'; return x; } vector<pair<pair<int, int>, int> > v[1000000 + 5]; long long l[1000000 + 5],...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.stream.Stream; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelp...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.util.*; import java.math.*; import java.io.*; import java.text.*; public class A { static class Node implements Comparable<Node>{ int day; int f; int t; long cost; public Node(int day ,int f,int t,long cost){ this.cost=cost; this.day=day; this...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; template <typename T> void resize(int n, vector<T> &u) { u.resize(n); } template <typename Head, typename... Tail> void resize(int n, Head &H, Tail &...T) { resize(n, H); resize(n, T...); } template <typename T> void debug_out(T t) { cerr << t; } template <typename ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct flight { int d; int f; int t; int c; }; vector<struct flight> infor; int pre[100001]; int aft[100001]; long long sum_com[1000001]; long long sum_go[1000001]; int cmp(struct flight x, struct flight y) { if (x.d < y.d) return 1; else return 0; } int...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18 + 1; const int MAXN = 2e6 + 7; struct mov { int to, day, cost; bool operator<(const mov& o) const { return day < o.day; } }; vector<mov> in, out; int vis[MAXN]; long long sum[MAXN], mn[MAXN]; int main() { int n, m, k; scanf("%d%d%d", &n, &...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.*; import java.util.*; import static java.lang.Math.min; /** * Created by Katushka on 11.03.2020. */ public class C { public static final Comparator<int[]> COMPARATOR = Comparator.comparingInt(o -> o[0]); static int[] readArray(int size, InputReader in) { int[] a = new int[size]; ...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Arrays; import java.util.Random; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; im...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; /** * Created by mostafa on 9/4/17. */ public class D { static class Flight{...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Str...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 100100; const int M = 1010000; const long long INF = 1e16; long long sux[M], suy[M], ans, sum; int b[N], num, n, m, k, n1, n2; struct edge { int t, d, w; edge() {} edge(int x, int y, int z) { t = x; d = y; w = z; } } a[2][N]; bool cmp1(cons...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 10; const int K = 1000000 + 10; int n, m, k; long long arr_cost_sum[K]; long long arr_cnt[K]; long long arr_cost[N]; bool arr[N]; long long dep_cost_sum[K]; long long dep_cnt[K]; long long dep_cost[N]; bool dep[N]; struct Flight { long long d, f, t,...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long INF = 1e18; signed main() { ios_base::sync_with_stdio(0); long long n, m, k; cin >> n >> m >> k; n++; vector<vector<long long>> mas(m, vector<long long>(4)); for (long long i = 0; i < m; i++) { cin >> mas[i][0] >> mas[i][1] >> mas[i][2] >> mas[i][3...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHel...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int n, m, k; struct F { int d, u, v, c; inline bool operator<(const F x) const { return d < x.d; } } f[100010]; int in[100010]; long long ans = 0, ansans = -1; vector<int> lv[100010]; int pos[100010]; int T; inline void init() { for (int i = 1; i <= m; i++) { if (...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.*; import java.math.BigInteger; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { MyReader reader = new MyReader(System.in); MyWriter writer = new MyWriter(System.out); new Solution().run(reader, writer); writer.cl...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct Node { int city, cos; Node() {} Node(int _city, int _cos) : city(_city), cos(_cos) {} }; vector<Node> fl[1001000][2]; int mn[100100]; int mx[100100]; int pre[100100]; int suf[100100]; long long presum[1001000]; long long sufsum[1001000]; int main() { int n, m...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> using P = pair<T, U>; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, M, K; cin >> N >> M >> K; ll inf = 1e18; ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.util.Collec...
JAVA
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MaxN = 1e5, MaxV = 1e6; const long long inf = 1LL << 60; int n, m, k; struct NODE { int d, u, v, c; } box[MaxV + 5]; int ok[MaxN + 5]; long long f[MaxV + 5], t[MaxV + 5]; bool cmp(NODE x, NODE y) { return x.d < y.d; } int main() { while (~scanf("%d %d %d", &n,...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; const int md = 5e6; struct node { int t, v, cost; bool operator<(const node &nd) const { return t < nd.t; } }; vector<node> vec1; vector<node> vec2; bool vis[maxn]; long long pre[md + 5], suf[md + 5], Min[maxn]; int main() { int n, m, k, u, v...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:10240000") using namespace std; const int MAXN = 100010; struct tnode { int d, f, t; long long c; } a[MAXN]; int sta[MAXN][2]; long long all[MAXN][2], times[MAXN][2]; bool cmp(tnode a, tnode b) { return a.d < b.d; } int main() { int n, m, k; scanf("%d%d%d...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; template <class S, class T> ostream& operator<<(ostream& o, const pair<S, T>& p) { return o << "(" << p.first << "," << p.second << ")"; } template <class T> ostream& operator<<(ostream& o, const vector<T>& vc) { o << "sz = " << vc.size() << endl << "["; for (const T&...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; struct pl { int d, i, c; }; int n, dmx = 0, k; long long ci[((int)(1e6)) + 1000], co[((int)(1e6)) + 1000]; int mp[((int)(1e5)) + 1000]; vector<pl> pli, plo; bool cmpl(const pl &a, const pl &b) { return a.d < b.d; } bool cmpg(const pl &a, const pl &b) { return a.d > b.d; }...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e6 + 10; const long long myINF = 1e12 + 5; const long long mod = 1e9 + 7; const long long INF = 1e9; inline long long bpow(long long t, long long n) { long long ans = 1; while (n > 0) { if (n & 1) ans = (ans * t) % mod; t = (t * t) % mod, n >>...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> const int N = 200005; using namespace std; long long read() { long long x = 0, f = 1; char c; do { c = getchar(); if (c == '-') f = -1; } while (c < '0' || c > '9'); while ('0' <= c && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return x * f; } int i, l,...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 69; const long long INF = 1e18; struct item { long long d, fr, to, c; }; bool cmp(item a, item b) { return a.d < b.d; } item a[MAXN]; long long pr[MAXN], suf[MAXN]; long long go[MAXN]; long long n, m, k; int main() { cin >> n >> m >> k; for (lon...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } vector<vector<pair<int, int> > > dict; vector<pair<int, pair<int, int> > > arr, depart; vector<int> best; long long totdep[1000050], totarr[1000050]; int main() { int n, m, k; int mxDay = 0; sca...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.writ...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; const int maxn = 1000000 + 10; const long long INF = 200000000000LL; int n, m, k; vector<pair<int, int> > in[maxn], out[maxn]; long long pre[maxn], suf[maxn]; long long minc[100000 + 10]; int main() { scanf("%d%d%d", &n, &m, &k); int maxd = 1; for (int i = 0; i < m; i...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; template <class P, class Q> inline void smin(P &a, Q b) { if (b < a) a = b; } template <class P, class Q> inline void smax(P &a, Q b) { if (a < b) a = b; } const long long inf = (long long)1e17; const int maxd = 1000000 + 100; const int maxn = 100000 + 100; int n, m, k;...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long occp[1000010], occs[1000010], sizep[1000010], sizes[1000010], costp[1000010], costs[1000010]; struct flight { long long cost, dep, dest; flight(long long a = 0, long long b = 0, long long c = 0) { cost = a; dep = b; dest = c; } }; vector<flig...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; using namespace std; const long long nDays = 1000005; int main() { cin.sync_with_stdio(0); long long n, m, k; cin >> n >> m >> k; vector<vector<pair<long long, long long> > > from(nDays); vector<vector<pair<long long, long long> > > to(nDays); for (long long i =...
CPP
854_D. Jury Meeting
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for...
2
10
#include <bits/stdc++.h> using namespace std; long long int MOD = 1000000007; long long int powe(long long int a, long long int b) { long long int x = 1, y = a; while (b > 0) { if (b % 2 == 1) { x = (x * y); x %= MOD; } y = (y * y); y %= MOD; b /= 2; } return x; } long long int I...
CPP