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 | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = Sys... | 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 | /*
*
* @author Mukesh Singh
*
*/
/* Finding_the_Minimum_Window_in_S_which_Contains_All_Elements_from_T */
import java.io.*;
import java.util.*;
import java.text.DecimalFormat;
@SuppressWarnings("unchecked")
public class AB
{
//solve test cases
void solve() throws Exception
{
int x1 = in.nextInt();
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 | // Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_JUD... | 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 N = 310;
long long xh, yh, xu, yu;
int n;
long long a[N], b[N], c[N];
int main() {
scanf("%I64d%I64d", &xh, &yh);
scanf("%I64d%I64d", &xu, &yu);
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%I64d%I64d%I64d", a + i, b + i, c + i);
}
int 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;
long long int x1, yy1, x2, y2;
long long int A, B, C;
const double eps = 0.0;
int check(long long int a, long long int b, long long int c) {
long long int det = A * b - a * B;
if (det == 0) return 0;
double x = (((double)b) / det) * C - (((double)B) / det) * c;
doub... | 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())
res = 0
for i in range(n):
a , b , c = map(int , input().split())
x = (a * x1) + (b * y1) + c
y = (a * x2) + (b * y2) + c
if ((x < 0) and (y > 0)) or ((x > 0) and (y < 0)):
res = 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.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... | 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;
typedef struct point {
double x, y;
point(double x = 0, double y = 0) : x(x), y(y) {}
} Vector;
point st, en;
int n;
int s1[311], s2[311];
Vector operator+(Vector A, Vector B) { return Vector(A.x + B.x, A.y + B.y); }
Vector operator-(point A, point B) { return Vector(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 x_1, y_1, x_2, y_2, n, a, b, c, ans;
int main() {
scanf("%I64d%I64d%I64d%I64d", &x_1, &y_1, &x_2, &y_2);
scanf("%I64d", &n);
while (n-- > 0) {
scanf("%I64d%I64d%I64d", &a, &b, &c);
long long D = a * x_1 + b * y_1 + c;
long long E = a * x_2 + 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 double pi = acos(-1.0);
int sgn(double x) {
if (fabs(x) < 1e-6) {
return 0;
} else if (x < 0) {
return -1;
} else
return 1;
}
int dcmp(double x, double y) {
if (sgn(x - y) == 1) {
return 1;
} else if (sgn(x - y) == 0) {
return 0;
}
re... | 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 Prob284 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
long hx = reader.nextLong();
long hy = reader.nextLong();
long ux = reader.nextLong();
long uy = reader.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 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1164777216")
using namespace std;
template <class T>
inline T sqr(T x) {
return x * x;
}
const double pi = acos(-1.0), eps = 1e-15;
const int INF = 1000 * 1000 * 1000 + 5, MAXN = 100005, MOD = 1000007;
const long long INFL = 1000000000000000005;
void prepare(st... | 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 | p1=raw_input()
p1=p1.split()
x1=int(p1[0])
y1=int(p1[1])
p2=raw_input()
p2=p2.split()
x2=int(p2[0])
y2=int(p2[1])
n=int(input())
ans = 0
while n>0:
p=raw_input()
p=p.split()
a=int(p[0])
b=int(p[1])
c=int(p[2])
if((a*x1+b*y1+c)*(a*x2+b*y2+c)<=0):
ans+=1
n-=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.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;
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
Point... | 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;
pair<int, int> cr[2];
long long n, cnt;
int main() {
cin >> cr[0].first >> cr[0].second >> cr[1].first >> cr[1].second;
cin >> n;
long long a, b, c;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
long long p = a * cr[0].first + b * cr[0].second + 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 | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
k = 0
n = int(input())
for i in range(n):
a, b, c = map(int, input().split())
if (a * x1 + b * y1 + c) * (a * x2 + b * y2 + c) < 0:
k += 1
print(k) | 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* 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 | def main():
rdl = list(map(int,input().split()))
x1,y1 = rdl
rdl = list(map(int,input().split()))
x2,y2 = rdl
n = int(input())
Steps = 0
for i in range(n):
rdl = list(map(int,input().split()))
if rdl[1]*y1+rdl[0]*x1+rdl[2] > 0 and rdl[1]*y2+rdl[0]*x2+rdl[2] < 0:
S... | 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.Scanner;
public class CF284C {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
long x1 = input.nextLong();
long y1 = input.nextLong();
long x2 = input.nextLong();
long y2 = input.nextLong();
long n = input.nextLong();
long ans = 0;
for (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;
long long hx, hy, sx, sy, n;
long long a[305], b[305], c[305];
int main() {
cin >> hx >> hy >> sx >> sy >> n;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i] >> c[i];
c[i] = -c[i];
}
int cou = 0;
for (int i = 0; i < n; i++) {
if ((a[i] * hx + b[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() {
long long p1, p2;
long long q1, q2;
scanf("%I64d%I64d%I64d%I64d", &p1, &p2, &q1, &q2);
int n;
scanf("%d", &n);
long long a, b, c;
int val1 = 1, val2 = 1;
int ans = 0;
for (int i = 0; i < n; i++) {
scanf("%I64d%I64d%I64d", &a, &b, &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;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}
const long long N = ((long long)1e6);
long long gcd(long long a, 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CFC {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
String[] s=br.rea... | 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 | # -*- coding: utf-8 -*-
import sys
import heapq
from collections import defaultdict
from collections import OrderedDict
import copy
from collections import deque
class Solver(object):
def run(self):
p1 = tuple(readarray(int))
p2 = tuple(readarray(int))
n = read(int)
lines = [reada... | 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 int mod = 1000000007;
const int DX[] = {1, 0, -1, 0}, DY[] = {0, 1, 0, -1};
long long int C(int n, int k) {
long long ans = 1;
k = k > n - k ? n - k : k;
int j = 1;
for (; j <= k; j++, n--) {
if (n % j == 0) {
ans *= n / j;
} else if (ans % j == ... | 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 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 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long MX = 1e9;
const long long INF = 1e9;
void print_a(vector<int> v) {
if (v.size()) cout << v[0];
for (int i = 1; i < v.size(); ++i) cout << ' ' << v[i];
cout << '\n';
}
vector<vector<int> > init_vvi(int n, int m, int val) {
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>
using namespace std;
int main() {
long long x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
long long a, b, c;
long long j, k, moves = 0;
while (n--) {
cin >> a >> b >> c;
j = -1 * (y1 * b + c);
k = -1 * (y2 * b + c);
if ((j > x1 * a && k < x2 * 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.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = ... | 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 power(long long x, long long y, long long p) {
long long res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
const int N = 1e5 + 7;
const int xinc[] = {0, 0, 1, -1};
const int yinc[... | 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 crazyTown {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double x1 = sc.nextInt();
double y1 = sc.nextInt();
double x2 = sc.nextInt();
double y2 = sc.nextInt();
int n = sc.nextInt();
int cnt = ... | 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 sys
def evaluate(a, b, c, x, y):
return a*x + b*y + c
start_x, start_y = [int(x) for x in sys.stdin.readline().split()]
dest_x, dest_y = [int(x) for x in sys.stdin.readline().split()]
n_lines = int(sys.stdin.readline().strip())
lines = []
for i in range(n_lines):
a, b, c = [int(x) for x in sys.stdin.re... | 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.*;
public class CrazyTown
{
private void run() throws IOException
{
// put your code here :)
double x1 = nextDouble();
double y1 = nextDouble();
double x2 = nextDouble();
double y2 = nextDouble();
int nu... | 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 C {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
long x1 , y1 , x2 , y2;
x1 = in.nextLong();
y1 = in.nextLong();
x2 = in.nextLong();
y2 = in.nextLong();
int 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 | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int main() {
double X1, X2, Y1, Y2;
scanf("%lf%lf%lf%lf", &X1, &Y1, &X2, &Y2);
int ans = 0;
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
if ((a * X1 + b * Y1 + c) * (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.*;
import java.util.*;
public class CF498A
{
public static void main(String[] args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String t1=br.readLine();
String[] t2=t1.split(" ");
long x1=Long.parseLong(t2[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.*;
public class Q1 {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
long x1=sc.nextLong(),y1=sc.nextLong(),x2=sc.nextLong(),y2=sc.nextLong();
int n = sc.nextInt(),sum=0;
long arr[][]=new long[n][3];
for(int i=0;i<n;i++){
arr[i][0]=sc.nextLong();
arr[... | 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.PrintStream;
import java.util.Scanner;
public class C {
static Scanner in = new Scanner(System.in);
static PrintStream out = System.out;
public static void main(String[] args) {
long x1 = in.nextLong();
long y1 = in.nextLong();
long x2 = in.nextLon... | 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 N = 305;
long long x1, my_y1;
long long x2, y2;
int n;
long long a[N], b[N], c[N];
int sgn(long long x) {
if (x < 0) return -1;
if (x == 0) return 0;
return 1;
}
int get_side(int i, long long x, long long y) {
return sgn(a[i] * x + b[i] * y + c[i]);
}
void... | 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, y1, x2, y2, n, i, a, b, c, count = 0;
long long p, q;
scanf("%I64d%I64d", &x1, &y1);
scanf("%I64d%I64d", &x2, &y2);
scanf("%I64d", &n);
for (i = 0; i < n; i++) {
scanf("%I64d%I64d%I64d", &a, &b, &c);
p = (a * x1) + (b * y1) + c;
q = (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;
void Solve() {
long long x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
int n;
cin >> n;
unsigned long long total = 0;
for (int i = 0; i < n; ++i) {
long long a, b, c;
cin >> a >> b >> c;
long long r1 = a * x1 + b * y1 + c;
long long r2 = 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;
struct point {
double x, y;
point(){};
point(double _x, double _y) { x = _x, y = _y; }
};
point s, e;
double det(double a, double b, double c, double d) { return (a * d - b * c); }
point perpotongan(point p1, point p2, point p3, point p4) {
point has;
has.x = -137... | 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())
cost = 0
for i in range(n):
a, b, c = map(int, input().split())
d1 = a * x1 + b * y1 + c
d2 = a * x2 + b * y2 + c
if d1 * d2 < 0: cost += 1
print(cost)
| 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,input().split())
x2,y2=map(int,input().split())
n=int(input())
p=0
for i in range(n):
a,b,c=map(int,input().split())
zenklas1=""
zenklas2=""
if a*x1+b*y1+c<0:
zenklas1+="-"
else:
zenklas1+="+"
if a*x2+b*y2+c<0:
zenklas2+="-"
else:
zenklas2+="+"
if zenklas1!=zenklas2:
p+=1
print(p) | 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.Arrays;
import java.util.StringTokenizer;
public class Main
{
static final double EPS = 1e-9;
static class Point
{
double x, y;
Point(double a, 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 | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.rmi.activation.ActivationSystem;
import java.util.*;
/**
* Created by hp on 5/18/2017.
*/
public class toto {
public static PrintWriter out;
public static InputReader in;
public static void main(String[] a... | 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.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.util.*;
import java.io.*;
public class Main {
InputReader ir;
int hx ;
int hy ;
int cx ;
int cy ;
int check1(int a, int b, int c) {
long one = a*1l*hx + b*1l*hy + c;
return one < 0 ? -1 : 1;
}
int check2(int a, int b, int c) {
long two = a*1l*cx + b*1... | 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 long long N = 300 + 10;
long long sx, sy, ex, ey;
long long n;
struct code {
long long a, b, c;
} p[N];
long long calca(long long i) {
return (long long)p[i].a * sx + (long long)p[i].b * sy + (long long)p[i].c <
0;
}
long long calcb(long long i) {
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 | import java.util.Scanner;
public class Main {
public static Scanner cin = new Scanner(System.in) ;
private static class Point{
long x , y ;
}
private static class Line{
long a , b , c ;
}
public static void main(String[] args) throws Exception{
Point p1 = new Point() ; p1.x = cin.nextLong() ; p1.y = cin... | 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;
cin >> x1 >> y1 >> x2 >> y2;
int n;
scanf("%d", &n);
int ans = 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)
ans++;
... | 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 = 3.14159265359;
const long double EPS = 1e-9;
long double ax, ay, bx, by, n;
int eq(long double x, long double y) {
if (x - y < EPS && x - y > EPS) return 1;
return 0;
}
int main() {
cin >> ax >> ay >> bx >> by >> n;
int cnt = 0;
for (int(i) = (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.util.HashMap;
import java.util.Scanner;
public class Up {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
long x1 = scanner.nextInt(), y1 = scanner.nextInt(),
x2 = scanner.nextInt(), y2 = scanner.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 | #include <bits/stdc++.h>
using namespace std;
long long Ax, Ay, Bx, By, a, b, c;
int n, ans = 0;
bool Cal() {
long long t, tt;
t = Ax * a + Ay * b + c;
tt = Bx * a + By * b + c;
if ((tt < 0 && t > 0) || (tt > 0 && t < 0)) return 1;
return 0;
}
int main() {
int i;
cin >> Ax >> Ay >> Bx >> By;
cin >> 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 sys
import time
from functools import total_ordering
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)... | 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, input().split())
x2,y2=map(int, input().split())
n=int(input())
ans=0
for i in range(n):
a,b,c = map(int, input().split())
if (a*x1+b*y1+c)*(a*x2+b*y2+c)<0:
ans=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 | EPS = 0.00000001
xx1, yy1 = (int(x) for x in input().split())
xx2, yy2 = (int(x) for x in input().split())
n = int(input())
def intersect_between_dots(x1, y1, x2, y2, line):
liline = Line()
liline.build_by_dots(x1, y1, x2, y2)
under_under = liline.a * line.b - line.a * liline.b
if abs(under_under) > ... | 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 | //package round284;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
long x1 = nl(), y1 ... | 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.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class zizo {
public static void main(String[]args) throws IOException {
Scanner zizo=new Scanner(Sy... | 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 N = 305;
long long x, y, X, Y, a, b, c;
int n, i, ans;
bool check() {
long long z1, z2;
z1 = a * x + b * y + c;
z2 = a * X + b * Y + c;
if (z1 < 0 && z2 > 0) return 1;
if (z1 > 0 && z2 < 0) return 1;
return 0;
}
int main() {
cin >> 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 | import java.lang.*;
import java.io.*;
import java.util.*;
public class Town {
public static void main(String[] args) throws java.lang.Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new 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 main() {
long long x, y, z, t;
cin >> x >> y >> z >> t;
long long n;
cin >> n;
long long s, d, f, counter = 0;
for (int i = 0; i < n; i++) {
cin >> s >> d >> f;
if ((x * s + y * d + f < 0 && z * s + t * d + f > 0) ||
(x * s + y * d + f > 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 n, i, ans;
long double x1, x2, x, y, a2, b2, c2, hdwjshf, y2, a1, b1, c1;
long double dist(long double a, long double b, long double c, long double d) {
return sqrt((a - c) * (a - c + 0.) + (b - d) * (b - d + 0.));
}
int main() {
cin >> x1 >> hdwjshf;
cin >> 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;
int main() {
long long x1, y1, x2, y2;
scanf("%I64d%I64d%I64d%I64d", &x1, &y1, &x2, &y2);
int n, ans = 0;
scanf("%d", &n);
while (n--) {
long long a, b, c;
scanf("%I64d%I64d%I64d", &a, &b, &c);
long long s1 = a * x1 + b * y1 + c, s2 = 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 |
import java.io.*;
/**
* Created by DELL on 14-Nov-15.
*/
public class CrazyTown
{
public static void main(String arg[])
{
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
... | 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;
struct Poi {
double x, y;
Poi() {}
Poi(double x, double y) : x(x), y(y) {}
Poi operator-(const Poi& rhs) const { return Poi(x - rhs.x, y - rhs.y); }
};
struct Line {
Poi p;
Poi v;
Line() {}
Line(const Poi& p, const Poi& v) : p(p), v(... | 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 n;
pair<long long, long long> a, b;
pair<pair<long long, long long>, long long> ar[10100];
long long A[10100], B[10100], ans;
int main() {
scanf("%I64d%I64d", &a.first, &a.second);
scanf("%I64d%I64d", &b.first, &b.second);
scanf("%I64d", &n);
for (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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long p1, p2, x1, y1, x2, y2, a, b, c, n, cnt = 0;
cin >> x1 >> y1 >> x2 >> y2 >> n;
while (n--) {
cin >> a >> b >> c;
p1 = x1 * a + y1 * b + c;
p2 = x2 * a + y2 * b + c;
if (p1 > 0 && p2 < 0) cnt++;
if (p1 < 0 && p2 > 0) 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 | """
Codeforces Contest 284 Div 1 Problem A
Author : chaotic_iak
Language: Python 3.4.2
"""
################################################### SOLUTION
def main():
x1,y1 = read()
x2,y2 = read()
n, = read()
ct = 0
for i in range(n):
a,b,c = read()
if (a*x1+b*y1+c)*(a*x2+b*y2+c) < ... | 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.InputStreamReader;
/**
* Created by Rupesh92 on 12/24/2014.
*/
public class Codeforces_284_3 {
public static void main(String args[]) throws IOException {
InputStreamReader input = new InputStreamReader(System.in);
Buffered... | 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 = 301;
const double eps = 1e-8;
struct Segment {
double a, b, c;
} seg[maxn], sta;
struct Point {
double x, y;
} you, uni;
bool calcross(Segment l, Segment sa, Point &ans) {
double delta = l.a * sa.b - l.b * sa.a;
if (abs(delta) < eps) return false;
... | 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 crazyTown{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int x1 = sc.nextInt();
int y1 = sc.nextInt();
int x2 = sc.nextInt();
int y2 = sc.nextInt();
int n = sc.nextInt();
int a = 0;
int b = 0;
int c = 0;
double a1,a2;
int ans =... | 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 int x, y, n, m, i, j, a, b, c, r, a1, a2, ans = 0;
cin >> x >> y >> n >> m >> r;
for (i = 0; i < r; i++) {
cin >> a >> b >> c;
a1 = (x * a) + (y * b) + c;
a2 = (n * a) + (m * b) + c;
if (a1 < 0) {
if (a2 > 0) ans++;
}
... | 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.Point;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.uti... | 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.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF498A {
static double EPS = 1e-9;
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner sc = new Scanne... | 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 dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
int qf, qb, q[1111111];
int calc(long long a, long long b, long long c, long long x, long long y) {
long long res = a * x + b * y + c;
if (res > 0) return 1;
return -1;
}
int main() {
in... | 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;
double x1, x2, y1, y2, a, b, c;
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;
int t = 0;
while (n--) {
cin >> a >> b >> c;
if ((a * x1 + b * y1 + c) * (a * x2 + b * y2 + c) < 0) t++;
}
cout << t << endl;
}
| 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;
template <typename T>
inline T POW(T B, T P) {
if (P == 0) return 1;
if (P & 1)
return B * POW(B, P - 1);
else
return SQR(POW(B, P / 2));
}
template <typename T>
inline T BigMod(T b, T p, T m) {
if (p == 0) return 1;
if (p % 2 == 0) {
T s = BigMod(b, p... | 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;
public class Main {
static BufferedReader in;
static PrintWriter out;
public static void main(String[] args) throws IOException {
in = new BufferedReader(new InputStreamReader(System.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;
long long int calc(long long int a, long long int b, long long int c,
long long int x, long long int y) {
return a * x + b * y + c;
}
int main() {
long long int x1;
cin >> x1;
;
long long int y1;
cin >> y1;
;
long long int x2;
cin >> 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;
int main() {
long long int x1, y1, x2, y2, n;
cin >> x1 >> y1 >> x2 >> y2 >> n;
int r = 0;
for (int i = 0; i < n; i++) {
long long int a, b, c;
cin >> a >> b >> c;
if ((a * x1 + b * y1 + c < 0) ^ (a * x2 + b * y2 + c < 0)) r++;
}
cout << r;
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 |
homex,homey = (int(x) for x in input().split(" "))
univx,univy = (int(x) for x in input().split(" "))
n = int(input())
step = 0
for i in range(0,n):
a,b,c = (int(x) for x in input().split(" "))
homearea = ((a*homex + b*homey + c) < 0)
univarea = ((a*univx + b*univy + c) < 0)
if homearea != univarea:
... | 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>
int a, b, c, n, x[2], y[2], ans;
bool f(int i) { return 1LL * a * x[i] + 1LL * b * y[i] + c > 0; }
int main() {
scanf("%d%d%d%d%d", x, y, x + 1, y + 1, &n);
for (int i = 0; i < n; i++) {
scanf("%d%d%d", &a, &b, &c);
if (f(0) != f(1)) ans++;
}
printf("%d\n", ans);
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>
int MOD = 1000000007;
using namespace std;
int i, j, n, m, k, p, q, l;
int a, b;
int main() {
long long xa, ya, xb, yb;
cin >> xa >> ya >> xb >> yb;
cin >> n;
int ans = 0;
for (i = 0; i < n; i++) {
long long A, B, C;
cin >> A >> B >> C;
long long x = A * xa + B * ya + 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;
struct pt {
long double x, y;
pt() {}
pt(long double _x, long double _y) {
x = _x;
y = _y;
}
pt(const pt& a, const pt& b) {
x = b.x - a.x;
y = b.y - a.y;
}
};
long double cross(const pt& a, const pt& b) { return a.x * b.y - a.y * b.x; }
int main(... | 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())
data = []
ans = 0
for i in range(n):
a, b, c = map(int, input().split())
one = (a * x1 + b * y1 + c)
two = (a * x2 + b * y2 + c)
if one // abs(one) != two // abs(two):
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;
pair<double, double> A, B;
pair<double, double> Array[605];
int N;
void Read() {
cin >> A.first >> A.second;
cin >> B.first >> B.second;
cin >> N;
for (int i = 1; i <= N; i++) {
double a, b, c;
cin >> a >> b >> c;
if (a == 0) {
Array[2 * i - 1] = 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 | import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
/**
*... | 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;
int32_t main() {
long long int x, y;
cin >> x >> y;
long long int x1, y1;
cin >> x1 >> y1;
long long int n;
cin >> n;
long long int ans = 0;
for (long long int i = 0; i < n; i++) {
long long int a, b, c;
cin >> a >> b >> c;
long long int val1 = 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, raw_input().split())
x2, y2 = map(int, raw_input().split())
n = input()
s=0
for i in range(n):
a, b, c = map(int, raw_input().split())
if((a*x1+b*y1+c)*(a*x2+b*y2+c)<0):
s+=1
print s | 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 Point {
double x, y;
};
struct stline {
Point a, b;
};
int dblcmp(double a, double b) {
if (fabs(a - b) <= 1E-6) return 0;
if (a > b)
return 1;
else
return -1;
}
double dot(double x1, double y1, double x2, double y2) {
return x1 * x2 + y1 * 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 | import java.math.*;
import java.util.*;
public class Main{
public static void main(String args[]){
BigInteger x1,y1,x2,y2;
int n,cnt = 0;
Scanner cin = new Scanner(System.in);
x1 = cin.nextBigInteger();y1 = cin.nextBigInteger();
x2 = cin.nextBigInteger();y2 = cin.nextBigInteger();
n = cin.nextInt();
whi... | 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 GCC optimize "Ofast"
#pragma GCC target "avx2"
using namespace std;
int main() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long n;
cin >> n;
long long x, y;
long long ans = 0;
for (int i = 0; i < n; i++) {
long long z;
cin >> x >> y >> z;
long long 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>
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
using namespace std;
long long xa, ya, xb, yb, a, b, c, con = 0;
bool test1, test2;
int n;
int main() {
cin >> xa >> ya >> xb >> yb >> 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x, y, xx, yy;
cin >> x >> y >> xx >> yy;
int t;
cin >> t;
long long ans = 0;
while (t--) {
long long a, b, c;
cin >> a >> b >> c;
long long s1 = a * x + b * y + c;
long long s2 = a * xx + b * yy + c;
if ((s1 > 0 && s2 <... | 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;
template <class T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
}
const int maxn = 2020;
int n, x;
long long a, b, c;
void solve() {
long long x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a >> b >> c;
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;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
template <typename t>
t abs(t a) {
if (a >= 0) return a;
return -a;
}
vector<string> split(const string& s, char c) {
vector<string> v;
stringstream ss(s);
string x;
while (getline(s... | 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 power(long long int a, long long int b, long long int m) {
if (b == 0) return (1);
long long int sol = power(a, b / 2, m);
sol = (sol * sol) % m;
if (b % 2 == 1) sol = (sol * a) % m;
return (sol);
}
long long int gcd(long long int a, long long int 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 | home = [int(_) for _ in raw_input().split()]
uni = [int(_) for _ in raw_input().split()]
n = input()
lines = []
for i in range(n):
lines.append([int(_) for _ in raw_input().split()])
# print lines
ans = 0
def where(point, line):
s = line[0] * point[0] + line[1] * point[1] + line[2]
if s > 0:
return 1
else:... | 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 | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(Syste... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.