Professional Documents
Culture Documents
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define int long long
int val[N];
int gen() {
int lmao = 0;
for(int i = 0; i < X; i++) {
int y = rand() % 5;
if(!y) lmao |= (1ll << i);
}
return lmao;
}
signed main() {
cin.tie(0), ios::sync_with_stdio(0);
srand(time(0));
cin >> no_of_soups;
for(int i = 1; i <= no_of_soups; i++)
val[i] = gen();
for(int i = 1; i <=no_of_soups; i++) {
int sz, y;
cin >> sz;
if(sz) {
int lmao = 0;
while(sz--) {
cin >> y;
lmao ^= val[y];
}
val[i] = lmao;
}
}
cin >> queries;
while(queries--) {
vector<int> vec;
int sz, y;
cin >> sz;
while(sz--) {
cin >> y;
vec.pb(val[y]);
}
cout << gauss(vec);
}
}
Aaron has a friend named Hardik who is very good at geometry. One day Aaron came across an
interesting problem on the topic of circles and shared it with Hardik. Next day Hardik also came up to
Aaron with a problem he just created. When our Aaron couldn't solve it thinking that it uses some
advanced geometry, Hardik took the pleasure saying that the solution of this problem uses exactly the
same concept which was used to solve the problem that they have discussed the day before. This came
as a shock to our Aaron and he became desperate to solve this problem, but even as he tried a lot, he
couldn't solve it. Hardik doesn't want to share his solution, so can you help our Aaron in solving the
problem?
Take a deep breath! You are going to draw a lot of circles.
#include <bits/stdc++.h>
struct Matrix {
int a, b, c;
int d, e, f;
int p, q, r;
};
return m3;
}
void print(Matrix m) {
cout << endl;
cout << m.a << " " << m.b << " " << m.c << endl;
cout << m.d << " " << m.e << " " << m.f << endl;
cout << m.p << " " << m.q << " " << m.r << endl;
while (e > 0) {
if(e % 2 != 0) {
p = multiply(p, b);
}
e = e / 2;
b = multiply(b, b);
}
return p;
}
if (n & 1) {
return multiply(multiply(m2, m2), m1);
} else {
return multiply(m2, m2);
}
}
int main() {
int t;
long long n;
int P, M, B;
n = (P * n) % M + B;
if (n <= 4) {
ans += r[n];
}
double a = 1 / r[4];
double b = 1 / r[3];
double c = 2 * (-1 / r[1] + 1 / r[2]);
ans += 1 / tmpp;
cout<<ans;
}
The world economy depends on oil, so only new methods for finding and extracting oil is still active.
Profits of oil companies depend in part on how efficiently they can drill for oil. The Petroleum
Consortium (PC) hopes that extensive computer simulations will make it easier to determine how to
drill oil wells in the best possible way.
Drilling oil wells is getting harder each day. The newly discovered oil deposits often do not form a
single body but are split into many parts. The PC is currently concerned with stratified deposits, as
illustrated in Figure 1.
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
main() {
int N;
while (cin >> N) {
vector<int> x1(N), x2(N), y(N);
for (int i = 0; i < N; i++) {
cin >> x1[i] >> x2[i] >> y[i];
if (x1[i] > x2[i]) swap(x1[i], x2[i]);
}
int ret = 0;
for (int i = 0; i < N; i++) {
vector<pair<int, pair<int, int> > > v;
int cur = 0;
for (int j = 0; j < N; j++) {
if (y[j] == y[i]) {
if (x1[i] >= x1[j] && x1[i] <= x2[j]) {
cur += x2[j]-x1[j];
}
} else if (y[j] < y[i]) {
v.push_back(make_pair(x2[j]-x1[j], make_pair(x1[i]-x2[j], y[i]-y[j])));
v.push_back(make_pair(x1[j]-x2[j], make_pair(x1[i]-x1[j], y[i]-y[j])));
} else {
v.push_back(make_pair(x2[j]-x1[j], make_pair(x1[j]-x1[i], y[j]-y[i])));
v.push_back(make_pair(x1[j]-x2[j], make_pair(x2[j]-x1[i], y[j]-y[i])));
}
}
sort(v.begin(), v.end(), slopecmp);
ret = max(ret, cur);
for (int j = 0; j < v.size(); j++) {
cur += v[j].first;
ret = max(ret, cur);
}
}
cout << ret << endl;
}
}