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 |
|---|---|---|---|---|---|
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def town():
x1, y1= [int(i) for i in input().split()]
x2, y2= [int(i) for i in input().split()]
n= int(input())
ans= 0
for i in range(n):
a, b, c= [int(k) for k in input().split()]
if (a*x1 + b*y1 + c< 0 and a*x2 + b*y2 + c> 0) or (a*x1 + b*y1 + c> 0 and a*x2 + b*y2 + c< 0):
... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CrazyTown {
static final double EPS = 1e-9;
static class Point {
double x, y;
Point(double a, double b) {
x = a;
y = b;
}
boolean ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | x1, y1 = (int(s) for s in input().split())
x2, y2 = (int(s) for s in input().split())
n = int(input())
res=0
for i in range(n):
a,b,c = (int(s) for s in input().split())
if((a*x1 + b*y1 + c) * (a*x2 + b*y2 + c) < 0):
res+=1
print(res) | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | x1,y1=map(int,raw_input().split())
x2,y2=map(int,raw_input().split())
ans=0
for _ in range(input()):
a,b,c=map(int,raw_input().split())
if (a*x1+b*y1+c)*(a*x2+b*y2+c)<0:
ans+=1
print ans | PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.*;
import java.util.StringTokenizer;
public class A {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void solve() throws IOException {
long x1 = readInt();
long... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
void solve() {
long long x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
int ans = 0;
long long a, b, c;
for (int i = 0; i < n; ++i) {
cin >> a >> b >> c;
long long v1 = a * x1 + b * y1 + c;
long long v2 = a... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct pt {
double x, y;
};
struct line {
double a, b, c;
};
const double EPS = 1e-9;
double det(double a, double b, double c, double d) { return a * d - b * c; }
bool intersect(line m, line n, pt& res) {
double zn = det(m.a, m.b, n.a, n.b);
if (abs(zn) < EPS) retur... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct road {
float a;
float b;
float c;
};
int steps = 0;
int number;
road *ways = new road[320];
struct point {
float x;
float y;
};
point home;
point university;
float miny;
float maxy;
float minx;
float maxx;
bool crossing(int i) {
if (ways[0].a != 0) {
... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int ans = 0;
double x1, y1, x2, y2;
scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
double l1 = a * x1 + b * y1 + c;
double l2 = a * x2 ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.*;
public class Main{
public static void main(String [] args) {
Scanner sc=new Scanner(System.in);
long x=sc.nextLong();
long y=sc.nextLong();
long x1=sc.nextLong();
long y1=sc.nextLong();
int a=sc.nextInt();
long count=0;
for(int i=0;i<a;i++) {
int xx=sc.nextInt();
int yy=sc.nex... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class CrazyTown {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
double X1 = sc.nextDouble();
double Y1 = sc.nextDouble();
double X2 = sc.nextDoubl... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | // All important imports
import java.awt.Point;
import static java.lang.System.in;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1000000;
int N;
long long t[2 * maxN];
void modify(int p, int v) {
p += N;
t[p] = v;
while (p >>= 1) {
t[p] = t[2 * p] + t[2 * p + 1];
}
}
long long query(int l, int r) {
l += N, r += N;
long long sum = 0;
for (; l < r; l >>= 1, r >>= 1) {... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static class point{
double x;
double y;
public point(double x, double y) {
this.x = x;
this.y = y;
}
... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long int x1, x2, y, y2, a, b, c, counter, n, i, temp1, temp2;
int main() {
counter = 0;
cin >> x1 >> y;
cin >> x2 >> y2;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b >> c;
temp1 = (a * x1) + (b * y) + c;
temp2 = (a * x2) + (b * y2) + c;
t... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int sign(long long x1, long long x2, long long a1, long long b1, long long c1) {
long long a = ((x1 * a1) + (x2 * b1) + c1);
return a > 0 ? 1ll : ((a == 0) ? 0ll : -1ll);
}
int main() {
long long n, i, ans = 0, x1, y1, x2, y2, a1, b1, c1, a2, b2, c2;
scanf("%I64d%I6... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int Case = 1, n, m, x1, y1, x2, y2, a, b, c;
char dump[2];
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
long long int X = (a * x1) + (b * y1) + c;
long long int Y = (a * ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct line {
long long int a, b, c;
};
int main() {
long long int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
long long int n;
cin >> n;
vector<line> data(n);
for (auto &p : data) {
cin >> p.a >> p.b >> p.c;
}
vector<bool> s1(n), s2(n);
for (int i ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long int x, y, x2, y2, a, b, c, n, d[307];
string s1[3007], s2[3007], les[3007];
void solve() {
long long int i, last = 1, l, j, s = 0, q, w, e, r, t, k = 0;
scanf("%I64d", &n);
for (i = 0; i < n; i++) {
scanf("%I64d%I64d%I64d", &a, &b, &c);
q = a * x;
... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
int main() {
ios_base::sync_with_stdio(0);
int ans = 0;
long long m, n, p, q;
cin >> m >> n >> p >> q;
int Q;
cin >> Q;
long long a, b, c;
for (int i = 0; i < Q; i++) {
cin >> a >> b >> c;
long l... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
long long cross(pair<long long, long long> o1, pair<long long, long long> o2,
pair<long long, long long> o3) {
o2.first -= o1.first;
o3.first -= o1.first;
o2.second -= o1.second;
o3.second -= o1.second;
return o2.first * o3.secon... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | 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.StringTokenizer;
public class A {
static StringTokenizer st;
static BufferedReader br;
static PrintWr... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x1, x2, y1, y2, n;
vector<long long> a, b, c;
cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> n;
for (long i = 0; i < n; i++) {
long t1, t2, t3;
cin >> t1 >> t2 >> t3;
a.push_back(t1);
b.push_back(t2);
c.push_back(t3);
}
l... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import math
import sys,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
def line(l,p):
d=(l[0]*p[0]+l[1]*p[1]+l[2])
if(d>0):
return 1
... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def sign(x):
return (x>=0)*2-1
x1,y1=list(map(int,input().split(" ")))
x2,y2=list(map(int,input().split(" ")))
n=int(input())
count=0
for _ in range(n):
a,b,c=list(map(int,input().split(' ')))
if sign(a*x1+b*y1+c)*sign(a*x2+b*y2+c)==-1:
count+=1
print(count) | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> home;
pair<long long, long long> school;
long long xa, xb, xc;
long long a[300];
long long b[300];
long long c[300];
bool cut(int);
int main() {
cin >> home.first >> home.second;
cin >> school.first >> school.second;
cin >> n;
int r... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
bool side_line(long long int a, long long int b, long long int c,
long long int ax, long long int ay, long long int bx,
long long int by) {
long long int v1 = a * ax + b * ay + c;
long long int v2 = a * bx + b * by + c;
if (v1 > 0 && v2 <... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x1, x2, y1, y2;
long long i, n, a, b, c;
long long sum1, sum2, cnt = 0;
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b >> c;
sum1 = a * x1 + b * y1 + c;
sum2 = a * x2 + b * y2 + c;
if ((sum1 ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T>
inline bool fs(T &x) {
int c = getchar();
int sgn = 1;
while (~c && c < '0... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def getMinSteps(x1, y1, x2, y2, n, lines):
min_steps = 0
for i in range(n):
a = lines[i][0]
b = lines[i][1]
c = lines[i][2]
if (a*x1+b*y1+c)*(a*x2+b*y2+c) < 0:
min_steps+=1
return min_steps
x1, y1 = [int(x) for x in input().split()]
x2, y2 = [int(x) for x in input... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
List<Integer>[] g;
int[] mt;
boolean[] u... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | x1,y1=raw_input().split()
x1,y1=int(x1),int(y1)
x2,y2=raw_input().split()
x2,y2=int(x2),int(y2)
n=int(raw_input())
a,b,c=[],[],[]
for i in range(n):
x,y,z=raw_input().split()
a.append(int(x))
b.append(int(y))
c.append(int(z))
m=0
for i in range(n):
if (a[i]*x1+b[i]*y1+c[i])>0 and (a[i]*x2+b[i]*y2+c[... | PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long ax, ay, bx, by;
int N;
bool above(long long a, long long b, long long c, long long x, long long y) {
if (b == 0) return x * a > -c;
return a * x + b * y + c > 0;
}
int main() {
cin >> ax >> ay >> bx >> by;
int ans = 0;
cin >> N;
for (int i = 0; i < N; ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CrazyTownFinal {
static double max=1e7;
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int x1=sc.n... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
int m;
int k;
int b;
int n;
String s;
String ns = "";
boolean[] use;
long c = 0;
int[... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
scanf("%d%d", &x1, &y1);
scanf("%d%d", &x2, &y2);
int n;
scanf("%d", &n);
int res = 0;
for (int i = 0; i < n; i++) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
long long t1, t2;
t1 = (long long)a * x1 + (long lon... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
public class C{
static class Point{
long x; long y;
public Point(long x, long y){
this.x = x; this.y = y;
}
public boolean onSameSide(Point p, long a, long b, long c){
long sign1 = (this.x * a) + (this.y * b) + c;
long sign2 = (p.x * a) + (p.y * b) + c;
if ((si... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.*;
import java.lang.reflect.Array;
import java.math.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.Line2D;
import javax.naming.BinaryRefAddr;
public class Main{
static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 310;
struct pnt {
long long x, y;
};
struct line {
long long a, b, c;
};
pnt home, uni;
line l[maxn];
int n;
int main() {
cin >> home.x >> home.y >> uni.x >> uni.y;
cin >> n;
long long a, b, c, ans = 0;
for (int i = 0; i < n; i++) {
cin >> a... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int solve() {
long long x, y, x1, y1, n;
long long a, b, c;
long long cnt = 0;
cin >> x >> y >> x1 >> y1;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
if ((a * x + b * y + c < 0) ^ (a * x1 + b * y1 + c < 0)) cnt++;
}
cout << cnt;
ret... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
int main() {
long long x1, x2, y1, y2, n;
scanf("%lld%lld", &x1, &y1);
scanf("%lld%lld", &x2, &y2);
scanf("%lld", &n);
long long ans = 0;
for (long long i = 0; i < n; i++) {
long long a, b, c;
scanf("%lld%lld%lld", &a, &b, &c);
long long s1 = a * x1 + b * y1 + c;
lon... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def between(x, x1, x2):
left = x1
if x2 < x1: left = x2
right = x1 + x2 - left
if left < x and x < right: return True
return False
x1, y1 = map(float, raw_input().split())
x2, y2 = map(float, raw_input().split())
a1 = (y2-y1)
b1 = (x1-x2)
c1 = y1*(x2-x1) + x1*(y1-y2)
ans = 0
n = int(raw_input())... | PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
public class TaskA {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long x1 = sc.nextLong();
long y1 = sc.nextLong();
long x2 = sc.nextLong();
long y2 = sc.nextLong();
long n = sc.nextLong();
long step... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import math
def get_n():
return int(input())
def get_int_vector():
return [int(x) for x in input().split()]
def list2string(list):
result = []
for i in list:
result.append(str(i))
return ':'.join(result)
def string2vector(string):
return [int(x) for x in string.split(':')]
b_x, b_y ... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x, y, v, w;
cin >> x >> y >> v >> w;
cin >> n;
int cnt = 0;
for (int i = 0; i < n; i++) {
long long a, b, c;
scanf("%lld%lld%lld", &a, &b, &c);
if (a * x + b * y + c < 0 and a * v + b * w + c > 0)
cnt++;
else if (a *... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeMap;
import java.util.Vecto... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) {
if (!a) return b;
return GCD(b % a, a);
}
int main() {
clock_t startTime = clock();
ios_base::sync_with_stdio(false);
long long mx, my;
cin >> mx >> my;
long long ux, uy;
cin >> ux >> uy;
int ans = 0;
int n;
cin >> n;
for (int... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
Point(){};
Point(double _x, double _y) : x(_x), y(_y) {}
double operator^(const Point &B) const { return x * B.y - y * B.x; }
double operator*(const Point &B) const { return x * B.x + y * B.y; }
Point operator-(const Point &B) const {... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
int r = 0;
for (int i = 0; i < n; ++i) {
long long a, b, c;
cin >> a >> b >> c;
if (((a * x1 + b * y1 + c) > 0 && (a * x2 + b * y2 + c) < 0) ||
((a * x1 + b ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mod2 = 998244353;
void fact_init(int n);
long long exp(long long taban, long long us, long long md);
long long ebob(long long a, long long b);
long long ekok(long long a, long long b);
long long komb(long long a, long long b);
vector<long ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int oo = (1e9) + 7;
long long oo2 = 1ll * oo * oo;
struct ponto {
long long a, b, c;
};
int main() {
int x1, y1, x2, y2, n;
cin >> x1 >> y1 >> x2 >> y2 >> n;
vector<ponto> vp;
long long a, b, c;
int pta, ptb;
for (int i = 0; i < n; ++i) {
scanf("%lld %lld ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.*;
import java.io.*;
public class A498 {
public static void main(String[] args) throws Exception {
long sx = i(), sy = i(), ex = i(), ey = i();
long n = i();
int cross = 0;
for (int i = 0; i < n; i++) {
long a = i(), b = i(), c = i();
long s = (long)Math.signum(a * sx + b * sy + c)... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | hm = list(map(int, input().split()))
sc = list(map(int, input().split()))
n = int(input())
cnt = 0
for i in range(n):
a,b,c = list(map(int, input().split()))
if (a*hm[0] + b*hm[1] + c) * (a*sc[0] + b*sc[1] + c) < 0:
cnt+=1
print(cnt)
| PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import sys
import time
from sys import stderr
from typing import Union
INF = 10 ** 18 + 3
EPS = 1e-10
MAX_CACHE = 10 ** 9
# Decorators
def print_to_file(function, file=stderr):
def wrapped(*args, **kwargs):
res = function(*args, **kwargs)
print(res, file=file)
file.flush()
return ... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const double pi = 4 * atan(1);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
const int LEN = 330;
int main() {
long long x1, y1, x2, y2;
long long n;
long long arr[LEN][3];
long long x, y;
cin >> x... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long abss(long long n) {
if (n < 0) n *= -1;
return n;
}
int main() {
long long x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
int ans = 0;
while (n--) {
long long a, b, c;
cin >> a >> b >> c;
long long p = (x1 * a) + (y1 * b)... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | x1, y1 = list(map(int, input().split()))
x2, y2 = list(map(int, input().split()))
n = int(input())
r = 0
for i in range(n):
q = list(map(int, input().split()))
r = r + ((q[0]*x1+q[1]*y1+q[2])*(q[0]*x2+q[1]*y2+q[2])<0)
print(r) | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.io.*;
import java.util.*;
public class Cf499C {
public static void main(String args[]) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
long px = in.nextInt();
long py = in.nextInt();
long qx = in.ne... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.read... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long n, a[305], b[305], c[305], mx, my, ux, uy;
long long f(int i, int x, int y) { return a[i] * x + b[i] * y + c[i]; }
bool does_intersect(int i) {
if (f(i, mx, my) > 0 && f(i, ux, uy) < 0) return true;
if (f(i, mx, my) < 0 && f(i, ux, uy) > 0) return true;
retu... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String l[]=sc.nextLine().split(" ");
long x1=Integer.parseInt(l[0]);
long y1=Integer.parseInt(l[1]);
l=sc.nextLine().split(" ");
long x2=Integer.parseInt(l[0]);
long y2=Integer... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
public class CF284C {
private static class Point {
double x;
double y;
public Point(final double x, final double y) {
this.x = x;
this.y = y;
}
}
public static void main(final String[] args) {
Scanner sc = new Scan... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
Point() {}
Point(double x, double y) : x(x), y(y) {}
Point(const Point &p) : x(p.x), y(p.y) {}
Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
Point operator-(const Point &p) const { return Point(x - p.x, y -... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long double xx1, xx2, yy1, yy2;
int n;
int main() {
cin >> xx1 >> yy1 >> xx2 >> yy2;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
long double a, b, c;
cin >> a >> b >> c;
long double Y1 = -(a * xx1 + c) / b;
long double Y2 = -(a * xx2 + c) /... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.*;
import java.util.*;
import javax.management.InstanceNotFoundException;
public class A {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
double INF = 100_000_000;
public void run() {
int x1 ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | s = tuple(map(int, input().split()))
e = tuple(map(int, input().split()))
r = 0
n = int(input())
while n != 0:
n -= 1
a, b, c = map(int, input().split())
if a == 0 or b == 0:
if a == 0:
p1, p2 = (0, -c/b), (1, -c/b)
else:
p1, p2 = (-c/a, 0), (-c/a, 1)
else:
## ... | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
struct node {
double a, b, c;
} q[10086];
int main() {
double sx, sy;
double ex, ey;
scanf("%lf%lf", &sx, &sy);
scanf("%lf%lf", &ex, &ey);
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%lf%lf%lf", &q[i].a, &q[i].b, &q[i].c);
}
if (ex ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def getSign(x, y, a, b, c):
if a * x + b * y + c > 0:
return 1
else:
return -1
x1, y1 = map(int, raw_input().split(' '))
x2, y2 = map(int, raw_input().split(' '))
n = int(raw_input())
res = 0
for i in range(n):
a, b, c = map(int, raw_input().split(' '))
if getSign(x1, y1, a, b, c) * get... | PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
/**
* Created by Admin on 12/24/2014.
*/
public class CF_284_C {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
long x1 = sc.nextInt();
long y1 = sc.nextInt();
long x2 = sc.nextInt();
long y2 = sc.nextInt();
i... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | def read():
return map(int, input().split())
x1, y1 = read()
x2, y2 = read()
n, = read()
ans = 0
for _ in range(n):
ai, bi, ci = read()
home = ai * x1 + bi * y1 + ci
uni = ai * x2 + bi * y2 + ci
if (home // abs(home)) * (uni // abs(uni)) < 0:
ans += 1
print(ans) | PYTHON3 |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int Case = 1, n, m, x1, y1, x2, y2, a, b, c;
char dump[2];
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
long long int X = (a * x1) + (b * y1) + c;
long long int Y = (a * ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.util.Scanner;
public class C284DIV2_C {
public static void main(String args[]){
Scanner s=new Scanner(System.in);
long x1=s.nextLong();
long y1=s.nextLong();
long x2=s.nextLong();
long y2=s.nextLong();
int n=s.nextInt();
long a[]=new long[n];
long b[]=new long[n];
long c[]=new long[n]... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | x1, y1 = [int(x) for x in raw_input().split(' ')]
x2, y2 = [int(x) for x in raw_input().split(' ')]
n = raw_input()
ans = 0
for i in range(0, int(n)):
a, b, c = [int(x) for x in raw_input().split(' ')]
if(a*x1 + b*y1 + c > 0 and a*x2 + b*y2 + c < 0) or (a*x1 + b*y1 + c < 0 and a*x2 + b*y2 + c > 0):
ans ... | PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int x1, x2, y1, y2, n, counter = 0, a, b, c;
cin >> x1 >> y1 >> x2 >> y2 >> n;
for (long long int i = 0; i < n; i++) {
cin >> a >> b >> c;
if (((x1 * a) + (y1 * b) + c) > 0 && ((x2 * a) + (y2 * b) + c) < 0)
counter++;
else if (... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Vector2 home = new Vector2(sc.nextInt(),sc.nextInt());
Vector2 univ = new Vector2(sc.nextInt(),sc.nextInt());
int ans = 0;
int n = sc.nextInt();
for(int i=0;i<n;i++) {
long a = s... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, a1, b1;
while (~scanf("%lld%lld%lld%lld", &a, &b, &a1, &b1)) {
int n;
scanf("%d", &n);
int ans = 0;
for (int i = 0; i < n; i++) {
long long c, d, e;
scanf("%lld%lld%lld", &c, &e, &d);
if (c * a + b * e + d >... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | /**
* Created by ankeet on 11/8/16.
*/
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A498 {
static FastReader in = null;
static PrintWriter out = null;
public static void solve()
... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T>
ostream &operator<<(ostream &os, const ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author dipankar12
*/
import java.io.*;
import java.util.*;
public class r284a {
public static void main(String args[])... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
bool jolmetsz(long long a, long long b, long long c, long long x1, long long y1,
long long x2, long long y2) {
return -c - a * x1 < b * y1 && -c - a * x2 > b * y2;
}
int main() {
long long x1, x2, y1, y2, n, db = 0;
cin >> x1 >> y1 >> x2 >> y2 >> n;
if... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.Arrays;
import java.util.Scanner;
public class MainC {
MyScanner sc = new MyScanner();
Scanner sc2 = new Scanner(System.in);
long start = System.currentTimeMillis();
long fin = System.currentTimeMillis();
final int MOD = 1000000007;
int[] dx = { 1, 0, 0, -1 };
int[] dy = { 0, 1, -1, 0 };
int ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | 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.Locale;
import java.util.StringTokenizer;
public class C {
static StringTokenizer st;
static BufferedReader br;
... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x, y;
long long x1, y1;
scanf("%I64d%I64d%I64d%I64d", &x, &y, &x1, &y1);
int n;
scanf("%d", &n);
long long cnt = 0;
while (n--) {
long long a, b, c;
scanf("%I64d%I64d%I64d", &a, &b, &c);
if (a * x + b * y + c > 0) {
if ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import sys
hx,hy = map(int,sys.stdin.readline().split())
ux,uy = map(int,sys.stdin.readline().split())
n = int(sys.stdin.readline())
counter = 0
for fruta in range(n):
a,b,c = map(int,sys.stdin.readline().split())
if (a*hx + b*hy + c)*(a*ux + b*uy + c) < 0:
counter += 1
print counter
| PYTHON |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int nax = 3e5 + 5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll sx, sy;
cin >> sx >> sy;
ll ex, ey;
cin >> ex >> ey;
int n;
cin >> n;
int ans = 0;
while (n--) {
ll a, b, c;
cin >> a >> b >> c;
l... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int first[2][2];
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
cin >> first[i][j];
}
}
int n;
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
int a, b, c;
cin >> a >> b >> c;
bool B[2];
for (int i =... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.util.*;
public class A
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
long x1 = in.nextInt();
long y1 = in.nextInt();
long x2 = in.nextInt();
long y2 = in.nextInt();
int n = in.nextInt();
int result = 0;
for(int x = 0; x < n; x++)
{
double ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class CrazyTown {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer tok;
static void sol... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x1, y1;
cin >> x1 >> y1;
long long x2, y2;
cin >> x2 >> y2;
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < n; i++) {
long long a, b, c;
cin >> a >> b >> c;
long long f = a * x1 + b * y1 + c;
long long ff = a * x2 + b... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class sou {
public static void main(String[]args) {
Scanner sc=new Scanner(System.in);
long x1=sc.nextLong();
long y1=sc.nextLong();
long x2=sc.nextLong();
long y2=sc.nextLong();
long n=sc.nextLo... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x1, y1, x2, y2, a, b, c;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
int ans = 0;
while (n--) {
cin >> a >> b >> c;
long long s1 = a * x1 + b * y1 + c;
long long s2 = a * x2 + b * y2 + c;
if ((s1 > 0 && s2 < 0) || (s1 < 0... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | JAVA |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
int main() {
long long hx, hy, ux, uy, a, b, c;
int n, step;
scanf("%I64d%I64d%I64d%I64d%d", &hx, &hy, &ux, &uy, &n);
step = 0;
while (n--) {
scanf("%I64d%I64d%I64d", &a, &b, &c);
if ((a * hx + b * hy + c > 0LL) ^ (a * ux + b * uy + c > 0LL)) step++;
}
printf("%d\n", step)... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int dev(int a, int b, int c, int x, int y) {
long long d = a * 1LL * x + b * 1LL * y + c;
if (d < 0) return -1;
if (d > 0) return 1;
return 0;
}
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
vector<int> d1(n), d2(n);
for ... | CPP |
498_A. Crazy Town | Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an intersection as the po... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
long long a, b, c;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
long long home = x1 * a + b * y1 + c;
long long varsity = x2 * a + b * y2 + c;
... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.