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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a[2], b[2];
cin >> a[0] >> a[1] >> b[0] >> b[1];
long long int n;
cin >> n;
int s[n][3];
long long int e = 0;
for (int i = 0; i < n; i++) {
cin >> s[i][0] >> s[i][1] >> s[i][2];
long long int m = a[0] * s[i][0] + a[1] * s[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;
int main() {
int N, resp = 0;
long long x1, y1, x2, y2, A, B, C;
cin >> x1 >> y1 >> x2 >> y2 >> N;
for (int i = 1; i <= N; i++) {
cin >> A >> B >> C;
if (((A * x1 + B * y1 + C) < 0LL && (A * x2 + B * y2 + C) > 0LL) ||
((A * x1 + B * y1 + C) > 0LL && ... | 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 a, b, c, x, y, p, q;
int main() {
cin >> x >> y >> p >> q;
int ans = 0;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
if ((a * x + b * y + c > 0) ^ (a * p + b * q + c > 0)) ans++;
}
cout << ans << endl;
return 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;
bool decreasing(int a, int b) { return a > b; }
const int base = 1000000000;
const int base_digits = 9;
struct bigint {
vector<int> a;
int sign;
bigint() : sign(1) {}
bigint(long long v) { *this = v; }
bigint(const string &s) { read(s); }
void operator=(const bi... | 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 | #br = open('c.in')
f = lambda: map(int, raw_input().strip().split())
x1, y1 = f()
x2, y2 = f()
n, r = f()[0], 0
def get(a, b, c, x, y):
return a * x + b * y + c
for i in range(n):
a, b, c = f()
if get(a, b, c, x1, y1) * get(a, b, c, x2, y2) < 0:
r += 1
print r
| 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 C285C2 {
public static void main(String[]args){
Scanner in=new Scanner(System.in);
double x1=in.nextDouble();
double y1=in.nextDouble();
double x2=in.nextDouble();
double y2=in.nextDouble();
int n=in.nextInt();
int sum=0;
for(int i=0;i<n;i++){
double a=in.next... | 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>
#pragma comment(linker, "/STACK:100000000000,100000000000")
using namespace std;
const double eps = 1E-9;
const double Exp = 2.718281828459045;
const double Pi = 3.1415926535897932;
const int NMAX = 300 + 5;
const int MMAX = 100000 + 5;
const int INF = 1000000000;
const int BASE = 1000000007;
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 | s=raw_input().split(" ")
x1=(int)(s[0])
y1=(int)(s[1])
s=raw_input().split(" ")
x2=(int)(s[0])
y2=(int)(s[1])
n=input()
ans=0
for i in xrange(n):
s=raw_input().split(" ")
a=(int)(s[0])
b=(int)(s[1])
c=(int)(s[2])
p=a*x1+b*y1+c
q=a*x2+b*y2+c
if(p<0 and q>0):
ans+=1
if(p>0 and q<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 | #include <bits/stdc++.h>
using namespace std;
int side(int a, int b, int c, int x, int y) {
long long s = (long long)a * x + (long long)b * y + c;
if (s > 0) return 1;
if (s == 0) return 0;
if (s < 0) return -1;
}
int main() {
int x1, y1, x2, y2, n, cnt = 0;
scanf("%d%d%d%d%d", &x1, &y1, &x2, &y2, &n);
fo... | 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 x_home, y_home, x_uni, y_uni;
cin >> x_home >> y_home >> x_uni >> y_uni;
int answer = 0;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
long long x, y, c;
cin >> x >> y >> c;
long long cmp1 = x_home * x + y_home * y + c;
lo... | 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 OO = 1e9;
const double EPS = 1e-9;
struct line {
long long a, b, c;
};
int main() {
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
long long x1, y1, x2, y2;
int n;
cin >> x1 >> y1 >> x2 >> y2 >> n;
line lines[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.*;
import java.util.*;
public class Solution {
static PrintWriter out=new PrintWriter(System.out);
public static void main (String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] input=br.readLine().trim().split(" ");
int x1=In... | 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 zuo {
long long a;
long long b;
long long c;
} biao[301];
int main() {
long long x1, y1, x2, y2;
long long i, n, cnt = 0;
long long sum1, sum2;
cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> n;
for (i = 0; i < n; i++) {
cin >> biao[i].a >> biao[i].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;
long long getMid(long long start, long long end) {
return start + (end - start) / 2;
}
long long getMax(vector<long long> &seg_tree, vector<long long> &maxi,
long long segment_start, long long segment_end,
long long query_start, long 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 | #include <bits/stdc++.h>
using namespace std;
const int inf_int = 100000000;
const double pi = 3.1415926535;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int ans = 0;
if (y1 < y2) {
swap(y1, y2);
swap(x1, x2);
}
int m;
... | 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, ans = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
long long a, b, c;
cin >> a >> b >> c;
long long fir = a * x1 + b * y1 + c;
long long sec = a * x2 + b * y2 + c;
if ((fi... | 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 | x1,y1 = list(int(foo) for foo in raw_input().split())
x2,y2 = list(int(foo) for foo in raw_input().split())
diff = 0
n = input()
for i in range(n):
a,b,c = list(int(foo) for foo in raw_input().split())
l1 = a*x1+b*y1+c
l2 = a*x2+b*y2+c
if l1 * l2 < 0:
diff += 1
print diff
| 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>
int main() {
int n;
long long x1, x2, y1, y2, a, b, c;
while (scanf("%I64d%I64d%I64d%I64d", &x1, &y1, &x2, &y2) == 4) {
scanf("%d", &n);
int ans = 0;
for (int i = 0; i < n; i++) {
scanf("%I64d%I64d%I64d", &a, &b, &c);
long long m1 = a * x1 + b * y1 + c;
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.util.*;
import java.io.*;
public class CrazyTown {
// https://codeforces.com/contest/498/problem/A
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(... | 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | 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 a, b, c, sum, z1, z2, xi, yi, xf, yf, i, n;
int main() {
cin >> xi >> yi;
cin >> xf >> yf;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b >> c;
z1 = a * xi + b * yi + c;
z2 = a * xf + b * yf + c;
if ((z1 > 0 && z2 > 0) || (z1 < 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>
int main() {
int x1, y1, x2, y2;
int n, ans = 0;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
scanf("%d", &n);
for (int i = 0; i < n; i++) {
long long a, b, c;
scanf("%I64d %I64d %I64d", &a, &b, &c);
long long flag1 = a * x1 + b * y1 + c;
long long flag2 = a * x2 + b * y2... | 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 MAXN = 300 + 5;
long long p[2][2];
long long N;
int main() {
cin >> p[0][0] >> p[0][1];
cin >> p[1][0] >> p[1][1];
cin >> N;
long long a, b, c, ans = 0;
for (int i = 0; i < N; i++) {
cin >> a >> b >> c;
long long x = a * p[0][0] + b * p[0][1] + 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 math
EPS = 1E-10
def point_in_angle(a, o, b, p):
op = do_vector(p, o)
oa = do_vector(a, o)
ob = do_vector(b, o)
bo = do_vector(o, b)
bp = do_vector(p, b)
ba = do_vector(a, b)
ao = do_vector(o, a)
ap = do_vector(p, a)
ab = do_vector(b, a)
if (op ^ oa) * (op ^ ob) <= 0 and... | 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.PrintWriter;
import java.util.Scanner;
public class CF499C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int homeX = sc.nextInt();
int homeY = sc.nextInt();
int uniX = sc.nextInt... | 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.math.BigInteger;
import java.util.Scanner;
public class C {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger x1 = sc.nextBigInteger(), y1 = sc.nextBigInteger(), x2 = sc.nextBigInteger(), y2 = sc.nextBigInteger();
int n = sc.nextInt(), ret = 0;
for(int i = 0... | 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;
int n, ans = 0;
cin >> x1 >> y1 >> x2 >> y2 >> n;
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 && s2 < 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;
long long a[301], b[301], c[301];
long long xh, xu, yh, yu, n;
long long sum;
int main() {
cin >> xh >> yh;
cin >> xu >> yu;
cin >> n;
sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i] >> c[i];
if ((a[i] * xh + b[i] * yh + c[i] > 0) &&
(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.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.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
public class CF {
st... | 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 n, x, y, a, b, ans;
template <class T>
inline void read(T& a) {
char c = getchar();
for (a = 0; (c < '0' || c > '9') && c != '-'; c = getchar())
;
bool f = 0;
if (c == '-') f = 1, c = getchar();
for (; c >= '0' && c <= '9'; c = getchar()) a = a * 10 + c - '0';
if (f) a = -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 main() {
int x1, x2, y1, y2, n, a, b, c, ans = 0;
scanf("%d%d%d%d%d", &x1, &y1, &x2, &y2, &n);
for (int i = 0; i < n; ++i) {
scanf("%d%d%d", &a, &b, &c);
bool b1 = 1ll * a * x1 + 1ll * b * y1 + c > 0;
bool b2 = 1ll * a * x2 + 1ll * b * y2 + 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 | x1, y1 = map(int, raw_input().split())
x2, y2 = map(int, raw_input().split())
n = int(raw_input())
res = 0
for _ in range(n):
a, b, c = map(int, raw_input().split())
if (a*x1+b*y1+c)*(a*x2+b*y2+c) < 0:
res += 1
print res | 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;
struct punct {
long long x, y;
};
struct ec {
long long a, b, c;
};
ec e;
punct a, b;
inline bool verifica() {
long long v1 = e.a * a.x + e.b * a.y + e.c;
long long v2 = e.a * b.x + e.b * b.y + e.c;
return ((v1 <= 0 && v2 > 0) || (v1 >= 0 && v2 < 0));
}
int n, cnt... | 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 n;
int main() {
int i, j, sol = 0;
long long x, y, z, xx, yy, a, b;
cin.sync_with_stdio(0);
cin >> xx >> yy >> a >> b >> n;
for (i = 1; i <= n; ++i) {
cin >> x >> y >> z;
if ((x * xx + y * yy + z) > 0 && (a * x + b * y + z) < 0) ++sol;
if ((x * xx ... | 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 x1 = sc.nextInt();
long y1 = sc.nextInt();
long x2 = sc.nextInt();
long y2 = sc.nextInt();
long n = sc.nextInt();
int res = 0;
// ... | 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 CF284A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x1 = in.nextInt();
int y1 = in.nextInt();
int x2 = in.nextInt();
int y2 = in.nextInt();
int n = in.nextInt();
int ans = 0;
... | 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.print.Printable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.Buffer;
/**
* Created by plutolove on 2014/12/26.
*/
public class Cf499C {
public static void main(String args[]) {
try {
B... | 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;
/**
*
* @author hunter
*/
public class CrazyTown {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in= new Scanner(System.in);
long x1=in.nextInt() , y1= in.nextInt();
long x2=in.nextInt() , y2= 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 | #include <bits/stdc++.h>
using namespace std;
int plane(int a, int b, int c, int x, int y) {
long long t = 1LL * a * x + 1LL * b * y + c;
return ((t > 0) - (t < 0));
}
int main(void) {
int x1, y1, x2, y2, n;
cin >> x1 >> y1 >> x2 >> y2 >> n;
int res = 0;
for (int love = 0, _n = (n); love < _n; love = love +... | 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;
class line {
public:
int a, b, c;
line() { a = b = c = 0; }
line(int a, int b, int c) {
this->a = a;
this->b = b;
this->c = c;
}
};
bool cal_sides(line l, long long int hx, long long int hy, long long int ux,
long long int uy) {
long lo... | 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 | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
n = int(input())
a = []
res = 0
for i in range(n):
a.append(list(map(int, input().split())))
for i in range(n):
if (a[i][0]*x1 + a[i][1]*y1 + a[i][2])*(a[i][0]*x2 + a[i][1]*y2 + a[i][2]) < 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 | import java.util.Hashtable;
import java.util.Scanner;
public class C499 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long xH = in.nextLong();
long yH = in.nextLong();
long xU = in.nextLong();
long yU = in.nextLong();
int n = in.next... | 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 sgn(long long x) { return x < 0 ? -1 : (x > 0 ? 1 : 0); }
int main() {
int x1, y1, x2, y2, n, tot = 0;
scanf("%d%d%d%d%d", &x1, &y1, &x2, &y2, &n);
for (int i = 0, a, b, c; i < n; ++i) {
scanf("%d%d%d", &a, &b, &c);
if (sgn(1ll * a * x1 + 1ll * b * y1 + 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 | from sys import stdin
def check(x1, y1, x2, y2, a, b, c):
return (a * x1 + b * y1 + c) * (a * x2 + b * y2 + c) < 0
if __name__ == '__main__':
x1, y1 = map(int, stdin.readline().split())
x2, y2 = map(int, stdin.readline().split())
n = int(stdin.readline())
ans = 0
for i in xrange(n):
a, b, c = map(int,... | 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;
const double eps(1e-9);
inline int sgn(double x) {
if (x < -eps) return -1;
if (x > eps) return 1;
return 0;
}
struct Point {
double x, y;
Point(void) {}
Point(const double _x, const double _y) : x(_x), y(_y) {}
};
inline bool operator==(const Point &a, const Po... | 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 town{
public static void main(String[] args) throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader f = new BufferedReader(new FileReader("town.in"));
StringTokenizer st = new StringTokenizer(f.readLine());
... | 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.*;
import java.util.*;
public class crazytown {
private static Reader in;
private static PrintWriter out;
public static void main(String[] args) throws IOException {
in = new Reader();
out = new PrintWriter(System.out, true);
long x1 = in.nextInt(), y1 = in.nextInt();
long x2 = in... | 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.util.StringTokenizer;
public class Main {
static final double EPS = 1e-9;
static boolean areParallel(Line l1, Line ... | 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;
vector<string> vec_splitter(string s) {
s += ',';
vector<string> res;
while (!s.empty()) {
res.push_back(s.substr(0, s.find(',')));
s = s.substr(s.find(',') + 1);
}
return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
__... | 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 eps = 1e-6;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
vo... | 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.lang.*;
public class C284 {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
long[] home = new long[2];
home[0] = scan.nextLong();
home[1] = scan.nextLong();
long[] school = new long[2];
school[0] = scan.nextLong();
school[1] = scan.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.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper... | 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 = map(int, raw_input().split())
x2, y2 = map(int, raw_input().split())
n = int(raw_input())
count = 0
for _ in range(n):
a, b, c = map(int, raw_input().split())
if (a*x1 + b*y1 < -c) != (a*x2 + b*y2 < -c):
count += 1
print count | 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() {
ios::sync_with_stdio(false);
long long x1, y1;
long long x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
long long n;
cin >> n;
long long ans = 0;
long long a1[1000], b1[1000], c1[1000];
for (long long i = 0; i < n; i++) {
cin >> a1[i] >> b1[i] >> c1... | 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 x1, yy, x2, y2, n;
int x, y, z;
const double eps = 1e-8;
int check(double k) {
if (abs(k) < eps) return 1;
return 0;
}
int main() {
cin >> x1 >> yy;
cin >> x2 >> y2;
cin >> n;
long long a = yy - y2;
long long b = x2 - x1;
long long c = (long long)x2 * (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 | def list_to_int(l):
return [int(x) for x in l]
def f_value(point, params):
return (point[0]*params[0]+point[1]*params[1]+params[2] > 0)
def is_separator(home, uni, params):
return f_value(home, params) ^ f_value(uni, params)
home = list_to_int(input().split(' '))
uni = list_to_int(input().split(' ')... | 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 x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
long long int n, cnt = 0;
cin >> n;
while (n--) {
long long int a, b, c;
cin >> a >> b >> c;
long long int first = (a * x1 + b * y1 + c) / abs(a * x1 + b * y1 + c);
long long 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.*;
import java.io.*;
public class Goc {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(System.out);
long N, x1, y1, x2, y2, a, b, c;
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 | x1, y1 = map(int, raw_input().split())
x2, y2 = map(int, raw_input().split())
lines = int(raw_input())
res = 0
for i in range(lines):
a, b, c = map(int, raw_input().split())
r1 = a * x1 + b * y1 + c
r2 = a * x2 + b * y2 + c
r1 = r1 / abs(r1)
r2 = r2 / abs(r2)
if r1 != r2:
res += 1
print ... | 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 |
a, b = (int(x) for x in input().split())
ab, ba = (int(x) for x in input().split())
n = int(input())
def fun(x1, y1, x2, y2, line):
var = Line()
var.build_by_dots(x1, y1, x2, y2)
under_under = var.a * line.b - line.a * var.b
if abs(under_under) > 0.00000001:
x = - (var.c * line.b - var.b * li... | 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 side(int a, int b, int c, int x, int y) {
return ((long long int)a * (long long int)x +
(long long int)b * (long long int)y + (long long int)c >
0)
? 1
: 0;
}
int main() {
int x1, y1, x2, y2, n, i, a, b, c, res = 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;
struct Point {
int x;
int y;
friend istream& operator>>(istream& in, Point& p) {
in >> p.x >> p.y;
return in;
}
} s, t;
const int N = 300 + 5;
struct Line {
int a;
int b;
int c;
int pos(Point p) {
if (a * 1LL * p.x + b * 1LL * p.y + c > 0) return... | 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 | h = list(map(int, input().split()))
u = list(map(int, input().split()))
n = int(input())
t = 0
# print(h,u,n)
for i in range(n):
a,b,c = map(int, input().split())
# print(a*h[0] + b*h[1] + c)
# print(a*u[0] + b*u[1] + c)
# print(a, b, c)
if (a*h[0] + b*h[1] + c) * (a*u[0] + b*u[1] + c) < 0:
t += 1
print(t)
... | 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.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.awt.Point;
import java.math.BigInteger;
import static java.lang.Math.*;
public class CodeforcesA implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
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;
int n, ans;
int X1, Y1, X2, Y2;
void Work() {
for (int i = 1; i <= n; i++) {
long long a, b, c;
cin >> a >> b >> c;
if (((a * X1 + b * Y1 + c) ^ (a * X2 + b * Y2 + c)) < 0) ans++;
}
printf("%d\n", ans);
}
void Init() {
scanf("%d%d%d%d", &X1, &Y1, &X2, &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 | x1,y1=map(int,input().split())
x2,y2=map(int,input().split())
n=int(input())
l=[]
count=0
for i in range(n):
a,b,c=map(int,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):
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 |
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.util.ArrayList;
import java.util.StringTokenizer;
public class CrazyTown {
static long xh;
static long yh;
st... | 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 C284 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x1 = in.nextInt();
int y1 = in.nextInt();
int x2 = in.nextInt();
int y2 = in.nextInt();
int n = in.nextInt();
int count = 0;
int a, b, c;
long res1, res2;
for (int i = 0... | 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.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
public final class Solution
{
public void Solve() throws NumberF... | 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() {
ios::sync_with_stdio(0);
int x1, x2, y1, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
int n;
cin >> n;
long long ans = 0;
long long a, b, c, f, sec;
for (int i = 0; i < n; ++i) {
cin >> a >> b >> c;
f = a * x1 + b * y1 + c;
sec = 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 | #include <bits/stdc++.h>
using namespace std;
const int N = 3e2 + 5;
int n;
long long hx, hy;
long long ux, uy;
struct line {
long long x1, y1;
long long x2, y2;
line(long long _x1, long long _y1, long long _x2, long long _y2) {
x1 = _x1;
y1 = _y1;
x2 = _x2;
y2 = _y2;
}
};
vector<line> lines;
vo... | 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.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class S2P10 {
final static double EPS = 1e-9;
// In Java, we can use Math.PI instead of using Math.acos(-1.0)
double DEG_to_RAD(d... | 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 | ct = 0
x1, y1 = map(int, input().split(' '))
x2, y2 = map(int, input().split(' '))
for i in range(int(input())):
a, b, c = map(int, input().split(' '))
if b == 0:
if x1 < -c / a < x2 or x2 < -c/a < x1:
ct += 1
else:
b1 = y1 > (-a * x1 - c) / b
b2 = y2 > (-a * x2 - c) / b
... | 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 int maxN = 1 << 17;
const long long LINF = 0x3C3C3C3C3C3C3C3Cll;
const int INF = LINF;
int main() {
long long x1, y1;
long long x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
int n;
cin >> n;
int res = 0;
while (n--) {
long long a, b, c;
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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class fff {
PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
sc sc = new sc();
Point home = new Point(sc.nextInt... | 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.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
long x1=sc.nextLong(),y1=sc.nextLong();
long x2=sc.nextLong(),y2=sc.nextLong();
int n=sc.nextInt();
long count=0;
for(int 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 |
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.HashMap;
import java.util.StringTokenizer;
public class C499 {
public static BufferedReader in;
public static Prin... | 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.*;
import java.util.*;
public class geo {
static final double INF = 1e9, EPS = 1e-9;
static double sq(double x) {
return (x*x);
}
/////////////////////////////////////////////////////////////////////////
static class Line {
static final double INF = 1e9, EPS = 1e-9;
double a, b, 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 | lectura=lambda:map (int,input().split())
xCasa, yCasa = lectura()
xObj, yObj = lectura()
numeroCalles = int(input())
conclusion = 0
'''
It can be easily proved that, if two points from statement are placed
on different sides of some line, this line will be crossed anyway.
So, all we need to do is to cross all these lin... | 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.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
* @author FussyWheat
*/
public class ... | 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 INF = 1000000000;
struct line {
int a, b, c;
};
struct point {
double x, y;
};
double orientation(point a, point b, point c) {
double l = (b.x - a.x) * (c.y - a.y);
double r = (b.y - a.y) * (c.x - a.x);
return l - r;
}
bool intersect(line ln, point a, po... | 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 eps = 1e-5;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
bool Judge(long long x, long long y) {
if (x > 0 && y < 0) return true;
if (x < 0 && y > 0) return true;
return false;
}
int main() {
int n;
long long x1, x2, y1, y2;
long long 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;
long long a[310], b[310], c[310];
int main() {
long long x1, y1, x2, y2;
int n, br = 0;
scanf("%I64d%I64d%I64d%I64d%d", &x1, &y1, &x2, &y2, &n);
for (int i = 0; i < n; ++i) scanf("%I64d%I64d%I64d", &a[i], &b[i], &c[i]);
for (int i = 0; i < n; ++i) {
if ((a[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 | xA, yA = map(int, raw_input().split(" "))
x1, y1 = map(int, raw_input().split(" "))
n = input()
tripletas = []
contador = 0
for i in range(n):
a, b, c = map(int, raw_input().split(" "))
tripletas.append((a, b, c))
for tupla in tripletas:
if(tupla[0]*xA+tupla[1]*yA+tupla[2]>0 and tupla[0]*x1+tupla[1]*y1+tupla[2]<0):
... | 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 | x, y = map(float, input().split(' '))
x1, y1 = map(float, input().split(' '))
n = int(input())
r = 0
for i in range(n):
a, b, c = map(float, input().split(' '))
q1 = a * x + b * y + c
q2 = a * x1 + b * y1 + c
if (q1 > 0 and q2 < 0) or (q1 < 0 and q2 > 0):
r += 1
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 | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
int r, i;
while (b != 0) {
r = a % b;
a = b;
b = r;
}
return a;
}
long long int power(long long int x, long long int y) {
long long int temp, ty, my;
long long int mod;
mod = 1000000007;
if (y == 0) return 1;
temp = powe... | 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 a, b, c, x, y, r, s, i, j, m, n, q, w;
cin >> x >> y;
cin >> r >> s;
m = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a >> b >> c;
q = ((a * r) + (b * s) + c);
w = ((a * x) + (b * y) + c);
if (((q < 0) && (w > 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>
struct Point {
long long int x, y;
Point(long long int x = 0, long long int y = 0) : x(x), y(y) {}
void input() { scanf("%I64d%I64d", &x, &y); }
};
struct Line {
long long int a, b, c;
Line(long long int a = 0, long long int b = 0, long long int c = 0)
: a(a), b(b), c(c) {}
vo... | 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;
long long cnt = 0;
for (int i = 0; i < n; i++) {
long long a, b, c;
cin >> a >> b >> c;
long long x = a * x1 + b * y1 + c;
long long y = a * x2 + b * y2 + 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 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll x1, x2, y1, y2;
scanf("%lld %lld", &x1, &y1);
scanf("%lld %lld", &x2, &y2);
int n;
int res = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
ll a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
if (c + 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;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long int x, y;
cin >> x >> y;
long long int xx, yy;
cin >> xx >> yy;
int n;
cin >> n;
int cnt = 0;
for (int(i) = 0; (i) < (n); (i)++) {
long long int a, b, c;
cin >> a >> b >> c;
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 | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
n = int(input())
r = 0
for i in range(n):
a, b, c = map(int, input().split())
if (x1*a+y1*b+c)*(x2*a+y2*b+c) < 0: r += 1
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 | #include <bits/stdc++.h>
using namespace std;
struct pt {
double x, y;
pt(double x = 0, double y = 0) {
this->x = x;
this->y = y;
}
};
pt ar[5], pvt;
pt mv(pt a, pt b) { return pt(b.x - a.x, b.y - a.y); }
double dp(pt a, pt b) { return a.x * b.x + a.y * b.y; }
double cp(pt a, pt b) { return a.x * b.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 sys
home = map(int,sys.stdin.readline().strip().split())
univ = map(int,sys.stdin.readline().strip().split())
n = int(sys.stdin.readline())
roads = []
for i in range(n):
roads.append( map(int,sys.stdin.readline().strip().split()) )
ans = 0
for a,b,c in roads:
if(home[0]*a + home[1]*b + c>0 and univ[0... | 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.*;
import java.awt.geom.Line2D;
import java.awt.geom.*;
public class c
{
public static double MAX = 1e6+1;
public static double MIN = -(1e7)-1;
public static void main(String[] arg)
{
Scanner in = new Scanner(System.in);
Line2D home = new Line2D.Double(in.nextInt(), in.nextInt(), in.nextInt(),... | 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 | // /codeforces/284/2/practice/CRAZYTOWN
import java.io.*;
import java.util.*;
public class Main {
public static boolean isOpposite(long a, long b, long c, long house[], long univ[]) {
long val1 = (a * house[0]) + (b * house[1]) + c;
long val2 = (a * univ[0]) + (b * univ[1]) + c;
if ((val1... | 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 double EPS = 1e-9;
double cross(pair<double, double> u, pair<double, double> v) {
return u.first * v.second - u.second * v.first;
}
int getSign(double a) {
if (fabs(a) < EPS) {
return 0;
}
return a > 0 ? 1 : -1;
}
pair<double, double> minuss(pair<double, 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 | #include <bits/stdc++.h>
using namespace std;
long long x_1, y_1, x_2, y_2;
long long a, b, c;
long long dist(long long x, long long y) {
return (x * a + y * b + c > 0ll ? 1ll : -1ll);
}
int main() {
cin >> x_1 >> y_1 >> x_2 >> y_2;
int ans = 0;
int n;
cin >> n;
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 | import java.util.*;
import java.io.*;
public class CF498A {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
long home_x = Integer.parseInt(st.nextToken());
long home_... | 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 homeX, homeY;
int uniX, uniY;
int n;
long double CP(long double x1, long double y1, long double x2, long double y2) {
return x1 * y2 - x2 * y1;
}
bool Intersects(int a, int b, int c) {
long double X, Y;
long double CP1, CP2;
long double RX, RY;
if (b == 0) {
... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.