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; int quick_pow(int a, int b, int MOD) { a %= MOD; int res = 1; while (b) { if (b & 1) res = (res * a) % MOD; b /= 2; a = (a * a) % MOD; } return res; } const int maxn = 200000 + 10; const int MOD = 1e9 + 7; struct node { int f, t, c; } s[maxn]; int cm...
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 w[2050000], a[2050000], w1[2050000], b[2050000]; long long n, m, k; struct node { long long t; long long x; long long y; long long money; } f[2050000]; bool cmp(node x, node y) { if (x.y == 0 && y.y != 0) { return true; } else if (x.y != 0 && y.y =...
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.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; public class BirthdayOdds { static lon...
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; inline int min(int _a, int _b) { return _a < _b ? _a : _b; } inline int max(int _a, int _b) { return _a > _b ? _a : _b; } template <class T> inline void rd(T &_a) { int _f = 0, _ch = getchar(); _a = 0; while (_ch < '0' || _ch > '9') { if (_ch == '-') _f = 1; _...
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.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public clas...
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.math.*; import java.io.*; import java.util.*; public class Main{ static class Node implements Comparable<Node>{ int a; int b; int day; int cost; public Node(int a, int b, int day, int cost){ this.a = a; this.b = b; this.day = day; this.cost = cost; } public int compareTo(Node tha...
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 long long INF = 1e12; const int maxn = 1e6 + 5; int n, m, k; vector<pair<int, int> > st[maxn], fn[maxn]; long long b[maxn], e[maxn]; int main() { cin >> n >> m >> k; for (int i = 0; i < m; i++) { int d, f, t, c; cin >> d >> f >> t >> c; if (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> using namespace std; const int Maxn = 1e6 + 10; struct node { long long num, t, c; }; bool cmp1(node a, node b) { return a.t < b.t; } bool cmp2(node a, node b) { return a.t > b.t; } long long l[Maxn] = {}, r[Maxn] = {}, f[Maxn] = {}, vis1[Maxn] = {}, vis2[Maxn] = {}; vector<node> 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
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)1 << 61; struct data { int d, v, c; } a[110001], b[110001]; struct stcmp1 { bool operator()(int x, int y) { return a[x].c < a[y].c || a[x].c == a[y].c && x < y; } }; struct stcmp2 { bool operator()(int x, int y) { return b[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
#include <bits/stdc++.h> using namespace std; const long long INF = 1ll * 1e18; const int N = 1e5 + 5; struct node { int d, u, v, c; bool operator<(const node& t) const { return d < t.d; } } e[N]; int n, m, k, maxn, dis[N], d[N]; long long a[N * 20], b[N * 20]; inline int read() { int x = 0, f = 1; char ch = ge...
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 LLINF = 8e18; const int MOD = 1e9 + 7; const int INF = 2e9; const int N = 1e5; struct data { int day, from, to, cost; } a[N]; int n, m, k, cnt, j, was, will; int mn[N]; long long tmp, ans = LLINF; set<pair<int, int>> s[N]; bool cmp(data a, data b) { return...
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 T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } inline int read() { register int c = getchar(), sum(0), fg(1); while (c < '0' || 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; struct info { int d, f, t, cst; } inp[100006]; int forw[1000005]; int forw2[1000005]; long long cforw[1000005]; long long cforw2[1000005]; int ok[1000006]; int ok2[1000006]; bool cmp(info a, info b) { return a.d < b.d; } void process1(int prev, int day) { while (prev < ...
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> inline void gmin(T &x, const T &y) { if (x > y) x = y; } template <class T> inline void gmax(T &x, const T &y) { if (x < y) x = y; } const int BufferSize = 1 << 16; char buffer[BufferSize], *Bufferhead, *Buffertail; bool Terminal; inline char Getchar(...
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.util.*; import java.io.*; public class b implements Runnable { PrintWriter out; int n, m, k; long[] costs, retCosts; TreeMap<Long, Integer>[] rets; long oo = 1000000000000L; public void main() throws Throwable { FastScanner in = new FastScanner(System.in); out = new...
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 unsigned long long N = 2000005; const unsigned long long M = 10921000; const unsigned long long INF = (1LL << 50); const unsigned long long MOD = 1e9 + 7; const double eps = 1e-4; unsigned long long n, m, k; struct nd { unsigned long long d; unsigned long long u, ...
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 + 1; const long long inf = 1e18; int n, m, k; struct Flight { int d, s, t, c; } f[maxn]; long long mn[maxn], pre[maxn], s; vector<int> sw[maxn]; int cnt; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> 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; int n, m, k, t, x, y, z, l, r, cnt1, cnt2; struct edgm { int next, to, v; } e1[100100], e2[100100]; int head1[1000100], head2[1000100], c1[100100], c2[100100]; long long a[1000100], b[1000100], ans = -1; void add1() { e1[++cnt1].next = head1[t]; e1[cnt1].to = x; e1[...
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 = 100100; const int maxm = maxn * 30; const int mod = 1e9 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; struct node { int day, from, to, c; bool operator<(const node& p) const { return day < p.day; } } use[maxn]; bool lok[maxn...
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 = 1LL << 60; using P = pair<long long, long long>; template <class T> struct SegmentTree { using F = function<T(T, T)>; F f; T inf; long long n; vector<T> node; SegmentTree() {} SegmentTree(vector<T> v, T inf, F f) : inf(inf), f(f) { 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; struct moja { long long d, x, y, c; } r[100005]; int cmp(struct moja qq, struct moja ww) { if (qq.d != ww.d) { return qq.d < ww.d; } } long long q, i, dosao[100005], otisao[100005], usao, izasao, m, n, k, md[100005], mi[100005], sol, dsol[100005], isol[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
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 5, MAX = 1e6; vector<pair<int, int> > a[MAXN], b[MAXN]; long long cost[MAXN], prefc[MAXN], sufc[MAXN]; int preft[MAXN], suft[MAXN], N, M, K; int main() { scanf("%d %d %d", &N, &M, &K); for (int i = 1; i <= M; ++i) { int d, f, t, c; scanf("...
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:268435456") using namespace std; template <typename T> inline T abs(T a) { return ((a < 0) ? -a : a); } template <typename T> inline T sqr(T a) { return a * a; } template <class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; } template <class T> T lcm(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 pre[1000010]; long long suf[1000010]; int cost[100010]; int see[100010]; vector<int> f[1000010], t[1000010], c[1000010]; const int maxn = 1000000; const int inf = 1e9; const long long INF = 1e16; int main(int argc, char *argv[]) { 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
import java.io.*; import java.util.*; public class Main { private InputStream is; private PrintWriter out; int time = 0, DP[], start[], end[], dist[], black[], MOD = (int) (1e9 + 7), arr[], weight[][], x[], y[], parent[]; int MAX = 1000000, N, K; long red[]; ArrayList<Character>[] amp; ArrayList<Pair>[][] pm...
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 ticket { int day, start, end; long long cost; ticket(int day = 0, int start = 0, int end = 0, long long cost = 0) : day(day), start(start), end(end), cost(cost) {} bool operator<(ticket other) const { return day < other.day; } }; struct minimun_queue { ...
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 + 10; const int D = 1e6; const long long INF = 1e18; int n, m, k; priority_queue<pair<int, int> > Q[maxn]; vector<pair<int, int> > in[D + 10]; vector<int> out[D + 10]; long long cost[maxn]; long long ans = INF; void solve() { int count = 0; 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
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
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 = 1000005; struct node { int d, s, t; long long c; } a[maxn]; long long x[maxn], y[maxn], cost[maxn]; int cmp(node a, node b) { return a.d < b.d; } int main() { memset(cost, -1, sizeof(cost)); int n, m, k; scanf("%d%d%d", &n, &m, &k); for (int 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.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; const long long maxn = 1e5 + 5; struct node { long long a, b, c, d; }; node rec[maxn]; bool cmp(node x, node y) { return x.a < y.a; } struct node2 { long long num, cost; }; priority_queue<node2> q[maxn]; bool operator<(const node2 &x, const node2 &y) { return x.cost > y...
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 to, next, w; } ea[100010], eb[100010]; int n, m, k, t, x, y, z, st, ed, cnta, cntb, heada[1000010], headb[1000010], disa[100010], disb[100010]; long long ans = -1, a[1000010], b[1000010]; void adda() { ea[++cnta] = {x, heada[t], z}, heada[t] = cnta; ...
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 T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } void printDouble(double x, int n) { cout << fixed << setprecision(n); cout << x << endl; } const int MAXN = 5e6 + 5; const 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
import java.util.*; import java.io.*; import java.lang.Math.*; public class MainA { public static int mod = 20000; public static long[] val; public static long[] arr; static int max = (int) 1e9 + 7; public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = ne...
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 { int day, depCity, arrCity, cost; }; int bestArrCost[100002LL], bestDepCost[100002LL]; vector<pair<long long, int>> bestDep; vector<Flight> arrivals, departures; Flight f; int n, m, k; long long ans = 100002LL * 1000002LL; int main() { cin >> 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
/* Keep solving problems. */ import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000 * 1000 * 1000 + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = ...
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 main() { ios::sync_with_stdio(false); cin.tie(0); long long n, m, i, j, k, a, b, day, cost, ans, MAXX = 1000010, INF = 1LL << 60, INFF = 1E9, s, ct, x; cin >> n >> m >> k; vector<vector<pair<long long, long long>>> in(MAXX), out(MAXX); for (i = 0; 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 <typename _T> inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; } template <typename _T, typename... args> void _DBG(const char *s, _T x, args... a) { while (*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); } con...
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 OO = 1000000000; int a[100005], l[100005], f[100005], t[100005], c[100005], ta[1000005]; long long dp[1000005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, k, tl = 0, it = 0, te; cin >> n >> m >> k; vector<pair<int, int>> day; 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; using lli = long long int; using ld = long double; const int N = 1e6 + 1; const lli MOD = 998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, k; cin >> n >> m >> k; int d[N]; vector<pair<int, pair<int, int> > > ar...
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 { long long d, from, to, val; } a[250000]; long long vis[250000], l[250000], r[250000]; inline long long cmp(Node p, Node q) { return p.d < q.d; } int main() { long long n, m, k; scanf("%I64d%I64d%I64d", &n, &m, &k); memset(vis, 0, sizeof vis); memset(...
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 T> inline T abs(T t) { return t < 0 ? -t : t; } const long long modn = 1000000007; inline long long mod(long long x) { return x % modn; } const int MAXN = 2123456; const long long INF = 300000000000LL; int n, m, k; long long s[MAXN]; multiset<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
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Queue; import java.util.Scanner; import java.util.StringTokenizer; public class Main{ class My...
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; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } long long lcm(long long m, long long n) { return (m * n / gcd(m, n)); } vector<pair<long long, pair<long long, long long> > > A; vector<pair<pair<long long, long long>, pair<long long, 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; int n, m, k, t1, t2, tim; vector<int> type[2000010], a[2000010], b[2000010]; long long f[2000010], g[2000010]; bool ff[2000010], gg[2000010]; int t[2000010], tot; long long ans = 1e18; int main() { scanf("%d%d%d", &n, &m, &k); int x, y, z, w; for (int i = 1; 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; const int MOD = (int)1e9 + 7; const int MOD2 = 1007681537; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while (...
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 = 1e5 + 3; long long inf = 1e18 + 7; struct F { int day, des, cost; F(){}; F(int _d, int _des, int _c) : day(_d), des(_des), cost(_c){}; } arr[N], leav[N]; int m, m1 = 0, m2 = 0, n, k; long long ans = inf; bool used[N]; struct cmps { bool operator()(F 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
#include <bits/stdc++.h> using namespace std; const int N = 100100; const int M = 1001000; const int OO = 1e7; const long long OOLL = 1e14; int n, m, k; multiset<int> st[N]; vector<pair<int, int>> a[M], b[M]; int pr[N]; long long sum; int cnt; bool u[N]; void add_from(int idx, int price) { cnt += !u[idx]; u[idx] = ...
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 + 2; const int MAXL = 1e6 + 2; const int INF = 0x3f3f3f3f; const long long LINF = 1e11 + 1; vector<pair<int, int> > in[MAXN], out[MAXN]; int n, m, k; long long cost, ti[MAXL], to[MAXL]; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 0, d, 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
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> using namespace std; int n, m, k; const int MAXN = 1e5; const int MAXM = 1e5; const long long int INF = 1e15; struct Flight { int day; int departure; int arrival; int cost; Flight() {} Flight(int day, int departure, int arrival, int cost) { this->day = day; this->departure =...
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 day, city; long long cost; Flight(int d, int ci, int c) : day(d), city(ci), cost(c) {} }; long long cost[1000100]; long long tmp[100100]; int cnt[1000100]; bool cmp0(Flight f1, Flight f2) { return f1.day > f2.day; } bool cmp1(Flight f1, Flight f2) ...
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 = 100500; const int MAXD = 1000500; vector<pair<int, int>> inbound[MAXD]; vector<pair<int, int>> outbound[MAXD]; int minInbound[MAXN]; int maxOutbound[MAXN]; int mincost[MAXN]; unsigned long long total_cost_right[MAXD]; unsigned long long total_cost_left[MAXD...
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
def bs_ceil(arr, val): l, r = -1, len(arr) # 0 to n while r - l > 1: mid = (l + r) / 2 if arr[mid][0] >= val: r = mid else: l = mid return r n, m, k = map(int, raw_input().split()) D = [float('inf')] * (n + 1) A = [float('inf')] * (n + 1) arr1 = [] arr2 ...
PYTHON
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 N = 1e5 + 2, inf = (1ll << 60); long long n, m, k, val[N], inv[N], outv[N], ind[N], outd[N], ans = inf; struct node { long long d, f, t, c; bool operator<(const node &t) const { return d < t.d; } } p; vector<node> in, out; long long read() { 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; int Gcd(int a, int b) { if (b == 0) return a; return Gcd(b, a % b); } int Lcm(int a, int b) { return a / Gcd(a, b) * b; } inline long long read() { long long f = 1, x = 0; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -f; ch = getc...
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 ren { int sei, huafei; }; vector<ren> v[2][1000000 + 233]; long long f[1000000 + 233], mi[1000000 + 233] = {0}, answer, result = 233333333333; int n, m, k; void nico(ren a) { if (mi[a.sei] > a.huafei) answer -= (mi[a.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; const int maxn = 1000005; const long long mod = 1e9 + 7; const int INF = 0x3f3f3f3f; const double eps = 1e-9; int n, m, k; int dis[maxn]; long long ss[maxn], tt[maxn]; struct node { int d, u, v, c; } e[maxn]; bool cmp(const node &a, const node &b) { return a.d < b.d; } in...
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
/** * 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 Main { public static int index; public static void main(String[] args)throws Exception { SystemInputReader in = new Sys...
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 flight { int d, f, c; flight(int _d, int _f, int _c) { d = _d; f = _f; c = _c; } }; vector<flight> a, b; long long fa[100011], fb[100011]; int dau[100011]; bool cmp1(flight p, flight q) { return p.d < q.d; } bool cmp2(flight p, flight q...
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; vector<pair<int, int> > go[1000010], back[1000010]; multiset<int> goi[1000010], backi[1000010]; int curgo[1000010], curback[1000010]; int main() { int n, m, k, d, s, t, c; cin >> n >> m >> k; for (int i = 1; i <= m; ++i) { 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
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class B extends PrintWriter { class Flight implements Comparable<Flight> { final int d, f, t, c; public Flight(int d, int f, int t, int c) { this.d = ...
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.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.List; import java.util.PriorityQueue; public class JuryMeeting { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int n = sc.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; void getint(int &v) { char ch, fu = 0; for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ; if (ch == '-') fu = 1, ch = getchar(); for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0'; if (fu) v = -v; } const long long INF...
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 = 0x3f3f3f3f3f3f3f; long long pre[2000005]; long long suf[2000005]; bool vis[2000005]; long long now[2000005]; struct edge { int id; long long c; }; vector<edge> G1[2000005]; vector<edge> G2[2000005]; 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
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 50; ; const int M = 17; const int mod = 19260817; const int mo = 123; const double pi = acos(-1.0); long long qpow(int x, int qq) { long long f = 1, p = x; while (qq) { if (qq & 1) f = f * p % mod; p = 1LL * p * p % mod; qq >>= 1; } } 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 long long INF = 1e18L; const int inf = 0x3f3f3f3f; const int maxn = 1e6 + 5; const int N = 1e5 + 5; const int Mod = 1e9 + 7; struct node { int d, u, c; void init(int _d = 0, int _u = 0, int _c = 0) { d = _d; u = _u; c = _c; } friend bool operator<(...
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; int n, m, k; vector<pair<long long, int> > a[N], b[N]; int dd, xx, yy; long long cc; long long f1[N], f2[N]; long long c1[N], c2[N]; int g1[N], g2[N]; long long now; int ng; long long ans; bool cmp(const pair<long long, int> &a, const pair<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 double PI = acos(-1.0); double fRand(double fMin, double fMax) { double f = (double)rand() / RAND_MAX; return fMin + f * (fMax - fMin); } template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } template <class T> T max(T a, T b, T c) { return max...
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, iin, iout; vector<pair<int, int> > in[K], out[K]; int mnst[N], mnen[N]; long long st[K], en[K]; int main() { scanf("%d %d %d", &n, &m, &k); for (int i = 1, d, f, t, c; i <= m; i++) { 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; const long long INF = 1e12; const int INF1 = 1e7; const int maxn = 100000 + 10; int n, m, k; int fd, u, v, w; struct node { int to, cost, fd; } a[maxn], b[maxn]; bool cmp(node f, node g) { return f.fd < g.fd; } bool cmp1(node f, node g) { return f.fd > g.fd; } int ecnt = ...
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 func(void) { freopen("input.c", "r", stdin); freopen("output.c", "w", stdout); } void print(vector<long long> &v) { cout << v.size() << endl; for (int i = 0; i < v.size(); i++) { printf("%lld ", v[i]); } printf("\n"); } void print(vector<pair<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 N = 1e6; inline int getint() { int w = 0, q = 0; char c = getchar(); while ((c < '0' || c > '9') && c != '-') c = getchar(); if (c == '-') q = 1, c = getchar(); while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar(); return q ? -w : w; } stru...
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.math.BigInteger; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class Wtf { public static void main(String[] args) throws IOException { Ifmo ifmo = new Ifmo(); } } class Ifmo { ArrayList<Integer> Graph[]; int n, l, m, primes, timer; char[][] fie...
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; static inline void canhazfast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T extgcd(T a, T b, T &x, T &y) { T x0 = 1, y0 = 0, x1 = 0,...
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, len, cnt1, cnt2; long long f[2000009], mn[2000009]; struct node { int t, x, val; } a[2000009], b[2000009]; bool cmp(node u, node v) { return u.t < v.t; } int main() { scanf("%d%d%d", &n, &m, &k); int i, j, x, y, z, t; for (i = 1; i <= m; i++) { scan...
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 GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx") using namespace std; struct edge { int first, t, c; }; vector<edge> a[1000001]; long long d[1000001]; long long rd[1000001]; long long mn[100500]; int main() { ios_base::sync_with_stdio(false); cin....
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 + 5; const long long inf = 1e12; int n, m, k; vector<pair<int, int> > a[N], b[N]; long long mn1[N], mn2[N]; long long an1[N], an2[N]; int main() { cin >> n >> m >> k; for (int i = 0; i < m; ++i) { int d, f, t, c; scanf("%d %d %d %d", &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; int n, m, k, i, x, y, h[200010], t; long long ans, Ans, g[200010], f[200010]; struct mjj { int x, y, z; } a[200010]; bool cmp(mjj a, mjj b) { return a.x < b.x; } int main() { scanf("%d%d%d", &n, &m, &k); for (i = 1; i <= m; i++) { scanf("%d%d%d%d", &a[i].x, &x, &y...
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 dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1}; int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2}; int ky8[] = {2, -2, 1, -1, 2, -2, 1, -1}; long long bigmod(long long a, long long b, long long 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; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } bool isin( const pair<long long, tuple<long long, long long, long long> >& elem) { return get<1>(elem.second) == 0; } bool isout( const pair<long long, tuple<long long, long 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; int n, m, k; long long dp[2][1000005]; long long need[2][1000005]; struct node { int d, f, t, c; } a[100005]; int cmp(node u, node v) { return u.d < v.d; } const long long inf = 0x3f3f3f3f3f3f3f3f; int main() { int i; cin >> n >> m >> k; for (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
R=lambda :map(int,input().split()) n,m,k=R() F,T=[],[] ans=int(1e12) for i in range(m): d,f,t,c=R() if f:F.append((d,f,c)) else:T.append((-d,t,c)) for p in [F,T]: cost=[ans]*(n+1) s=n*ans q=[] p.sort() for d,t,c in p: #print(p) if c<cost[t]: #p...
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
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.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
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; using lint = long long; using ii = pair<int, int>; using il = pair<int, lint>; using ll = pair<lint, lint>; using ti = tuple<int, int, int>; const int N = 1e5 + 5; const int D = 1e6 + 5; const lint mod = 1e9 + 7; vector<il> in_air[D]; vector<il> out_air[D]; int n, m, k; voi...
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.*; public class D854 { public static void main(String[] args) throws IOException { IO io = new IO(System.in); int n = io.nextInt(); int m = io.nextInt(); int k = io.nextInt(); ArrayList<F> arrive = new ArrayList<>(); ArrayList<F> depart = new ArrayList<>(); ...
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 long long int N = 1e6 + 5; const long long int M = 1e5 + 5; const long long int mod = 1e9 + 7; const long long int m1 = 1e9 + 7; const long long int m2 = 1e9 + 9; const long long int p1 = 402653189; const long long int p2 = 1610612741; const int LN = 61; long long 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; long long gcd(long long n1, long long n2) { if (n2 == 0) return n1; if (n1 % n2 == 0) return n2; return gcd(n2, n1 % n2); } long long powmod(long long base, long long exponent) { if (exponent < 0) exponent += 1000000007LL - 1; long long ans = 1; while (exponent)...
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.util.*; import java.io.*; import java.math.*; public class Main implements Runnable{ FastScanner sc; PrintWriter pw; final class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { try { br = new BufferedReader(new ...
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 = 100005; struct node { int day, s, t, cost; bool operator<(const node &r) const { return day < r.day; } } e[maxn], g[maxn]; int vis[maxn]; long long cheap[1000000], ans = -1; int main() { int n, m, k, p1 = 0, p2 = 0; scanf("%d%d%d", &n, &m, &k); me...
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.util.*; public class JuryMeeting { private ArrayList <Node> arriving, departing; private int n, m, k; private long [] costOfArriving, costOfDeparting; public void minCostsArriving() { Map<Integer,Integer> mp=new HashMap<Integer,Integer>(); long cost=0; for(int i=0; i<arriving.size(); i++) { i...
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> #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,avx,avx2,abm,mmx") #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) { 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
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000ll; int N, M, K; long long L[1000005], Min[1000005], R[1000005]; vector<pair<int, int>> Go[1000005], Return[1000005]; int main() { cin >> N >> M >> K; for (int i = (1); i <= (M); i++) { int a, b, c, d; 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 maxn = 1e6 + 10; const long long oo = 1e12; const double eps = 1e-9; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, m, k; cin >> n >> m >> k; vector<vector<pair<long long, long long>>> A( n, vector<pair<long long, 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; long long add(long long a, long long b) { a += b; if (a >= 1000000007) a -= 1000000007; return a; } long long mul(long long a, long long b) { return ((a % 1000000007) * (b % 1000000007)) % 1000000007; } long long binary_expo(long long base, long long expo) { 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; struct point { long long date, city, cost; }; bool cmp(point x, point y) { return (x.city < y.city || x.city == y.city && x.date > y.date); } point a[2000050], b[2000050]; long long n, m, k, c1, c2, j, mc[2000050], md[2000050], p, lf, rt, cnt, sum1, sum2, ans; 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
def main(): n, m, k = map(int, input().split()) ff, tt = [], [] for _ in range(m): d, f, t, c = map(int, input().split()) if f: ff.append((d, f, c)) else: tt.append((-d, t, c)) for ft in ff, tt: cnt, costs = n, [1000001] * (n + 1) ft.sort(r...
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 N = 100005; multiset<pair<int, int> > from0[N * 10], to0[N * 10]; multiset<int> fromn[N], ton[N]; int c1 = 0, c2 = 0; long long cb = 0, ca = 0, ans = 1e15; void add(int i) { if (to0[i].empty()) return; for (auto &x : to0[i]) { int id = x.first, ct = x.seco...
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 = 200010; const int MAXM = 1000010; const long long INF = 1e12; const int mod = 1e9 + 7; long long read() { long long s = 0, f = 1; char ch = getchar(); while ('0' > ch || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while ('0' <= ch...
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
g = lambda: map(int, input().split()) n, m, k = g() F, T = [], [] e = int(3e11) for i in range(m): d, f, t, c = g() if f: F.append((d, f, c)) else: T.append((-d, t, c)) for p in [F, T]: C = [e] * (n + 1) s = n * e q = [] p.sort() for d, t, c in p: if C[t] > c: s +=...
PYTHON3