prompt string | response string |
|---|---|
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static int dough;
static int m;
static int cNode;
static int dNode;
static int a[];
static int b[];
static int c[];
static int d[];
static int dp[][][];
public static void main(String[] args... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
import java.util.*;
public class Buns {
static int m,a[],b[],c[],d[],dp[][];
public static int tugriks(int index,int left)
{
if(left==0 || index==m+1)return 0;
if(dp[index][left]!=-1)
return dp[index][left];
int ans=0;
for(int i=0;i<=a[index];i++)
{
if(a[index]>=i*b[index] && (lef... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
int i,j,k;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Strin... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Buns
{
public static int dough, stuffing, onlyDo, onCash;
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const int M = 12;
int a[M], b[M], c[M], d[M];
int dp[M][1009][109];
int m, n;
int main() {
scanf("%d%d%d%d", &n, &m, &c[0], &d[0]);
for (int i = 1; i <= m; i++) scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
for (int i = 0; i <= m; i++)
for (int dough = 0; dough <... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class Solution106C {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxn = 1005;
int n, m, c0, d0;
int a[15], b[15], c[15], d[15];
int DP[maxn][15][105];
int dp(int ba2e, int i, int kam) {
if (i == m || !ba2e) return 0;
int &ret = DP[ba2e][i][kam];
if (~ret) return ret;
ret = 0;
ret = max(ret, ... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int t[maxn];
int s[maxn];
int d[maxn];
int a[1000 + 10][10 + 5][100 + 5];
int n, m, s0, d0;
int main() {
cin >> n >> m >> s0 >> d0;
for (int i = 0; i < m; i++) {
int tmp1, tmp2;
cin >> tmp1 >> tmp2;
t[i] = tmp1 / tmp2;
cin >> s[i] >... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
struct bun {
int a, b, c, d;
bun(int ai, int bi, int ci, int di) : a(ai), b(bi), c(ci), d(di) {}
};
vector<bun> vec;
int m, c0, d0;
int dp[1010][15];
int solve(int n, int idx) {
if (idx == m) return 0;
int &ret = dp[n][idx];
if (ret != -1) return ret;
ret = 0;
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
template <typename Arg1>
void trace(const char* name, Arg1&& arg1) {
cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void trace(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(nam... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
inline int getx() {
char c;
int x;
for (c = getchar(); c < '0' || c > '9'; c = getchar())
;
for (x = 0; c >= '0' && c <= '9'; c = getchar())
x = (x << 3) + (x << 1) + c - '0';
return x;
}
bool upmax(int &a, const int &b) { return a < b ? a = b, 1 : 0; }
const int MAX_N = 10050... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int dough, m, c0, d0;
long long dp[1200][20];
int x[1200][3];
int stuffing[20];
long long solve(int rem, int indx) {
if (rem == 0 || indx == m) {
return 0;
}
if (indx >= m) {
return -999999999;
}
if (dp[rem][indx] != -1) {
return dp[rem][indx];
}
l... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.math.*;
import java.util.*;
import java.util.stream.IntStream;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
final int c0, d0;
int n, m, array[] = new int[1005];
n = scanner.nextInt();
m = scanner.nextInt();
c0 = scanner.nextInt();
d... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int dirx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int diry[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int N, M, ci, di;
vector<int> stulf_left, stuf, c, d;
int dp[1001][11];
int rec(int dou, int idx) {
if (dou <= 0) return 0;
if (idx >= M) {
if (dou <= 0)
return 0;
else
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
import java.util.*;
public class Solution{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
/**
* Author -
* User: kansal
* Date: 8/19/11
* Time: 8:37 PM
*/
public class Buns {
public static void main(String[] args) {
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int n, m, a[15], b[15], c[15], d[15];
int mem[15][1006];
int solve(int idx, int rem) {
if (idx > m || rem <= 0) return 0;
int &res = mem[idx][rem];
if (res != -1) return res;
res = 0;
for (int i = 0; !idx || i <= a[idx] / b[idx]; i++) {
if (rem >= c[idx] * i)
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
long long n, m, c0, d0;
vector<pair<pair<long long, long long>, long long>> v;
long long dp[1005][15];
long long solve(long long dough, long long current) {
if (dough < 0) return INT_MIN;
if (current == m) return 0;
long long &ans = dp[dough][current];
if (ans != -1... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
os << "[";
for (auto it : v) os << it << " ";
return os << "]";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, pair<K, V> v) {
return os << "(" << v.first << ", " << v.second... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int num[100], c[100], d[100];
int dp[100][maxn];
int N, M, a, b;
int main() {
while (scanf("%d%d%d%d", &N, &M, &c[0], &d[0]) != EOF) {
num[0] = 0x3f3f3f3f;
for (int i = 1; i <= M; i++) {
scanf("%d%d%d%d", &a, &b, &c[i], &d[i]);
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | from sys import stdin, setrecursionlimit
from collections import *
import threading
def arr_inp(n):
if n == 1:
return [int(x) for x in stdin.readline().split()]
elif n == 2:
return [float(x) for x in stdin.readline().split()]
else:
return list(stdin.readline()[:-1])
def dp(i, rem... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.math.*;
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n, m, a, b, c, d, array[] = new int[1101];
n = scanner.nextInt();
m = scanner.nextInt();
c = scanner.nextInt();
d = scanner.nextInt();
for(int i = c; i <=... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, c0, d0;
cin >> n >> m >> c0 >> d0;
vector<long long int> dp(n + 1, 0);
long long int ans = 0;
for (int i = 0; i <= n; i++) dp[i] = (i / c0) * d0;
for (int k ... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int memo[110][110][1010];
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;
int m, c0, d0;
int dp(int i, int ai, int n) {
if (i > m or ai < 0 or n < 0) return -777;
if (memo[i][ai][n] != -777) {
return memo[i][ai][n];
}
int res1 = 0;
int res2 = dp(i,... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1005;
struct Node {
int a, b, c, d;
} p[N];
int f[15][1500];
int main() {
int n, m, c0, d0;
scanf("%d%d%d%d", &n, &m, &c0, &d0);
for (int i = 1; i <= m; ++i)
scanf("%d%d%d%d", &p[i].a, &p[i].b, &p[i].c, &p[i].d);
for (int i = 1; i <= m; ++i)
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7, M = 5e1 + 1, OO = 0x3f3f3f3f, MOD = 1e9 + 7;
int n, m, c0, d0, dp[N][11];
int a[N], b[N], c[N], d[N];
int main() {
cin >> n >> m >> c[0] >> d[0];
for (int i = 1; i <= m; ++i) {
cin >> a[i] >> b[i] >> c[i] >> d[i];
}
for (int i = 0; i <= n;... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, c[12], d[12], a[12], b[12], num[12], dp[1002];
while (cin >> n >> m >> c[0] >> d[0]) {
memset(dp, 0, sizeof(dp));
num[0] = n / c[0];
for (int i = 1; i <= m; i++) {
cin >> a[i] >> b[i] >> c[i] >> d[i];
num[i] = a[i] / b[i];
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #!/usr/bin/env python
"""(c) gorlum0 [at] gmail.com"""
import itertools as it
from sys import stdin
for line in stdin:
n, m, c0, d0 = map(int, line.split())
xss = [map(int, next(stdin).split()) for _ in xrange(m)]
xss.insert(0, [0]*4)
a, b, c, d = zip(*xss)
## print a, b, c, d
dp = [[... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | n, m, c, d = map(int, input().split())
arr = [0]*1010
for i in range(c, n+1):
arr[i] = arr[i-c] + d
for l in range(m):
a, b, c, d = map(int, input().split())
for i in range(0, a//b):
j=n
while j >= c:
arr[j] = max(arr[j], arr[j-c] + d)
j -= 1
print(arr[n]) |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
bool comp(pair<double, long long> a, pair<double, long long> b) {
return a.first > b.first;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long i, j;
long long ans = 0;
long long n, m;
long long inf = 10e9;
cin >> ... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.util.*;
import java.io.*;
public class Buns
{
/************************ SOLUTION STARTS HERE ***********************/
static int[] weight , value;
static int memo[][];
static int knapsack(int idx , int dough) {
if(idx < 0)
return 0;
else if(memo[idx][dough] != -1)
return memo[idx][dough];
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.util.*;
import java.io.*;
public class Bulki {
public static int knapsack(int costs[], int weights[], int quants[], int need) {
int n = costs.length;
int f[][] = new int[need + 1][n];
for (int j = 1; j < n; ++j) {
for (int w = 0; w <= need; ++w) {
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import sys
from sys import stdin, stdout
def R():
return map(int, stdin.readline().strip().split())
n, m, c, d = R()
arr1 = []
for i in range(n//c):
arr1.append((c, d))
for i in range(m):
a, b, c, d = R()
for j in range(min(a//b, n//c)):
arr1.append((c, d))
dp = [[0 for i in range(n+1)] for... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long n, i, j, k, x, y, z, m, c0, d0, xyz;
cin >> n >> m >> c0 >> d0;
long long dp[n + 1][m + 1];
long long a[m + 1];
long long b[m + 1];
long long c[m + 1];
long long d[m + 1];
for (i = 1; i <= m; i++) {
cin >> a[i] >> b[i] >> c[i] >>... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | // 作者:杨成瑞先生
import java.io.*;
import java.util.*;
public class cf106c {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokeniz... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import sys
input=sys.stdin.readline
n,m,c0,d0=map(int,input().split())
maxi=(n//c0)*d0
dp=[[0 for i in range(n+1)] for j in range(m+1)]
i=1
while i*c0<=n:
dp[0][i*c0]=i*d0
i+=1
for i in range(1,m+1):
a,b,c,d=map(int,input().split())
for j in range(n+1):
k=0
while k*c+j<=n and b*k<=a:
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
vector<long long int> dough_req, stuffing_req, profit, stuffing_ava;
long long int dp[15][1005][105];
int n, m, c0, d0;
long long int get_max_profit(int idx, int dough_left, int stuffing, int prof) {
if (dough_left < 0 || stuffing > stuffing_ava[idx]) return -INT_MAX;
i... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... |
import java.util.Arrays;
import java.util.Scanner;
public class C {
static int m;
static int c0, d0;
static int[][] DP;
static int[] A;
static int[] B;
static int[] C;
static int[] D;
public static int get(int n, int index) {
if (index == m) {
return (n / c0) * d0... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int dp[11][1001], a[11], b[11], c[11], d[11], n, m;
int main() {
a[0] = 100000, b[0] = 0;
scanf("%d %d %d %d", &n, &m, &c[0], &d[0]);
for (int i = 1; i <= m; i++) scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
for (int i = 0; i <= m; i++) dp[i][0] = 0;
for (int... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T, U>& val) {
return out << "(" << val.first << ", " << val.second << ")";
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& val) {
out << "{";
for (int i = 0; i < (((... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
const int long long N = 10e8 + 7;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m, c0, d0;
cin >> n >> m >> c0 >> d0;
int a[15], b[15], c[15], d[15];
for (int i = 1; i < m + 1; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
int dp... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | //package round82;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class C {
Scanner in;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int m = ni();
int c0 = ni();
int d0 = ni();
int[][] data = new int[m][4];
for(int i = 0;i < m;i++){
for(i... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.util.*;
import java.io.*;
public class A
{
public static void main(String ar[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s1[]=br.readLine().split(" ");
int n=Integer.parseInt(s1[0]);
int m=In... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, c0, d0;
scanf("%d %d %d %d", &n, &m, &c0, &d0);
int a, b, c, d;
vector<int> C(1), D(1);
for (int i = 1; i <= m; ++i) {
scanf(" %d %d %d %d", &a, &b, &c, &d);
int x = a / b, y = 1;
while (x) {
y = min(x, y);
C.push_bac... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... |
import java.io.*;
import java.util.*;
public class Main {
void solve() throws IOException {
int nn = nextInt();
int m = nextInt();
int c0 = nextInt();
int d0 = nextInt();
List<Integer> cost = new ArrayList<Integer>();
List<Integer> w = new ArrayList<Integer>();
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | n,m,c0,d0=map(int,input().split(" "))
a,b,c,d=[0],[0],[0],[0]
for i in range(m):
x,y,z,e=map(int,input().split(" "))
a.append(x)
b.append(y)
c.append(z)
d.append(e)
dp=[[0 for i in range(m+1)] for j in range(n+1)]
for i in range(n+1):
for j in range(1,m+1):
mx=0
for k in range... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e8;
long long mem[10][1005];
int n, m, c, d, arr[15], brr[15], crr[15], drr[15];
long long dp(int i, int rem) {
if (i > m || rem <= 0) return 0;
if (i == m) return (rem / c) * d;
long long &ret = mem[i][rem];
if (~ret) return ret;
ret = dp(i... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.util.*;
public class Main {
private static int m;
private static Quad[] req;
private static int[][] dp;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int total = in.nextInt();
m = in.nextInt();
int c0 = in.nextInt();
int d0 = in.nextInt();
req = new Quad[m... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
int input() {
int res = 0;
char c = ' ';
while (c < '0') c = getchar();
while (c >= '0') res = res * 10 + (c - '0'), c = getchar();
return res;
}
const int N = 1001, M = 11;
int f[N][M], a[M], b[M], c[M], d[M];
int main() {
int n = input(), m = input(), c0 = inp... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Main {
private static class Vipechka {
int remains_a;
int need_b;
int testo_c;
int cost_d;
public V... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | // https://codeforces.com/contest/106/problem/C
import java.util.*;
public class Main {
public static void main(String[] args) {
// read input
Scanner sc = new Scanner(System.in);
int totalDough = sc.nextInt();
int totalBuns = sc.nextInt();
int doughPerPlainBun = sc.nextInt();
int pricePerP... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author Haya
*/
public class Buns {
static int n;
static int m;
static int stuff[][] = new int[15][3];
static int dp[][] = new int[15][1005];
public... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
int num[12], c[12], d[12];
int dp[12][1010];
int main() {
int n, m, c0, d0;
scanf("%d%d%d%d", &n, &m, &c0, &d0);
num[0] = 1005;
c[0] = c0;
d[0] = d0;
int i, j, k, a, b;
for (i = 1; i <= m; i++) {
scanf("%d%d", &a, &b);
num[i] = a / b;
scanf("%d%d", &c[i], &d[i]);
}
... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Locale;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Map.Entry;
publ... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilte... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
vector<long long int> a(1005), b(1005), c(1005), d(1005);
vector<vector<long long int>> dp(1005, vector<long long int>(15));
int main() {
long long int n, m, c0, d0;
cin >> n >> m >> c0 >> d0;
for (long long int i = 1; i <= m; i++) {
cin >> a[i] >> b[i] >> c[i] >>... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | //package albert.codeforces.buns106c;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int c0 = sc.nextInt();
int d0 = sc.nextInt();
int[][] in... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) ... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | import java.io.*;
public class Buns {
static BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static class Stuffing{
int max_num;
int need_... |
Problem: Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams ... | #include <bits/stdc++.h>
using namespace std;
long long krit, w[2001], p[2001], dp[2001][1001], am = 0, a, b, c, d, m;
int main() {
scanf("%ld %ld %ld %ld", &krit, &m, &c, &d);
for (int i = 1; i <= krit / c; i++) {
am++;
p[am] = d;
w[am] = c;
}
for (int i = 0; i < m; i++) {
scanf("%ld %ld %ld %l... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
set<int> s;
vector<int> v;
vector<int> v1;
int main() {
ios::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
int n;
cin >> n;
int o_x = -100000000, o_y = -100000000;
int c_x = 100000000, c_y = 100000000;
for (int i = 0; i < n; i++) {
int x, y;
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
im... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
long long n;
pair<int, int> p[1005], s[1005], vas;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cerr.tie(0);
cin >> n;
int a, b;
for (int(i) = (0); ((i)) < ((n)); ((i))++) {
cin >> a >> b;
p[i] = {a, b};... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void IN(vector<int> &v, int n, int x) {
for (int i = x; i < n + x; i++) cin >> v[i];
}
void P(int x) { cout << x << endl; }
void PP(long long a, long long b) { cout << a << " " << b << endl; }
void PV(vector<int> v) {
int n = (v).size();
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n = int(input().strip())
xm,ym = (0,0)
for i in range(2*n):
x,y = list(map(int,input().strip().split()))
xm+=x
ym+=y
print(xm//(n), ym//(n)) |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n=int(input())
x=[]
y=[]
for i in range(2*n):
a=input().split()
a=list(map(int,a))
x.append(a[0])
y.append(a[1])
print(int((sum(x))/n),int((sum(y))/n)) |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.io.*;
import java.util.*;
import java.util.Stack;
import java.util.Vector;
import java.util.Arrays;
import javafx.util.Pair;
import java.math.BigInteger;
public class Codechef
{
static void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import sys
import math
def solve(n):
x,y=[],[]
for i in range(n):
q,w=map(int,input().split())
x.append(q)
y.append(w)
a,b=[],[]
for i in range(n):
q,w=map(int,input().split())
a.append(q)
b.append(w)
ans=[(max(x)+min(a)),(max(y)+min(b))]
for i in... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n = int( input() )
o = [ list(map(int,input().split())) for i in range( n ) ]
p = [ list(map(int,input().split())) for i in range( n ) ]
x = sum([i[0] for i in o]) + sum([i[0] for i in p])
x = x // n
y = sum([i[1] for i in o]) + sum([i[1] for i in p])
y = y // n
print( x,y )
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #!python3
n = int(input().strip())
sum_x, sum_y = 0,0
for i in range(2*n):
xa, xb = [int(i) for i in input().strip().split(' ')]
sum_x += xa
sum_y += xb
print(sum_x//n, sum_y//n)
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n = int(input())
x = []
y = []
for i in range(n):
a, b = map(int, input().split())
x.append(a)
y.append(b)
a = []
b = []
for i in range(n):
c, d = map(int, input().split())
a.append(c)
b.append(d)
f = True
z = 0
while f:
tx, ty = x[0] + a[z], y[0] + b[z]
s = set([(tx - a[i], ty - b[i]) f... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
i... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n=int(input())
sum1=0
sum2=0
for item in range(n):
a,b=[int(x) for x in input().split()]
sum1+=a
sum2+=b
for item in range(n):
a,b=[int(x) for x in input().split()]
sum1+=a
sum2+=b
print(sum1//n,sum2//n)
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.util.* ;
import java.io.* ;
public class TreasureGeolocation
{
public static void main(String args[]) throws Exception
{
BufferedReader bro = new BufferedReader(new InputStreamReader(System.in)) ;
int n = Integer.parseInt(bro.readLine()) ;
int[][] obel = new int[1000][2] ;
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c = 0, d = 0;
int T;
cin >> T;
for (int i = 0; i < 2 * T; i++) {
cin >> a >> b;
c += a;
d += b;
}
cout << c / T << ' ' << d / T;
return 0;
}
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
public class TreasureGeolocation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintStream out = System.out;
solve(in, out);
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
struct node {
int x, y;
} a[100005], b[100005];
int t, n, m, k, q, ans;
bool vis[100005];
void dfs(int c, int x, int y) {
if (c > n) {
ans = 1;
return;
}
for (int i = 1; i <= n; i++) {
if (a[c].x + b[i].x == x && a[c].y + b[i].y == y && !vis[i]) {
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, x, y;
pair<long long, long long> po, po2;
map<pair<long long, long long>, int> p, c;
cin >> n;
for (k = 0; k < n; k++) {
cin >> po.first >> po.second;
p[po] += 1;
}
for (k = 0; k < n; k++) {
cin >> po.first >> po.second;
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.util.*;
import java.lang.*;
import java.io.*;
public class decode{
public static void main(String[] args) throws IOException{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
HashMap<String, Integer> map = new HashMap<String, Integer>();
int n = Integer.... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #------------------------------what is this I don't know....just makes my mess faster--------------------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer =... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | if __name__ == '__main__':
n = int(input())
x, y = 0, 0
for i in range(n * 2):
nx, ny = map(int, input().strip().split(' '))
x += nx
y += ny
print(x // n, y // n)
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
struct point : pair<int, int> {
point() { cin >> first >> second; }
};
struct sum : pair<long long, long long> {
sum(long long a = 0, long long b = 0) { first = a, second = b; }
friend sum operator+(const sum& a, const point& p) {
return sum(a.first + p.first, a.s... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | N = int(input())
X = 0
Y = 0
for i in range(2*N):
tmp = [ int(i) for i in input().split()]
X+= tmp[0]
Y+= tmp[1]
print(int(X/N), int(Y/N)) |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | n = int(input())
x, y = 0, 0
for _ in range(2 * n):
a, b = map(int, input().split())
x += a
y += b
print(x // n, y // n)
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... |
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.PriorityQueue;
//import java.util.*;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.math.*;
/**
* Built using CHelper plug-in
* Actual solution is ... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import math
import os
import random
import re
import sys
if __name__ == '__main__':
n = int(input())
X = 0
Y = 0
for i in range(2*n):
start = list(map(int, input().rstrip().split()))
X += start[0]
Y += start[1]
x = int(X/(n+0.0))
y = int(Y/(n+0.0))
print(x,y) |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import javafx.util.Pair;
import java.util.*;
public class assd {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
HashSet<Pair<Integer,Integer>> T=new HashSet<>();
Pair<Integer,Integer> maxp= new Pair<>(0,0);
int max=0;
... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
long n = Long.parseLong(st.nextToken());... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
FastScanner in;
PrintWriter out;
void run() {
in = new FastScanner();
out = new PrintWriter(System.out);
problem();
out.close();
}
class FastScanner {
BufferedReader ... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Point arr[] = new Point[n];
Point arr1[]= new Point[n];
List<Point>[] list = new ArrayList[n];
for(int i = 0; i... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | from os import path
import sys,time
# mod = int(1e9 + 7)
# import re
from math import ceil, floor,gcd,log,log2 ,factorial
from collections import defaultdict ,Counter , OrderedDict , deque
from itertools import combinations , groupby , zip_longest,permutations
# from string import ascii_lowercase ,ascii_uppercase
from ... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
long long x[1005];
long long y[1005];
long long a[1005];
long long b[1005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
long long ax = 0, ay = 0;
for (long long i = 0; i < n; i++) {
cin >> x[i] >> y[i];
ax += x... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
void fast() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
fast();
long long n;
cin >> n;
vector<long long> x(n), y(n), pa(n), push_back(n);
for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
for (int i = 0; i < n; ++i) cin... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | N = int(input())
p, q = 0, 0
for i in range(N * 2):
x, y = map(int, input().split())
p += x
q += y
print(p // N, q // N)
|
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 100;
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 12;
vector<long long> arr(MAX);
map<long long, long long> mm;
int main() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cout.tie(NULL);
;
long long tt = 1;
while (t... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | #include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a, C b) {
a = min(a, b);
}
template <class C>
void maxi(C& a, C b) {
a = max(a, b);
}
void a() {
int y, r, b;
cin >> y >> b >> r;
b--;
r--;
r--;
int res = min(y, r);
mini(res, b);
res *= 3;
res += 3;
cout << res << '\n... |
Problem: Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at n obelisks. These clues were in an ancient language, and he has only decrypted th... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
long x=0;
long y=0;
for(int i=0;i<t;i++) {
x+=sc.nextLong();
y+=sc.nextLong();
}
for(int i=0;i<t;i++) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.