Source stringclasses 1
value | Date int64 2.01k 2.02k | Text stringlengths 22 783k | Token_count int64 20 394k |
|---|---|---|---|
Project_CodeNet | 2,018 | // AOJ CGL_2_D Distance
// 2018.5.2 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct { double x, y; } PP;
typedef struct { PP s, e; } SEG, LINE;
#define INF 1e8
#define EPS 1e-8
#define EQ(a,b) (fabs((a)-(b))<EPS)
#define PPeQ(a,b) (EQ(a.x,b.x)&&EQ(a.y,b.y))
int dcmp(double x) { if... | 1,184 |
Project_CodeNet | 2,018 | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long int int64;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
typedef struct point2d{
int64 x,y;
} point;
typedef struct line2d{
point s,t;
} line;
void swap(int64 *a,int64 *b){
int64 ... | 1,062 |
Project_CodeNet | 2,020 | #include <stdio.h>
#include <math.h>
#define DOT(v1, v2) (v1.x * v2.x + v1.y * v2.y)
#define CROSS(v1, v2) (v1.x * v2.y - v1.y * v2.x)
#define NORM(v) (v.x * v.x + v.y * v.y)
#define ABS(v) (sqrt(NORM(v)))
typedef struct { double x, y; } point_t;
typedef point_t vector_t;
typedef struct { point_t p0, p1; } segment_t;
... | 954 |
Project_CodeNet | 2,019 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define min(p,q)((p)<(q)?(p):(q))
#define zahyoutype double
typedef struct Point{zahyoutype x,y;}P;
typedef struct line{P p1,p2;}L;
int sgn(zahyoutype x){return x<0?-1:x>0;}
double seglen(L s){return hypot(s.p2.x-s.p1.x,s.p2.y-s.p1.y);}
//opとoqの内積と外積
zahyoutype... | 822 |
Project_CodeNet | 2,017 | import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
int readint() {
return readln.chomp.to!int;
}
int[] readints() {
return readln.split.map!(to!int).array;
}
/// ?????? ab ?????? p ????????????
bool isOnSegment... | 916 |
Project_CodeNet | 2,018 | import math
EPS = 1e-10
def equals(a, b):
return abs(a - b) < EPS
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __add__(self, p):
return Point(self.x + p.x, self.y + p.y)
def __sub__(self, p):
return Point(self.x - p.x, self.y - p.y)
def ... | 898 |
Project_CodeNet | 2,018 | import math
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, pnt):
return math.sqrt((self.x - pnt.x)**2 + (self.y - pnt.y)**2)
class Segment():
def __init__(self, x1, y1, x2, y2):
self.p1 = Point(x1, y1)
self.p2 = Point(x2, y2)
... | 990 |
Project_CodeNet | 2,020 | import math
class Vector:
def __init__(self,x,y):
self.x = x
self.y = y
def __add__(self,other):
return Vector(self.x+other.x,self.y+other.y)
def __sub__(self,other):
return Vector(self.x-other.x,self.y-other.y)
def __mul__(self,scalar):
return... | 860 |
Project_CodeNet | 2,019 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())
#######################... | 1,621 |
Project_CodeNet | 2,015 | from sys import stdin
readline = stdin.readline
def main():
q = int(readline())
for i in range(q):
xy = map(int, readline().split())
p0, p1, p2, p3 = [x + y * 1j for x, y in zip(*[xy] * 2)]
print('{:.10f}'.format(distance(p0, p1, p2, p3)))
def lt(a, b):
if a.real != b.real:
... | 692 |
Project_CodeNet | 2,020 | from math import sqrt
def cross(P0, P1, P2):
x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
x1 -= x0; x2 -= x0
y1 -= y0; y2 -= y0
return x1*y2 - x2*y1
def dot(P0, P1, P2):
x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
x1 -= x0; x2 -= x0
y1 -= y0; y2 -= y0
return x1*x2 + y1*y2
def dist2(P0, P1):
... | 506 |
Project_CodeNet | 2,019 | import math
def dot(ux, uy, vx, vy):
return ux*vx + uy*vy
def cross(ux, uy, vx, vy):
return ux*vy - uy*vx
def dist_to_segment(x, y, ax, ay, bx, by):
if dot(x - ax, y - ay, bx - ax, by - ay) < 0:
return math.hypot(x - ax, y - ay)
if dot(x - bx, y - by, ax - bx, ay - by) < 0:
return ... | 478 |
Project_CodeNet | 2,020 | from functools import singledispatch
import math
EPS = 1e-10
COUNTER_CLOCKWISE = 1
CLOCKWISE = -1
ONLINE_BACK = 2
ONLINE_FRONT = -2
ON_SEGMENT = 0
class Segment():
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
class Point():
def __init__(self, x, y):
self.x = x
self.y... | 1,053 |
Project_CodeNet | 2,019 | # coding: utf-8
# Your code here!
EPS = 0.0000000001
COUNTER_CLOCKWISE = 1
CLOCKWISE = -1
ONLINE_BACK = 2
ONLINE_FRONT = -2
ON_SEGMENT = 0
class Point:
global EPS
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __add__(a, b):
s = a.x + b.x
... | 928 |
Project_CodeNet | 2,019 | from itertools import starmap
def cross(a: complex, b: complex) -> float:
return float(a.real * b.imag - a.imag * b.real)
def is_intersected(p0: complex, p1: complex, p2: complex, p3: complex) -> bool:
max_x1, min_x1 = (p0.real, p1.real) if p0.real > p1.real else (p1.real, p0.real)
max_x2, min_x2 = (p2.... | 635 |
Project_CodeNet | 2,018 | # -*- coding: utf-8 -*-
import collections
import math
class Vector2(collections.namedtuple("Vector2", ["x", "y"])):
def __add__(self, other):
return Vector2(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector2(self.x - other.x, self.y - other.y)
def __mul__(se... | 683 |
Project_CodeNet | 2,019 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')
class Geometry:
EPS = 10 ** -9
def add(self, a, b... | 1,200 |
Project_CodeNet | 2,020 | def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def ccw(p0, p1, p2):
a = p1 - p0
b = p2 - p0
cross_ab = cross(a, b)
if cross_ab > 0:
return 1
elif cross_ab < 0:
return -1
elif dot(a, b) < 0:
... | 608 |
Project_CodeNet | 2,018 | #!/usr/bin/env python
import sys
import math
import itertools as it
from collections import deque
sys.setrecursionlimit(10000000)
def in_sec(a, b, c):
return min(a, b) <= c <= max(a, b)
def dist(xp, yp, xq, yq):
return math.sqrt((xq - xp) ** 2 + (yp - yq) ** 2)
def min_d(x, y, xp, yp, xq, yq):
vx, vy = [... | 766 |
Project_CodeNet | 2,016 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
0 0 1 0 0 1 1 1
0 0 1 0 2 1 1 2
-1 0 1 0 0 1 0 -1
output:
1.0000000000
1.4142135624
0.0000000000
"""
import sys
from collections import namedtuple
EPS = 1e-9
def cross(a, b):
return a.real * b.imag - a.imag * b.real
def dot(a, b):
return a.real ... | 689 |
Project_CodeNet | 2,016 | from itertools import starmap
def cross(a, b):
return a.real * b.imag - a.imag * b.real
def has_intersection(p0, p1, p2, p3):
max_x1, min_x1 = (p0.real, p1.real) if p0.real > p1.real else (p1.real, p0.real)
max_x2, min_x2 = (p2.real, p3.real) if p2.real > p3.real else (p3.real, p2.real)
if max_x1 < ... | 522 |
Project_CodeNet | 2,019 | import math
class Vector2():
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, v):
return Vector2(self.x+v.x, self.y+v.y)
def __sub__(self, v):
return Vector2(self.x-v.x, self.y-v.y)
def __mul__(self, v):
return Vector2(self.x*v, self.y*v)
... | 796 |
Project_CodeNet | 2,017 | def cross(c1, c2):
return c1.real * c2.imag - c1.imag * c2.real
def dot(c1, c2):
return c1.real * c2.real + c1.imag * c2.imag
def ccw(p0, p1, p2):
a = p1 - p0
b = p2 - p0
cross_ab = cross(a, b)
if cross_ab > 0:
return 1
elif cross_ab < 0:
return -1
elif dot(a, b) < 0:
... | 616 |
Project_CodeNet | 2,017 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class Point(object):
epsilon = 1e-10
def __init__(self, x=0.0, y=0.0):
if isinstance(x, tuple):
self.x = x[0]
self.... | 1,765 |
Project_CodeNet | 2,017 | import sys
class Line:
def __init__(self,p1,p2):
if p1[1] < p2[1]:self.s=p2;self.e=p1
elif p1[1] > p2[1]:self.s=p1;self.e=p2
else:
if p1[0] < p2[0]:self.s=p1;self.e=p2
else:self.s=p2;self.e=p1
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def dot(a,b):return a[0]*b[0]+... | 922 |
Project_CodeNet | 2,018 | import math
from typing import Union
class Point(object):
__slots__ = ['x', 'y']
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Point(self.x - other.x, self.y... | 1,090 |
Project_CodeNet | 2,020 | import math
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Point(self.x - other.x, self.y - other.y)
def __mul__(self, other):
return Point(s... | 997 |
Project_CodeNet | 2,020 | from math import pi, cos, sin, atan2
EPS = 10**(-9)
def eq(value1, value2):
return abs(value1-value2) <= EPS
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
self.arg = atan2(y, x) # -PI ~ PI
def __str__(self):
return "{0:.8f} {1:.8f}".format(self.x, self... | 2,677 |
Project_CodeNet | 2,019 | #!/usr/bin/python3
import array
from fractions import Fraction
import math
import os
import sys
def main():
Q = read_int()
for _ in range(Q):
x0, y0, x1, y1, x2, y2, x3, y3 = read_ints()
print(solve(Vec(x0, y0), Vec(x1, y1), Vec(x2, y2), Vec(x3, y3)))
def pairwise_min2(a, b, c):
return ... | 1,133 |
Project_CodeNet | 2,019 | def dot(a, b):
return a.real * b.real + a.imag * b.imag
def cross(a, b):
return a.real * b.imag - a.imag * b.real
def ccw(p0, p1, p2):
a = p1-p0
b = p2-p0
if cross(a,b) > 0:
return 1 #couner_clockwise
elif cross(a,b) <0:
return -1 #clockwise
elif dot(a,b) < 0:
return 2 #online_back
elif ab... | 433 |
Project_CodeNet | 2,017 | from math import sqrt
q = int(input())
class Segment(): pass
def dot(a, b):
return sum([i * j for i,j in zip(a, b)])
def sub(a, b):
return [a[0] - b[0],a[1] - b[1]]
def cross(a, b):
return a[0] * b[1] - a[1] * b[0]
def norm(a):
return sqrt(a[0] ** 2 + a[1] ** 2)
def ccw(a, b, c):
x = sub(b, a... | 571 |
Project_CodeNet | 2,019 | import cmath
import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
PI = cmath.pi
TAU = cmath.pi * 2
EPS = 1e-8
class Point:
"""
2次元空間上の点
"""
def __init__(self, c: comple... | 3,023 |
Project_CodeNet | 2,020 | import math
def cross(a,b): #外積
return a.real*b.imag-a.imag*b.real
def dot(a,b): #内積
return a.real*b.real+a.imag*b.imag
def norm2(a,b): #大きさの2乗
return (b.real-a.real)**2+(b.imag-a.imag)**2
def is_intersect(p0,p1,p2,p3): #交差しているのかを判定
ta=cross(p1-p0,p2-p0)
tb=cross(p1-p0,p3-p0)
tc=cross(p3-p2,p0-p2)
td=... | 449 |
Project_CodeNet | 2,018 | #!/usr/bin/env python3
# CGL_2_D: Segments/Lines - Distance
from math import sqrt
class Segment:
def __init__(self, p0, p1):
self.end_points = (p0, p1)
def another(self, p):
if p == self.end_points[0]:
return self.end_points[1]
else:
return self.end_points[0]
... | 972 |
Project_CodeNet | 2,020 | EPS = 10**(-9)
def is_equal(a,b):
return abs(a-b) < EPS
def norm(v,i=2):
import math
ret = 0
n = len(v)
for j in range(n):
ret += abs(v[j])**i
return math.pow(ret,1/i)
class Vector(list):
"""
ベクトルクラス
対応演算子
+ : ベクトル和
- : ベクトル差
* : スカラー倍、または内積
/ : スカラー除法
... | 1,976 |
Project_CodeNet | 2,019 | EPS = 1e-4
#点と線分の距離
def PointSegmentDistance(point, begin, end):
point, begin, end = point-begin, 0, end-begin
point = (point / end) * abs(end)
end = abs(end)
if -EPS <= point.real <= abs(end):
return abs(point.imag)
else:
return min(abs(point), abs(point - end))
#外積
def OuterProduct(one, two):
tmp = one.co... | 578 |
Project_CodeNet | 2,017 | import sys
from collections import namedtuple
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
class Segment(namedtuple('Point', ('fi', 'se'))):
__slots__ = ()
def cross(a, b):
return a.real * b.imag - a.imag * b.real
def dot(a, b):
return a.real * b.real + a.imag * b.imag
def norm(bas... | 640 |
Project_CodeNet | 2,019 | #! /usr/bin/env python3
from typing import List, Tuple
from math import sqrt
EPS = 1e-10
def float_equal(x: float, y: float) -> bool:
return abs(x - y) < EPS
class Point:
def __init__(self, x: float=0.0, y: float=0.0) -> None:
self.x = x
self.y = y
def __repr__(self) -> str:
... | 1,478 |
Project_CodeNet | 2,017 | from math import sqrt
def cross(P0, P1, P2):
x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
x1 -= x0; x2 -= x0
y1 -= y0; y2 -= y0
return x1*y2 - x2*y1
def dot(P0, P1, P2):
x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
x1 -= x0; x2 -= x0
y1 -= y0; y2 -= y0
return x1*x2 + y1*y2
def dist2(P0, P1):
x0,... | 506 |
Project_CodeNet | 2,019 | from sys import stdin
import math
EPS = 1e-10
class Vector:
def __init__(self, x=None, y=None):
self.x = x
self.y = y
def __add__(self, other):
return Vector(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector(self.x - other.x, self.y - other.y)
... | 1,109 |
Project_CodeNet | 2,017 | def is_intersection(x0, y0, x1, y1, x2, y2, x3, y3)
if x0 < x1 && ((x2 < x0 && x3 < x0) || (x1 < x2 && x1 < x3))
return false
elsif x1 <= x0 && ((x2 < x1 && x3 < x1) || (x0 < x2 && x0 < x3))
return false
elsif y0 < y1 && ((y2 < y0 && y3 < y0) || (y1 < y2 && y1 < y3))
return false
elsif y1 <= y0 && (... | 753 |
Project_CodeNet | 2,017 | gets.to_i.times do
p0, p1, p2, p3 = gets.split.map(&:to_i).each_slice(2).map {|a, b| a + b * 1i }
u, v, w, z = p1 - p0, p3 - p2, p2 - p0, p3 - p0
d, c = (u.conj * v).rect
if c.zero?
if (u.conj * w).imag.zero?
ud, wd, zd = [u, w, z].map {|x| (u.conj * x).real }
a, b = 0, ud
a, b = b, a if b... | 591 |
Project_CodeNet | 2,016 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static readonly double EPS = 1E-10;
static void Main(string[] args)
{
int q = int.Parse(Console.ReadLine());
StringBuilder sb =... | 1,228 |
Project_CodeNet | 2,016 | using System;
//using System.Collections.Generic;
//using System.Linq;
//using Vector = CGL.Point;
//using Line = CGL.Segment;
//using Polygon = System.Collections.Generic.List<CGL.Point>;
namespace CGL
{
class Program
{
static void Main(string[] args)
{
var q = scan[0];
... | 1,180 |
Project_CodeNet | 2,017 | using System;
using System.Text;
namespace CGL_2_D_Distance
{
class Program
{
static void Main ( string[] args )
{
int inputCount = int.Parse (Console.ReadLine ());
StringBuilder output = new StringBuilder (inputCount * 15);
for (int lp = 0; lp < inputCount; lp++)
{
int[] inputNum = Array.Conver... | 1,307 |
Project_CodeNet | 2,019 | using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
namespace AOJ
{
using Vector = Point;
using Line = Segment;
using Polygon = List<Point>;
class Consts
{
public static readonly double EPS = 1e-10;
}
... | 1,984 |
Project_CodeNet | 2,017 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Aoj.CGL.Lib;
namespace Aoj.CGL.Chapter2D
{
class Program
{
public static void Solve()
{
int q = int.Parse(Console.ReadLine());
for (int i = 0; i < q; i... | 2,350 |
Project_CodeNet | 2,020 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;
using static Geometory;
using Vector = Geometory.Point;
using Line = Geometory.Segment;
public clas... | 1,812 |
Project_CodeNet | 2,016 | using System;
using System.Linq;
namespace geometry
{
public class Point{
public double x, y;
public Point(){
this.x = this.y = 0;
}
public Point(double x, double y){
this.x = x;
this.y = y;
}
public static Point operator+(Point p1, Point p2){
return new Point (p1.x + p2.x, p1.y + p2.y);
}... | 2,636 |
Project_CodeNet | 2,019 | using System;
using System.Collections.Generic;
using System.Linq;
namespace CSharpSample01
{
class Vector2
{
public double x;
public double y;
public Vector2() { }
public Vector2(double x, double y)
{
this.x = x;
this.y = y;
}
... | 1,495 |
Project_CodeNet | 2,016 | using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
//using System.Numerics;
using Enu = System.Linq.Enumerable;
public class Program
{
public void Solve()
{
int NQ = Reader.Int();
for (int q = 0; q < NQ; q++)
... | 1,514 |
Project_CodeNet | 2,020 | (eval-when (:compile-toplevel :load-toplevel :execute)
(sb-int:defconstant-eqx opt
#+swank '(optimize (speed 3) (safety 2))
#-swank '(optimize (speed 3) (safety 0) (debug 0))
#'equal)
#+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
#-swank (set-dispatch-macro-character
#\# #\> (... | 1,365 |
Project_CodeNet | 2,018 | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Random;
public class Main {
static final long C = 1000000007;
s... | 1,424 |
Project_CodeNet | 2,019 | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int N = stdIn.nextInt();
int[][] a = new int[2][N];
int tmpSum = 0;
List<Integer> sum = new Arr... | 316 |
Project_CodeNet | 2,018 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStrea... | 315 |
Project_CodeNet | 2,018 | import java.io.*;
import java.util.*;
public class Main {
static MyScanner sc;
private static PrintWriter out;
static long M2 = 1_000_000_000L + 7;
public static void main(String[] s) throws Exception {
StringBuilder stringBuilder = new StringBuilder();
// stringBuilder.append("4 10 4 ... | 1,955 |
Project_CodeNet | 2,019 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[][] candy = new long[2][n];
for(int i = 0; i < 2; i++) {
for(int j = 0; j < n; j++) {
candy[i][j] = sc.nextLong();
}
}
long[][] sum = new long[... | 251 |
Project_CodeNet | 2,019 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int[] a2=new int[n];
int[] s1=new int[n];
int[] s2=new int[n];
int ans=0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
for(int i=0;i<n;... | 239 |
Project_CodeNet | 2,018 | import java.util.Scanner;
/**
* Created by Santa on 2016/10/16.
*/
public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int a[][] = new int[2][N];
int map[][] = new int[2][N];
for (int i = 0; i <... | 238 |
Project_CodeNet | 2,018 | import java.util.Scanner;
public class Main {
public void main(Scanner sc) {
int n = sc.nextInt();
int map[][] = new int[2][n];
int sum[][] = new int[2][n];
for (int i = 0; i < 2; i++) {
for (int j = 0; j < n; j++) {
map[i][j] = sc.nextInt();
... | 271 |
Project_CodeNet | 2,018 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] a = new int[n][2];
for(int i=0; i<2; i++){
for(int j=0; j<n; j++){
a[j][i] = sc.nextInt();
... | 182 |
Project_CodeNet | 2,018 | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
int[] top = new int[n];
int[] bot = new int[n];
String[] r = in.readLine... | 259 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] a = new int[2][n];
int[][] d = new int[2][n];
for(int i=0; i<2; i++) {
for(int j=0; j<n; j++) {
a[i][j] = sc.nextIn... | 1,160 |
Project_CodeNet | 2,018 | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
int t = 1;
Solver s = new Solver();
for (int i = 1; i <= t; i++) {
... | 505 |
Project_CodeNet | 2,018 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] A = new int[2][N];
for (int i = 0; i < 2 ; i++)
for (int j = 0; j < N; j++)
A[i][j] = sc.nextInt();
int[][] B = new int[2][N];
... | 243 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] map = new int[2][N];
int tmpSum;
int maxSum = 0;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < N; j++) {
map[i][j] = sc.nextInt();
}
}
for (... | 217 |
Project_CodeNet | 2,018 | import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;
class Main{
private void solve(){
int n=gInt();
int[][]f=new int[3][n+1];
for(int i:rep(1,2))
for(int j:rep(1,n))
f[i][j]=g... | 505 |
Project_CodeNet | 2,018 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
class Main {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
PrintWriter pw=new P... | 364 |
Project_CodeNet | 2,020 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] a = new int[2][n];
int[][] dp = new int[2][n];
for(int i = 0; i < 2; i++) {
for(int j = 0; j < n; j++) {
a[i][j] = sc.nextInt();
}
}
dp[0]... | 292 |
Project_CodeNet | 2,018 | 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 st... | 645 |
Project_CodeNet | 2,018 | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int candies[][] = new int[2][num];
for(int m=0;m<2;m++){
for(int n=0;n<num;n++){
candies[m][n] = sc.nextInt();
}
}
int max=0;
for(int m=0;m<num;m++){
int ... | 173 |
Project_CodeNet | 2,018 | // package arc.arc090;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = n... | 739 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.nextLine());
String X = sc.nextLine();
String Y = sc.nextLine();
String[] sa1 = X.split(" ");
String[] sa2 = Y.split(" ")... | 222 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] A = new int[2][N];
int[] sum = {0,0};
int a = 0;
for(int i=0;i<2;i++){
for(int j = 0;j<N;j++){
A[i][j] = sc.nextInt();
}
}
for(int i=0;i<N;i++){
... | 210 |
Project_CodeNet | 2,020 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
int[] u = new int[n];
int[]... | 545 |
Project_CodeNet | 2,018 | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException {
int N = readInt(), candy[][] = new int[N+1][3], DP[][] = new int[N+1][3];
for(int j = 1; j<=2; j++) for(int i = 1; i<=N; i++) candy[i][j] = readInt();
for(int j = 1; j<=2; j++) for(int i = 1;... | 447 |
Project_CodeNet | 2,020 | import java.util.*;
import java.io.*;
public class Main implements Runnable {
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler((t,e)->System.exit(1));
// keep stack
new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
}
public void run() {
... | 934 |
Project_CodeNet | 2,018 | 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 Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int n = ... | 1,159 |
Project_CodeNet | 2,020 | import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < ... | 694 |
Project_CodeNet | 2,018 | import java.io.*;
import java.lang.reflect.WildcardType;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.OpenOption;
import java.security.SecureRandom;
import java.util.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
ConsoleIO io = new Con... | 1,475 |
Project_CodeNet | 2,019 | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import static java.util.stream.Collectors.toList;
public class Main {
private static final Scanner scanner = new Scanner(System.in);
priv... | 289 |
Project_CodeNet | 2,019 | import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
Scanner s =new Scanner(System.in);
int i;
i=s.nextInt();
s.nextLine();
int[][] dp= new int[2][i];
int[][] mat= new int[2][i];
for(int n=0;n<2;n++){
... | 262 |
Project_CodeNet | 2,018 | import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
Main m = new Main();
//... | 877 |
Project_CodeNet | 2,018 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static class Scanner{
BufferedReader br=null;
StringTokenizer tk=null;
public Scanner(){
br=new BufferedReader(new InputStreamReader(System.in));
}
public S... | 391 |
Project_CodeNet | 2,018 | import java.util.Scanner;
/**
* https://arc090.contest.atcoder.jp/tasks/arc090_a
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] a = new int[2][N];
for(int i=0; i<N; i++) a[0][i] = sc.nextInt();
for(int i=0; i<N; i++) a... | 288 |
Project_CodeNet | 2,018 | 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... | 478 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[][] nums = new int[2][N];
long answer = 0;
for (int a = 0; a < 2; a++) {
for (int i = 0; i < N; i++) {
nums[a][i] = in.nextInt();
}
}
for (int... | 204 |
Project_CodeNet | 2,018 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int [][] A = new int[2][N];
for (int i=0; i<2; i++)
for (int j=0; j<N; j++)
... | 221 |
Project_CodeNet | 2,018 | /**
* Created by Aminul on 1/28/2018.
*/
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args)throws Exception {
FastReader in = new FastReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
n = in.nextInt();
a = new int[3][n+1... | 1,110 |
Project_CodeNet | 2,018 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = in.nextInt();
int [][] arr = new int[2][n];
... | 220 |
Project_CodeNet | 2,018 | import java.util.Scanner;
import java.lang.Math;
public class Main {
private static final int maxn = 111;
private static int[][] a = new int[3][maxn], f = new int[3][maxn];
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i... | 192 |
Project_CodeNet | 2,019 | import java.util.Scanner;
public class Main {
private static void solve(int n, int[] a, int[] b) {
int[] sumA = new int[n + 1];
int[] sumB = new int[n + 1];
for (int i = 0; i < n; i++) {
sumA[i + 1] = sumA[i] + a[i];
sumB[i + 1] = sumB[i] + b[i];
}
int max = 0;
for (int i = 1; i <... | 298 |
Project_CodeNet | 2,018 | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
static class Fast {
BufferedReader br;
StringTokenizer st;
public Fast() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
... | 385 |
Project_CodeNet | 2,018 | 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... | 444 |
Project_CodeNet | 2,019 | import java.util.*;
import java.lang.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[][] candy = new int[2][N];
for(int h=0; h<2; h++) for(int w=0; w<N; w++) candy[h][w]=sc.nextInt();
int[][] sum... | 211 |
Project_CodeNet | 2,018 | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] a = new int[N];
int[] b = new int[N];
for(int i = 0;i < N;i++){
a[i] = sc.nextInt();
}
for(int i = 0;i < N;i++){
b[i] = sc.nextInt();
}
int ans = 0;
... | 176 |
Project_CodeNet | 2,018 | import java.util.Scanner;
class C {
public static void main(String... args) {
final Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
final int[][] A = new int[N][2];
for(int i = 0; i < 2; i++)
for(int j = 0; j < N; j++)
A[j][i] = sc.nextIn... | 205 |
Project_CodeNet | 2,018 | import java.util.Scanner;
public class Main {
static public void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[][] aArray = new int[2][n];
for (int i = 0; i < 2; i++) {
for (int j = 0; j < n; j++) {
aArray[i][j] = scan.nextInt();
}
}
scan.close();
i... | 229 |
Project_CodeNet | 2,018 | import java.io.*;
import java.util.*;
import java.math.*;
// import java.awt.Point;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
long mod = 1_000_000_007;
long inf = Long.MAX_VALUE;
void solve(){
int n = ni();
int[] a = new int[n];
int[] b ... | 993 |
Project_CodeNet | 2,018 | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
int N;
int[][] a;
private void solve() {
N = nextInt();
a = new int[2][N];
for(int i = 0;i < 2;i++) {
for(int j = 0;j < N;j++) {
... | 532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.