prompt string | response string |
|---|---|
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | 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... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
int n, m;
string s;
long long mem[(1 << 18)][105];
long long DP(int cur, int rem) {
if (cur == (1 << n) - 1) return rem == 0;
if (mem[cur][rem] == -1) {
long long ans = 0;
for (int i = 0; i < n; i++) {
if (!(cur & (1 << i))) {
ans += DP(cur | (1 <<... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
String n = in.next();
int m = in.nextInt();
byte[] nums = new byte[10];
for(char ch: n.toCharArray()) {
++nums[Character.digit(ch, 10)];
}
int... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... |
import java.io.*;
import java.util.*;
public class D {
static StringBuilder st = new StringBuilder();
static int n, m, a[];
static Long[][][][][][][][][][][][] memo;// idx , taken , mod , zero , one , two , three , four , five , six , seven , eight , nine
static int mult(int a , int b , int MOD) {re... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(String[] args) {
... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
S... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
string num;
long long dp[1 << 18][101];
long long mx;
int sz, m;
long long solve(long long mask, int md) {
if (mask == mx) {
if (md % m == 0) return 1;
return 0;
}
long long &ret = dp[mask][md];
if (ret != -1) return ret;
ret = 0;
bool vis[10];
memset(... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.*;
import java.util.*;
import java.math.*;
public class Sol4{
public static void main(String[] args) throws IOException{
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
String str = sc.nextToken();
int m= sc.nextInt();
int n = str.length();
long fact[] = ne... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
bool Check(long long n, long long pos) { return (n & (1 << pos)); }
long long Set(long long n, long long pos) { return (n | (1 << pos)); }
string s;
long long n, mod;
long long dp[(1 << 18) + 2][102];
long long call(long long mask, long long val) {
if (mask == (1 << n) - ... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class D implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
const long long N = 20;
long long n, m;
long long f[11];
vector<long long> v;
long long dp[1 << 18][100];
long long fact[N];
void precompute() {
fact[0] = fact[1] = 1;
for (long long i = 2; i < N; i++) {
fact[i] = fact[i - 1] * i;
}
}
void work(long long k) {
wh... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
vector<int> p, g;
long long n, f[2][27000][105];
int m, cnt[10];
int toInt(vector<int>& state) {
int res = 0;
for (int i = 0; i < int(p.size()); i++) {
if (state[i] == 0) continue;
res += state[i] * g[i + 1];
}
return res;
}
vector<int> toState(int s) {
ve... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
int dX[] = {0, 0, 1, -1};
int dY[] = {1, -1, 0, 0};
string alpha = "abcdefghijklmnopqrstuvwxyz";
int MOD = 1000000007;
const int N = 200100;
string s;
int m, arr[20], n;
long long dp[(1 << 18) + 5][100];
long long solve(int mask, int rem, bool f) {
if (mask == (1 << n) - ... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
bool Check(long long n, long long pos) { return (n & (1 << pos)); }
long long Set(long long n, long long pos) { return (n | (1 << pos)); }
string s;
long long n, mod;
long long dp[(1 << 18) + 2][102];
long long call(long long mask, long long val) {
if (mask == (1 << n) - ... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | //Author: net12k44
import java.io.*;
import java.util.*;
//public
class Main{//}
static PrintWriter out;
boolean check(int state, int a[] , int n){
boolean d[] = new boolean[10];
for(int i = 0; i < n; ++i)
if ( ( state & (1 << i) ) == 0 ) d[ a[i] ] = true; else
if ( d[a[i]] == true ) return false;
retur... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class _D {
static long dp[][],ten[];
static int len,arr[],m;
static long solve(int index, int mod,int mask){
if... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
string s;
int n, m;
long long dp[1 << 18][105];
long long power(int x, int p) {
if (p == 0) return 1;
return x * power(x, p - 1);
}
long long getCount(int mask, int mod) {
if (mask == (1 << n) - 1)
if (mod == 0)
return 1;
else
return 0;
long long... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
long long lp, numb[20], u;
long long dp[300000][105];
long long dmc(long long msk, long long mod) {
if (msk + 1 == (1 << u) && !(mod % lp)) return 1;
if (msk + 1 == (1 << u)) return 0;
if (dp[msk][mod] != -1) return dp[msk][mod];
long long i, j, res = 0, ty = 0;
f... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
new Task().solve(scanner, out);
scanner.close();
out.close();
}
}
class Task {
p... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | import java.io.*;
import java.util.*;
public class Main implements Runnable {
final boolean isFileIO = false;
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
String delim = " ";
public static void main(String[] args) {
new Thread(null, new Main(), "", 268435456).st... |
Problem: Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number n, modulo m.
Number x is considered close to num... | #include <bits/stdc++.h>
using namespace std;
void _fill_int(int* p, int val, int rep) {
int i;
for (i = 0; i < rep; i++) p[i] = val;
}
signed long long GETi() {
signed long long i;
scanf("%lld", &i);
return i;
}
signed long long N, M;
vector<signed long long> V;
signed long long powd[10][20];
signed long lon... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
const int N = 3000000 + 7;
int n, m;
int l[N], r[N];
int e[N];
std::vector<std::pair<int, int>> g[N];
int t[N];
int ans[N];
void dfs(int s);
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d%d", l + i, r + i), e[i] = l[i], e[i + n] = ++r[i];
std::sort(e + 1, e + n *... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
inline int get() {
char c;
while (!isdigit(c = getchar()))
;
int v = c - 48;
while (isdigit(c = getchar())) v = v * 10 + c - 48;
return v;
}
int n;
pair<int, int> a[200005];
bool vis[200005], c[200005];
vector<int> G[200005];
void dfs(int x, int col) {
vis[x... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int head[maxn], deg[maxn], ans[maxn], tot = 1;
struct edge {
int v, nex, id;
bool f;
} e[maxn << 4];
void add(int u, int v, int id) {
e[++tot] = {v, head[u], id, 0}, head[u] = tot;
e[++tot] = {u, head[v], id, 0}, head[v] = tot;
}
struct Q {... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, cl[N], l, r;
set<pair<pair<int, int>, int> > q;
vector<int> g[N];
void dfs(int v, int c = 0) {
cl[v] = c;
for (auto to : g[v]) {
if (cl[to] == -1) {
dfs(to, (c ^ 1));
}
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
template <typename _tp>
inline void read(_tp& x) {
char c11 = getchar(), ob = 0;
x = 0;
while (c11 != '-' && !isdigit(c11)) c11 = getchar();
if (c11 == '-') ob = 1, c11 = getchar();
while (isdigit(c11)) x = x * 10 + c11 - '0', c11 = getchar();
if (ob) x = -x;
}
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
bool cmp(int *a, int *b) { return *a < *b; }
int n;
int l[MAXN], r[MAXN];
int *ts[MAXN * 2];
vector<pair<int, int> > ls[MAXN * 2];
bool u[MAXN * 2];
bool sol[MAXN];
void tour(int a) {
for (pair<int, int> &e : ls[a])
if (!u[e.second]) {
i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int M = 1e5;
const int N = 2 * 1e6 + 5;
struct node {
int ver, next;
} e[N];
int tot, head[N];
int v[N];
int n, m;
multimap<int, int> h;
void add(int x, int y) {
e[++tot].ver = y;
e[tot].next = head[x];
head[x] = tot;
}
void dfs(int x,... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = int(2e5) + 10;
int n;
vector<int> E[MAX_N];
void addEdge(int u, int v) { E[u].push_back(v), E[v].push_back(u); }
int col[MAX_N];
void dfs(int u, int c) {
if (col[u] != -1) return;
col[u] = c;
for (vector<int>::iterator e = E[u].begin(); e != E[u].end... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
long long gi() {
long long x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f ? x : -x;
}
int fir[200010], dis[1000010], nxt[1000010], w[1000010], dir[1000010], id = 1;
void link(i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
const int maxm = 200007;
const int maxe = 400007;
struct node {
int from, to, nxt, id;
} e[maxe];
int l[maxn], r[maxn], a[maxm], head[maxm], vis[maxm], used[maxm], d[maxm],
c[maxm], top, tot;
void add(int u, int v, int id) {
e[tot].nxt = hea... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int ans = 0, fh = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') fh = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
return ans * fh;
}
const int maxn = 4e5;
int ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 510000;
struct node {
int to, next, id;
} a[N * 2];
int n, l[N], r[N], x[N], ls[N], tot = 1, ans[N], in[N], cnt;
bool V[N], v[N];
void addl(int x, int y, int id) {
a[++tot].to = y;
a[tot].next = ls[x];
a[tot].id = id;
ls[x] = tot;
in[y]++;
}
void d... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
long long c[300100], l[300100], r[300100], acc[300100];
set<long long> gr[300100];
void dfs(long long v) {
if (!gr[v].empty()) {
long long e = *gr[v].begin();
long long u = r[e] ^ l[e] ^ v;
gr[v].erase(e);
gr[u].erase(e);
if (v < u) c[e] = 1;
dfs(u... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int first = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar()) {
if (ch == '-') f = -1;
}
for (; isdigit(ch); ch = getchar()) {
first = first * 10 + ch - 48;
}
return first * f;
}
const int mxN = 2e5;
int n, en;
vec... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 190010;
bool cmp(int *a, int *b) { return *a < *b; }
int n;
int l[MAXN], r[MAXN];
int *ts[MAXN * 2];
vector<pair<int, int> > ls[MAXN * 2];
bool u[MAXN * 2];
bool sol[MAXN];
void tour(int a) {
for (pair<int, int> &e : ls[a])
if (!u[e.second]) {
i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
struct inter {
int l, r;
} I[600050];
struct point {
int next, to, w;
} ar[600050];
bool is[600050];
int a[600050], at, head[600050], art(1);
inline int lower(int, int, int, int*);
inline void read(int&), link(int, int, int), dfs(int);
int main() {
int n;
read(n);
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.*;
import java.util.*;
import static java.util.Arrays.sort;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args) {
if((new File("input.txt")).exists())
try {
System.setIn(new FileInputStream("input.txt"));
} catch... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 100005;
bool vis[maxn], par[maxn];
vector<int> edge[maxn];
pair<int, int> seg[maxn];
int n;
void add(int a, int b) { edge[a].push_back(b), edge[b].push_back(a); }
void dfs(int x, int cur) {
if (vis[x]) return;
vis[x] = true;
par[x] = cur;
for (i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.io.IOException;
import java.util.ArrayList;
import java.io.UncheckedIOException;
import java.util.List;
i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Collections.*;
import static java.lang.Math.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.*;
import static java.math.BigInteger.*;
public class Main{
void run(){
Loc... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 55;
int V[maxn], U[maxn];
unordered_map<int, int> M;
vector<int> comp;
bitset<maxn> mark, emark, ans;
vector<int> adj[maxn];
void dfs(int v, int E = -1) {
mark[v] = 1;
for (auto e : adj[v]) {
if (!emark[e]) {
emark[e] = 1;
dfs(V[e]... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int iinf = 1e9 + 7;
const long long linf = 1ll << 60;
const double dinf = 1e60;
template <typename T>
inline void scf(T &x) {
bool f = 0;
x = 0;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') {
f = 1;
c = ge... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e5 + 5;
const int IN = 1;
const int OUT = 0;
struct data {
int id, x, io;
data(int _id = 0, int _x = 0, int _io = 0) : id(_id), x(_x), io(_io) {}
bool operator<(const data& b) const { return x < b.x; }
} a[SIZE * 2];
int m = 0;
int to[SIZE * 2], an[S... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 600005;
int n, ct, cnt, e[Maxn], l[Maxn], r[Maxn], tmp[Maxn], deg[Maxn], head[Maxn];
struct edg {
int nxt, to;
bool dir;
} edge[2 * Maxn];
void add(int x, int y) {
deg[x]++;
edge[++cnt] = (edg){head[x], y};
head[x] = cnt;
}
void dfs(int u) {
for... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 10;
struct edge {
int y;
list<edge>::iterator rev;
edge(int y) : y(y) {}
};
list<edge> g[MAXN];
int pa[MAXN];
int find(int x) { return pa[x] = pa[x] == x ? x : find(pa[x]); }
void join(int x, int y) { pa[find(x)] = find(y); }
void add_edge(int a... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int P[2 * 110000], X[110000], Y[110000], use[2 * 110000], n, tot,
vis[2 * 110000], du[2 * 110000];
vector<pair<int, int> > E[2 * 110000];
void dfs(int x) {
vis[x] = 1;
for (auto i : E[x])
if (!use[i.second]) {
if (i.first > x)
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
template <class T>
void dbs(string str, T t) {
cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
int idx = str.find(',');
cerr << str.substr(0, idx) << " : " << t << ",";
dbs(str.substr(idx + 1), s...);
}
templat... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
struct node {
int x, id, op;
} a[200002];
struct edge {
int to, nxxt;
} e[200002 << 3];
int n, tot, js, head[200002 << 2], cnt = 2, dfn[200002], low[200002], f[200002],
cn, an;
bool inq[200002];
stack<int> s;
inline void ins(int u, int... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T>
bool chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
const int maxn = 2e5 + 1e2;
struct node {
int l, r;
} s[maxn];
struct Edge {
int to, nxt, id;
} e[maxn << 1];
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int head[200001], col[200001];
struct {
int v, link;
} e[2 * 200001];
int n, m;
void addEdge(int u, int v) {
e[m] = {v, head[u]};
head[u] = m++;
}
void dfs(int u, int c) {
if (col[u] != -1) return;
col[u] = c;
for (int i = head[u]; i != -1; i = e[i].link) dfs(e[... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int i, j, k, n, m;
struct Section {
int l, r;
} z[N];
int store[N * 2], tot;
bool cmp(int a, int b) { return a < b; }
int disva = 0;
map<int, int> s;
struct Edge {
int y, l, id;
bool enable;
} f[N * 4];
int g[N * 2], In[N * 2], T;
void Ins(int ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.*;
import java.util.*;
public class R245qE {
static int n;
static TreeSet<Pair> set;
static int ans[];
static ArrayList<Integer> g[];
@SuppressWarnings("unchecked")
public static void main(String args[]) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, cnt, now, id;
int l[N + 10], r[N + 10], a[(N << 1) + 10], degree[(N << 1) + 10], ans[N + 10];
bool vis[(N << 1) + 10], vis2[(N << 1) + 10];
struct edge {
int v, id;
edge(int v_, int id_) : v(v_), id(id_) {}
};
vector<edge> g[(N << 1) + 10];
voi... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:640000000")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = (int)2e5 + 10;
int l[maxn], r[maxn], x[maxn];
bool used[maxn], edge[maxn];
int col[maxn];
vector<pair<int, int> > g[maxn];
void dfs(int v) {
for (int i = 0;... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
using namespace std;
struct data {
int x, id;
bool operator<(const data &rhs) const { return x < rhs.x; }
} ds[200010];
int val[200010], lef[200010], righ[200010], n;
bool vi... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int n, tot, sum[200010];
int b[200010], l[200010], r[200010];
struct Node {
int to, nxt, id;
} Edge[200010 << 1];
int Head[200010], cnt_Edge = 1;
void Add_Edge(int u, int v, int id) {
Edge[++cnt_Edge] = (Node){v, Head[u], id};
Head[u] = cnt_Edge;
}
int ans[200010], vi... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int T = 1e5 + 5;
pair<pair<int, int>, int> d[T];
map<int, int> M;
int f[T], id[T], col[T];
int l;
vector<long long> g[T];
void DFS(int v, int c) {
col[v] = c;
for (int i = 0; i < g[v].size(); i++) {
int to = g[v][i];
if (col[to] == col[v]) {
cout << ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
int n, tot = 1, cnt;
int head[200001], ver[400001], next[400001], id[400001];
int l[100001], r[100001], deg[200001];
int vp[200001], ve[400001];
int x[200001];
int ans[100001];
void add(int u, int v) {
ver[++tot] = v;
next[tot] = head[u];
head[u] = tot;
}
void dfs(int p) {
vp[p] = 1;
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int Read() {
char c;
while (c = getchar(), (c != '-') && (c < '0' || c > '9'))
;
bool neg = (c == '-');
int ret = (neg ? 0 : c - 48);
while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
return neg ? -ret : ret;
}
const int MAXN = 200005;
pai... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
struct Range {
int left, right;
} seg[100000];
struct Edge {
int to, idx;
Edge() {}
Edge(int a, int b) : to(a), idx(b) {}
};
std::vector<Edge> g[2 * 100000];
int color[2 * 100000] = {};
void draw(int now) {
for (int i = 0; i < g[now].size(); i++) {
Edge e = g[now][i];
if (colo... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int L = 200100;
int n;
vector<int> a[L];
vector<pair<int, int> > b;
int col[L];
void ins(int x, int y) {
a[x].push_back(y);
a[y].push_back(x);
}
void dfs(int x, int c) {
if (col[x] != -1) return;
col[x] = c;
for (vector<int>::iterator e = a[x].begin(); e != ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const int E = 2e5 + 100;
int n;
int l[N], r[N];
vector<int> x;
vector<int> g[N];
vector<int> tour;
int to[E], mark[E], ecnt;
int from[E], c[E];
void add(int u, int v) {
from[ecnt] = u, to[ecnt] = v;
g[u].push_back(ecnt);
g[v].push_back(ecnt);
... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
vector<int> ed[401000], odd, cod[401000];
pair<int, int> e[401000];
int pathlen, x, y, n, m, tot, st[401000], pathedge[401000], b[401000],
path[401000], pr[401000];
bool don[401000], vis[402000];
void dfs(int x) {
don[x] = true;
for (int i = 0; i < (int)ed[x].size()... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 10;
constexpr int LG = 20;
constexpr int MOD = 1e9 + 7;
constexpr int MOD2 = 1e9 + 9;
int n, l, r, cl[N];
set<pair<int, pair<int, int>>> st;
void solve() {
if ((int)st.size() <= 1) return;
pair<int, pair<int, int>> aval = *st.begin();
st.erase(... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const double dInf = 1E90;
const long long lInf = (long long)1E16;
const int Inf = 0x23333333;
const int N = 300005;
struct edge {
int x, y, used, num, next;
} e[N << 1];
int a[N];
int cnt[N], ret[N];
bool vis[N];
int n, m, T = 2;
pair<int, int> A[N];
void mke(int x, int y... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, c, B[N], T[N];
pair<int, int> A[N];
map<int, int> M;
vector<int> Odd;
vector<pair<int, int> > V[N];
void Add(int v, int u, int i) {
V[v].push_back({u, i});
V[u].push_back({v, i});
}
void DFS(int v) {
while (V[v].size()) {
auto X = V[... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<int> adj[N];
vector<int> cur;
int l[N], r[N];
int d[N];
vector<int> fard;
bool mark[N];
vector<int> tour;
unordered_map<int, int> nist[N];
unordered_map<int, bool> ans[N];
void dfs(int x) {
mark[x] = 1;
for (int p : adj[x]) {
if (nist[x... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int p[maxn], w[maxn];
vector<pair<pair<int, int>, int>> a;
int find(int x) {
if (p[x] == x)
return x;
else {
int ret = find(p[x]);
w[x] ^= w[p[x]];
return p[x] = ret;
}
}
int main() {
int l, r, n;
cin >> n;
for (int i = 0... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0;
bool t = false;
char ch = getchar();
while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
if (ch == '-') t = true, ch = getchar();
while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
return t ? -x : x;
}
i... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
vector<int> g[N];
int col[N], u[N], v[N], mark[N], vis[N];
void dfs(int x, int y) {
if (y != -1) vis[y] = true;
mark[x] = true;
for (auto i : g[x])
if (!vis[i]) dfs(u[i] ^ v[i] ^ x, i);
if (y != -1) {
int o = u[y] ^ v[y] ^ x;
if (o... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int iinf = 1e9 + 7;
const long long linf = 1ll << 60;
const double dinf = 1e60;
template <typename T>
inline void scf(T &x) {
bool f = 0;
x = 0;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') {
f = 1;
c = ge... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
int id[N + N];
int a[N + N];
int where[N + N], color[N + N];
vector<int> E[N + N];
bool cmp(int i, int j) { return a[i] < a[j]; }
void dfs(int u, int c) {
if (color[u] == -1) {
color[u] = c;
} else {
return;
}
for (int v : E[u]) ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int n, l[100015], r[100015], o[100015 << 1], tot, cnt, ans[100015],
ind[100015 << 1], head[100015 << 1];
struct edge {
int to, next, w;
edge() {}
edge(int u, int v, int x) {
to = u;
next = v;
w = x;
}
} e[100015 << 2];
bool vis[100015 << 2], gkp[1000... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
int fs[MAXN];
int sc[MAXN];
int color[MAXN];
vector<int> g[MAXN];
bool dfs(int v, int c) {
if (color[v] != -1) {
return color[v] == c;
}
color[v] = c;
for (int i = 0; i < (int)g[v].size(); i++) {
if (!dfs(g[v][i], c ^ 1)) {
ret... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, nxt, w;
} e[400001];
int edge_num = -1;
int head[200001];
void add(int u, int v) {
e[++edge_num].nxt = head[u];
e[edge_num].to = v;
head[u] = edge_num;
}
void add_edge(int u, int v) {
add(u, v);
add(v, u);
}
struct node {
int l, r;
} q[20... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
pair<int, int> l[MAXN], r[MAXN], tot[MAXN * 2];
int n, cnt;
vector<int> G[MAXN * 2];
int col[MAXN * 2];
void dfs(int u, int c) {
if (col[u] != -1) return;
col[u] = c;
for (int i = 0; i < (int)G[u].size(); i++) dfs(G[u][i], c ^ 1);
}
int main... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int n, m, i, j, px[100005], py[100005], ans[100005], deg[200005], vis[200005],
vis2[400005];
vector<int> all;
vector<pair<int, int> > e[200005];
void dfs(int x) {
vis[x] = 1;
while (!e[x].empty()) {
if (vis2[e[x].back().second]) {
e[x].pop_back();
co... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, nxt, w;
} e[400001];
int edge_num = -1;
int head[400001];
void add(int u, int v) {
e[++edge_num].nxt = head[u];
e[edge_num].to = v;
head[u] = edge_num;
}
void add_edge(int u, int v) {
add(u, v);
add(v, u);
}
struct node {
int l, r;
} q[20... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
multimap<int, int> mp;
int n, L, R, head[200005], tot;
struct ccf {
int to, nxt;
} e[1000005];
void add(int a, int b) {
tot++;
e[tot].to = b;
e[tot].nxt = head[a];
head[a] = tot;
}
int vis[200005];
void dfs(int now, int se) {
if (vis[now]) return;
vis[now] = s... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
inline int gi() {
char c = getchar();
while (c < '0' || c > '9') c = getchar();
int sum = 0;
while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
return sum;
}
int n, l[maxn], r[maxn], ans[maxn], *q[maxn], num, cnt;
struct ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
namespace FGF {
const int N = 5e5 + 5;
struct edg {
int to, nxt;
} e[N];
int cnt = 1, l[N], r[N], c[N], n, tot, tp, st[N], vis[N], col[N], head[N],
du[N];
void add(int u, int v) {
cnt++;
e[cnt].to = v;
e[cnt].nxt = head[u];
head[u] = cnt;
du[u]++;
}
void dfs... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
pair<int, int> e[maxn];
int n;
int vis[maxn];
int deg[maxn];
vector<int> adj[maxn];
void dfs(int u) {
while (adj[u].size()) {
int tmp = adj[u].back();
adj[u].pop_back();
if (vis[tmp] == 0) {
if (deg[u] > 0)
vis[tmp] = 1 ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int N = 200 * 1000 + 10;
int n, cnt_e;
vector<int> adj[N], vec, ans, odd, tour;
vector<pii> ed;
map<pii, int> mp;
map<int, int> mp_ed;
set<int> vis;
void add_edge(int u, int v) {
cnt_e++;
mp_ed[cnt_e] = mp_ed[cnt_e] = u ^ v;
adj[u].pu... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
vector<int> e[210000];
int col[210000], n;
pair<int, int> p[210000];
void dfs(int u, int color) {
if (col[u] != -1) return;
col[u] = color;
for (int i = 0; i < (int)e[u].size(); ++i) dfs(e[u][i], color ^ 1);
}
void solve() {
for (int i = 0; i <= n * 2; ++i) e[i].cle... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int n;
struct aa {
int l, r;
} pp[201000];
vector<pair<int, int> > _hash;
vector<pair<int, int> >::iterator it;
int color[201000];
struct node {
int t, nxt;
} edge[201000 << 3];
int headline[201000], E;
inline void add(int f, int t) {
edge[E].t = t;
edge[E].nxt = he... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int n, m;
struct E {
int x, o, i;
} e[100010 << 1];
int cnt;
struct _E {
int ed, o, i, ne;
} _e[100010 << 3];
int in[100010 << 1], he[100010 << 1], en = 1;
bool vis[100010 << 3];
int path[100010 << 2], tot;
int ans[100010];
bool cmp1(E a, E b) { return a.x < b.x; }
bool... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
int n;
struct pii {
int p, t;
} P[1111111];
bool operator<(const pii x, const pii y) {
return (x.p != y.p) ? x.p < y.p : x.t > y.t;
}
std::vector<pii> v[1111111];
void ins(int x, int y, int z) {
if (x < 0) x = -x;
if (y < 0) y = -y;
v[x].push_back(pii{y, z}), v[y].push_back(pii{x, z})... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, sgn = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') sgn = -1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
return x * sgn;
}
const int N = 1e5 + 10;
int n, b[N << 1], tot, l[N], ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
char buf[100000], *p1 = buf, *p2 = buf;
inline int gi() {
int x = 0, f = 1;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar(... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.*;
import java.util.*;
public class Main {
private static Reader in;
private static PrintWriter out;
static class Interval implements Comparable<Interval> {
public int a, b, id;
public Interval(int a, int b, int id) {
this.a = a;
this.b = b;
this.id = id;
}
pub... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 400050;
int a[N], b[N], w[N], Id, d[N], nn[N][2], o[N], head[N], top, tot, bl[N], cnt,
vis[N], st[N], bj[N];
void dfs(int x) {
vis[x] = 1;
for (int i = head[x], y; i; i = nn[i][0])
if (!bj[bl[i]]) {
bj[bl[i]] = 1, dfs(y = nn[i][1]);
if ... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, int> > > v;
vector<pair<int, int> > e[100005];
int n, c[100005];
void dfs(int v, int n) {
c[v] = n;
for (int i = 0; i < e[v].size(); i++) {
if (c[e[v][i].first] == -1) {
dfs(e[v][i].first, (n ^ e[v][i].second));
}
}
}
int main(... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
int read() {
char ch = getchar();
int x = 0, fl = 1;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') fl = -1;
for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch - '0');
return x * fl;
}
const int N = 400005;
int n, l[N], r[N], num[N], len, d... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
qu[55];
int f, qr;
inline void flush() {
fwrite(obuf, 1, oS - obuf, stdout);
oS = obuf;
}
inline void putc(ch... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | import java.io.*;
import java.util.*;
public class R245qE {
static int n;
static TreeSet<Pair> set;
static int ans[];
static ArrayList<Integer> g[];
@SuppressWarnings("unchecked")
public static void main(String args[]) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 500010;
int tt = 1;
bool w[N], c[N];
int head[N], to[N], nxt[N], in[N], a[N], b[N], v[N];
inline int gi() {
int x = 0, o = 1;
char ch = getchar();
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') o = -1, ch = getchar();
whil... |
Problem: Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw n distinct segments ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
inline long long rd() {
long long x = 0, w = 1;
char ch = 0;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.