prompt string | response string |
|---|---|
Problem: Anchored Balloon
A balloon placed on the ground is connected to one or more anchors on the ground with ropes. Each rope is long enough to connect the balloon and the anchor. No two ropes cross each other. Figure E-1 shows such a situation.
<image>
Figure E-1: A balloon and ropes on the ground
Now the balloo... | #include<bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
#define SQR(x) ((x) * (x))
int main()
{
int N, X[10], Y[10], L[10];
double D[10][10];
while(scanf("%d", &N), N) {
for(int i = 0; i < N; ++i) {
scanf("%d %d %d", &X[i], &Y[i], &L[i]);
}
for(int i = 0; i < N; i++) {
... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <utility>
#include <vector>
namespace lc {
static const double EPS = 1e-9;
inline double abs(double x){ return std::abs(x); }
inline bool tolerant_eq(double a, double b){ return abs(a - b) < EPS; }
}
namespace lc {
s... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
#define EPS 1e-9
typedef complex<double> P;
typedef const P &rP;
double pi = acos(-1.0);
int n;
double r0;
vector<P> c;
vector<double> r;
vector<P> tcs;
vector<vect... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<cstdio>
#include<vector>
#include<cmath>
#include<complex>
#include<algorithm>
using namespace std;
typedef double Real;
typedef complex<Real> Point;
const Real PI=acos(-1.0);
const Real eps=1e-8;
template<class T> bool eq(T a, T b){
return abs(a-b)<eps;
}
template<class T> int sgn(T a){
if(eq(a,(T)0)) ... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<bits/stdc++.h>
using namespace std;
const double eps=1e-8;
const double pi=acos(-1);
const int maxn=111;
int sgn(double x){return (x>eps)-(x<-eps);}
int sgn(double a,double b){return sgn(a-b);}
double sqr(double x){return x*x;}
struct P{
double x,y;
P(){}
P(double x,double y):x(x),y(y){}
double len2(){
r... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
double x, y;
Pt() ... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<cstdio>
#include<cmath>
#include<complex>
#include<vector>
#include<algorithm>
using namespace std;
const double eps=1e-9;
const double PI=3.14159265358979323846264;
typedef complex<double> Point;
typedef complex<double> Vector;
template<class T> bool eq(T a,T b){
return abs(a-b)<eps;
}
double normalize(... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<bits/stdc++.h>
#define inf 1<<29
#define linf 1e16
#define eps (1e-4)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(do... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <cstdio>
#include <cassert>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
using namespace std;
typedef complex<double> P;
const double EPS = 1e-10;
const double PI = 3.1415926535;
class Circle{
... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pa... |
Problem: You are given a set of circles C of a variety of radii (radiuses) placed at a variety of positions, possibly overlapping one another. Given a circle with radius r, that circle may be placed so that it encircles all of the circles in the set C if r is large enough.
There may be more than one possible position ... | #include<iostream>
#include<complex>
#include<cmath>
#include<vector>
#include<iomanip>
#include<set>
#include<functional>
#include<algorithm>
#include<cstdlib>
#include<cassert>
using namespace std;
typedef double elem;
typedef complex<elem> point, vec;
typedef pair<point,point> pp;
const elem eps = 1e-8;
const elem... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include ... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... |
class SegmentTree(object):
def __init__(self, a:list, default: int, op):
from math import ceil, log
real_size = len(a)
self.elem_size = elem_size = 1<<ceil(log(real_size, 2))
self.tree = tree = [default] * (elem_size * 2)
tree[elem_size:elem_size + real_size] = a
sel... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
const long long INIT = (1ll << 55);
class segment_tree {
private:
int n;
vector<long long> dat;
static inline long long func(long long a, long long b) {
return min(a, b);
}
long long query(int a, int b, int k, int l, int r) const {
if(r <= a || b <= l)... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
#define NUM 500000
int N;
int bean[100005];
vector<int> V[NUM];
void init(int first_N){
while(N < ... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
using u32 = unsigned int;
using u64 = unsigned long long;
int popcount(unsigned long long a) {
a = (a & 0x5555555555555555) + (a >> 1 & 0x5555555555555555);
a = (a & 0x3333333333333333) + (a >> 2 & 0x3333333333333333);
a = (a & 0x0f0f0f0f0f0f0f0f) + (a >> 4 & ... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstdlib>
using namespace std;
class range {
private:
struct Iterator {
int val;
int operator*() {return val;}
bool operator!=(Iterator &itr) {return val < itr.val;}
void operator++() {++val;}
};
Iterator i, n... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX_N = 1 << 17;
template<typename T, T INF>
struct Wavelet{
void init(const vector<T>& A){
N = 1;
while(N < A.size()) N *= 2;
for(int i = 0; i < N; i++){
if(i < A.size()) sorted[i] = b[0][i] = A[i];
else sorted[i] = b[0][i] = I... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
struct FullyIndexableDictionary{
int len,blk;
vector<int> bit,sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k){
bit[k>>5]|=1<... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
#define int long long
#define inf 1000000007
#define pa pair<int,int>
#define ll long long
#define pal pair<double,double>
#define ppap pair<pa,int>
#define PI 3.14159265358979323846
#define paa pair<int,char>
#define mp make_p... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pa... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
vector<int> t[(1<<18)];
void update(int i,int a){
i+=(1<<17)-1;
while(1){
t[i].push_back(a);
if(i==0)break;
else i=(i-1)/2;
}
}
int query(int a,int b,int x,int k,int l,int r){
if(b<=l || r<=a)return 1e9;
if(a<=l && r<=b){
vector<int> :: iterator ... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #line 1 "1549.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/problems/1549"
#include <bits/stdc++.h> // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
class MergeTree {
const int n;
vector<vector<T>> data;
int size(int n) {
int res;
for (res = 1; res < n; res <<= 1);
return res;
}
public:
MergeTree(const vector<T>& data_) : n(size(data_.size())), data(n * 2)
{
for (int i = 0; i < (int)... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | // includes
#include <bits/stdc++.h>
// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
struct FullyIndexableDictionary{
int len,blk;
vector<int> bit,sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k){
bit[k>>5]|=1<<(k&31);
}
... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
struct BitVector{
vector<uint64_t> v;
vector<int> r;
BitVector(){}
void build(){
r.assign(v.size() + 1, 0);
for(int i = 0; i < v.size(); ++i)
r[i + 1] = r[i] + __builtin_popcountll(v[i]);
}
bool ... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
struct FullyIndexableDictionary{
int len,blk;
vector<int> bit,sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k){
bit[k>>5]|=1<<(k&31);
}
... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
#define N (1<<18)
#define INF (1e9)
using namespace std;
vector<int> tree[N];
int n,d;
void Update(){
for(int i=0;i<n;i++){
int pos=i+N/2-1;
while(pos){
pos=(pos-1)/2;
tree[pos].push_back(tree[i+N/2-1][1]);
}
}
f... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
#define INF (1<<29)
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
inline int popCount(unsigned i... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
co... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climit... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
class segtree{
public:
static const int N=1<<17;
vector<int> vec[1<<18];
segtree(){
}
void update(int k,int v){
k+=N-1;
vec[k].push_back(v);
while(k>0){
k=(k-1)/2;
vec[k].push_back(v);
... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
struct FullyIndexableDictionary{
int len,blk;
vector<unsigned> bit;
vector<int> sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
struct FullyIndexableDictionary{
int len,blk;
vector<int> bit,sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k){
bit[k>>5]|=1<<(k&31);
}
... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include <cstdio>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
#define N 111111
typedef int ll;
ll p[N];
vector<ll> dat[1<<18]; //Nより大きい2^(k+1)
void init(int k,int l,int r)
{
dat[k].clear();
if( r-l == 1 ) {
dat[k].push_back(p[l]);
} else {
int lch = k*2+1, rch = k*2+2... |
Problem: Problem
Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai.
Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. There... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
struct FullyIndexableDictionary{
int len,blk;
vector<unsigned> bit;
vector<int> sum;
FullyIndexableDictionary(){}
FullyIndexableDictionary(int len)
:len(len),blk((len+31)>>5),bit(blk,0),sum(blk,0){}
void set(int k... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef complex<double> Point;
const double EPS = 1e-6;
double dot(Point a, Point b){
return real(conj(a) * b);
}
double cross(Point a, Point b){
return imag(conj(a) * b);
}
int ccw(Point a, Point b, Point c) {
b -... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <complex>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <functional>
#include <string>
#include... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <cstdio>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef complex<double> P;
typedef const P &rP;
double pi2;
vector<double> intrarg(rP s, double r, rP p, rP q){
vector<double> ret;
P v = q - p;
P w = p - s;
double a = norm(v);
double b = real(v) *... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1);
const double PI2=PI*2.0;
const double eps=1e-10;
typedef complex<double> P;
typedef pair<P,P> S;
typedef pair<P,double> C;
typedef vector<P> vecP;
bool eq(double a,double b){
return -eps<a-b&&a-b<eps;
}
double Sqrt(double x){
if(x<0)return x... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <complex>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>
using namespace std;
#define EPS 1e-7
#define INF 360
#define PI M_PI
int N, M;
typedef complex<double> Point;
namespace std{
bool operator < (const Point &a, const Point &b){
retu... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const double EPS=1e-9;
const double PI=acos(-1);
template<class T>
struct point{
T x,y;
point operator+(const point &a)const{ return (point){x+a.x,y+a.y}; }
point operator-(const poi... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <complex>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <functional>
#include <string>
#include... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <iostream>
#include <algorithm>
#include <complex>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
const double EPS = 1e-8;
struct C{
P c;
double r;
C(P c=P(0,0), double r=0.0):c(c),r(r){}
};
double dot(P a, P b){return real(co... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | // ぶつかるとき頂点が辺に 触れる
// 内側の点がぶつからずにどこまで行けるか
// 外側の点がぶつからずにどこまで行けるか
// のminをとる
#include <complex>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
typedef d... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include<iostream>
#include<algorithm>
#include<complex>
#include<vector>
#include<cmath>
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define NEXT(i,n) ((i+1)%(n))
#define mp make_pair
#define pb push_back
using namespace std;
typedef complex<double> P;
const double pi = aco... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void ch... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
using namespace std;
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
s... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
/* 幾何の基本 */
#include <complex>
typedef complex<ld> Point;
const ld pi = acos(-1.0);
const ld dtop = pi / 180.;
const ld ptod = 1. / dtop;
names... |
Problem: HCII, the health committee for interstellar intelligence, aims to take care of the health of every interstellar intelligence.
Staff of HCII uses a special equipment for health checks of patients. This equipment looks like a polygon-shaped room with plenty of instruments. The staff puts a patient into the equi... | #include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <complex>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <functional>
#include <string>
#include... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
const int MAX_CARDS = 9;
int T;
scanf("%d", &T);
for (int t = 0; t < T; ++t) {
vector<int> gates(MAX_CARDS), jackie(MAX_CARDS);
for (int i = 0; i < MAX_CARDS; ++i)
scanf("%d", &gates[i]);
for (int i = ... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
#define debug(x) cout<< #x <<" : "<< x << endl;
#define repi(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) repi(i, 0, n);
#define int long long
const int INF = (1<<30);
const int ... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#i... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
while(n--){
int g[9],j[9];
for(int i=0;i<9;i++) cin>>g[i];
for(int i=0;i<9;i++) cin>>j[i];
sort(j,j+9);
int cnt=0;
do{
int sc=0;
for(int i=0;i<9;i++) if(g[i]>j[i]) sc+=g[i]+j[i];
if(sc>=86) cnt++;
}while(... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.Scanner;
//Card Game
public class Main{
int[] a, b;
boolean[] u;
int res;
void dfs(int k, int pa, int pb){
if(k==9){
res+=pb<pa?1:0;
return;
}
for(int i=0;i<9;i++){
if(u[i])continue;
u[i] = true;
dfs(k+1, pa+(b[k]<a[i]?a[i]+b[k]:0), pb+(b[k]<a[i]?0:a[i]+b[k]));
u[i] = fa... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;
#define ... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
unsigned long long xor128() {
static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123;
unsigned long long rt = (rx ^ (rx << 11));
rx = ry;
ry = rz;
rz = rw;
ret... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;
int table_4[24][4],table_5[120][5],index_9,m_data[9] = {0,1,2,3,4,5,6,7,8};
int** table_9;
void calc9(){
int select_num = 5,num,loc_... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int sum;
static int[] a,b;
static int[][] dp;
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
for(int test =sc.nextInt();test--!=0;){
a=new int[9];
b=new int[9];
sum=0;
for(int i=1;i<=18;i++){
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
using namespace std;
int n, a[2][9]; bool used[10];
int rec(int dep, int s) {
if (dep == 9) return (s > 0 ? 1 : 0);
int ret = 0;
for (int i = 0; i < 9; i++) {
if (!used[i]) {
used[i] = true;
if (a[0][i] > a[1][dep]) ret += rec(dep + 1, s + a[0][i] + a[1][dep]);
else ret += rec(dep + 1,... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
const int N = 9;
int va[10];
int vb[10];
int main(){
cout.setf(ios::fixed);
cout.precision(8);
int T;
cin >> T;
while(T--){
rep(i, N) cin >> va[i];
rep(i, N) cin >> vb[i];
int acnt = 0;
int bcn... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
const int INF = 1000000007;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int aans = 0,bans= 0;
int a[9],b[9];
void rec(int i,int asum,int bsum){
if(i == 9){ // ???????????¶
if(asum > bsum ) aans++;
else bans++;... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;
int table_4[24][4],table_5[120][5],index_9,m_data[9] = {0,1,2,3,4,5,6,7,8};
int** table_9;
void calc9(){
int select_num = 5,num,loc_... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.*;
public class Main{
int p1,p2;
boolean[] used;
int[] c1,c2,per;
void solve(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n-->0){
c1 = new int[9];
c2 = new int[9];
for(int i=0; i<9; i++) c1[i] = sc.ne... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <queue>
using namespace std;
class Point{
public:
int a,b,c;
bool f[9];
};
int main(){
int i,j,n,a[9],b[9],sum,ans;
cin >> n;
for(int t=0;t<n;t++){
for(i=0;i<9;i++) cin >> a[i];
for(i=0;i<9;i++) ci... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int C[2][9];
void solve() {
int geits = 0;
int cnt = 0;
sort(C[0], C[1]);
do {
int g, j;
g = j = 0;
for(int i = 0; i < 9; ++i) {
if(C[0][i] > C[1][i]) g += C[0][i] + C[1][i];
else j += C[... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
while(n--){
vector<int> a(9);
vector<int> b(9);
long long suma=0,sumb=0;
for(int i=0;i<9;++i) cin >> a[i];
for(int i=0;i<9;++i) cin >> b[i];
sort(a.begin(),a.end()); sort(b.begin(),b.end());
int anum=0,bnum=0;
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<bits/stdc++.h>
using namespace std;
using Int = long long;
using ll = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};
signed solve(){
const Int n=9;
vector<Int> as(n),bs(n);
for(Int i=... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
while(N--) {
int a[9], b[9];
for(int i=0; i<9; i++)
cin >> a[i];
for(int i=0; i<9; i++)
cin >> b[i];
sort(a, a+9);
double A = 0, B = 0;
do {
int cntA=0, cntB=0;
for(int i=0; i<9; i++) {
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.Scanner;
public class Main {
public static int[] G = new int[9];
public static int[] J = new int[9];
public static int[] G2 = new int[9];
public static boolean[] used = new boolean[9];
public static int win = 0;
public static int lose = 0;
public static int draw = 0;
/**
* @param args
*... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* c... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#de... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdli... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
const int n = 9;
const int time = 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2;
int t;
int a[n], b[n];
cin >> t;
while (t--) {
int sum = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i];
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (n) ; ++i )
int N,res,cd1[9],cd2[9];
bool used[9];
void dfs(int cnt,int pta,int ptb){
if(cnt == 9){
res += pta > ptb ? 1 : 0;
return;
}
rep(i,9){
if(used[i]) continue;
used[i] = true;... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<bits/stdc++.h>
#define N 9
#define S 172
using namespace std;
int n,a[N],b[N];
double ans1,ans2;
int dp[(1<<N)][10][S];
int main(){
cin>>n;
while(n--){
for(int i=0;i<N;i++)cin>>a[i];
for(int i=0;i<N;i++)cin>>b[i];
memset(dp,0,sizeof(dp));
dp[0][0][0]=1;
for(int i=0;i<(1<<N);i++){
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2187"
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
struct FastIO{
FastIO(){
cin.tie(0);
ios::sync_with_stdio(0);
}
}f... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
const int n = 9;
const int time = 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2;
int t;
int a[n], b[n];
cin >> t;
while (t--) {
int sum = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i];
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<stdio.h>
#include<algorithm>
int main()
{
int a,b,A[9],B[9],i,x,y,T;
double s;
for(scanf("%d",&T);T--;)
{
for(i=0;i<9;++i)scanf("%d",&A[i]);
for(i=0;i<9;++i)scanf("%d",&B[i]);
std::sort(B,B+9);
s=a=b=0;
do
{
for(i=x=y=0;i<9;++i)
if(A[i]>B[i])x+=A[i]+B[i];
else y+=A[i]+B[i];
if(x>y... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int t=0;t<T;t++) {
int[][] hand = new int[2][9];
for(int i=0;i<2;i++) {
for(int j=0;j<9;j++) {
hand[i][j] = sc.nextInt();
}
}
double[][][... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair
const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1,... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static int S, T;
static void f(int sum, int[] a, int[] b) {
if (a.length == 0) {
if (sum >= 0)
S++;
T++;
return;
}
int[] na = new int[a.length - ... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | import java.util.Scanner;
public class Main {
static int[] a;
static int[] b;
static boolean[] k;
static int z;
static void dfs(int x, int pa, int pb) {
if(x == 9) {
z += pb<pa?1:0;
return;
}
for(int i=0; i<9; i++) {
if(k[i]) continue;
k[i] = true;
dfs(x + 1, pa + (b[x]<a[i]?a[i]+b[x]:0), ... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int g[9],j[9];
int t,wg,wj,n;
cin >> t;
while(t--){
for(int i=0;i<9;i++)cin >> g[i];
for(int i=0;i<9;i++)cin >> j[i];
sort(g,g+9);
n = wg = wj = 0;
do{
n++;
int sg,sj;
sg = sj = 0;
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
int main(){
int t; cin >> t;
while(t-- > 0){
vector<int> a(9), b(9);
for(int i = 0; i < 9; i++) cin >> a[i];
for(int i = 0; i < 9; i++) cin >> b[i];
sort(b.begin(), b.end());
... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
const int n = 9;
const int time = 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2;
int t;
int a[n], b[n];
cin >> t;
while (t--) {
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i <... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define size_of(a) (int)(a).size()
#define allof(a) (a).begin(),(a).end()
void solve() {
vector< int > p1(9), p2(9);
for_(i,0,9) cin >> p1[i];
for_(i,0,9) cin >> p2[i];
sort(allof(p1));
sort(allof(p2));
int all = 0,... |
Problem: Gates and Jackie, the cats, came up with the rules for a card game played by two people. The rules are as follows.
First, shuffle the cards with the numbers 1 to 18 and deal 9 to each player. Both players issue one card at the same time and get a score based on the value. The player who issues the higher valu... | #include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int S;
int a[9], b[9];
scanf("%d", &S);
for(;S--;){
for(int x = 0; x < 9; x++){
scanf("%d", a+x);
}
sort(a, a+9);
for(int x = 0; x < 9; x++){
scanf("%d", b+x);
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.