Add a bunch of other problems.
Some are not finished...
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/A */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n, w;
|
||||
cin >> n >> w;
|
||||
|
||||
rep(i, n) {
|
||||
cout << w - i << ' ' << 500 << '\n';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/F */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int parent[(ll)2e6 + 1][21];
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
ll n, c;
|
||||
cin >> n >> c;
|
||||
|
||||
vl fds(n);
|
||||
cin >> fds;
|
||||
rep(i, n) {
|
||||
fds.push_back(fds[i]);
|
||||
}
|
||||
|
||||
vl pref(n * 2 + 1);
|
||||
rep(i, n * 2) {
|
||||
pref[i + 1] = pref[i] + fds[i];
|
||||
}
|
||||
|
||||
vvi graph(n * 2 + 1);
|
||||
rep(i, n * 2) {
|
||||
int ans = -1;
|
||||
int low = i;
|
||||
int high = min((int)i + n - 1, n * 2 - 1);
|
||||
|
||||
while (low <= high) {
|
||||
int mid = (low + high) / 2;
|
||||
|
||||
if (pref[mid + 1] - pref[i] >= c) {
|
||||
ans = mid + 1;
|
||||
high = mid - 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
low = mid + 1;
|
||||
}
|
||||
|
||||
if (ans != -1) {
|
||||
graph[ans].push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
int inf = INT32_MAX >> 1;
|
||||
rep(i, n * 2 + 1) {
|
||||
rep(j, 21) {
|
||||
parent[i][j] = inf;
|
||||
}
|
||||
}
|
||||
// vvi parent(n * 2 + 1, vi(21, inf));
|
||||
V<bool> vis(n * 2 + 1, false);
|
||||
|
||||
function<void(int, int)> dfs = [&](int i, int p){
|
||||
parent[i][0] = p;
|
||||
vis[i] = true;
|
||||
|
||||
for (int j = 1; j <= 20 && parent[i][j - 1] != inf; j++) {
|
||||
parent[i][j] = parent[parent[i][j - 1]][j - 1];
|
||||
}
|
||||
|
||||
for (auto j : graph[i]) {
|
||||
dfs(j, i);
|
||||
}
|
||||
};
|
||||
|
||||
for (int i = n * 2; i >= 0; i--) {
|
||||
if (!vis[i]) {
|
||||
dfs(i, inf);
|
||||
}
|
||||
}
|
||||
|
||||
rep(i, n) {
|
||||
int now = i;
|
||||
int ans = 0;
|
||||
for (int j = 20; j >= 0; j--) {
|
||||
if (parent[now][j] < i + n) {
|
||||
ans += (1 << j);
|
||||
now = parent[now][j];
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << ' ';
|
||||
}
|
||||
cout << '\n';
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/K */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n, m;
|
||||
cin >> n >> m;
|
||||
|
||||
vi dec;
|
||||
vi cres;
|
||||
rep(i, m) {
|
||||
int a, b;
|
||||
cin >> a >> b;
|
||||
|
||||
if (a > b) {
|
||||
dec.push_back(i + 1);
|
||||
} else {
|
||||
cres.push_back(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
cout << "YES\n";
|
||||
if (dec.size() > cres.size()) {
|
||||
cout << dec.size() << '\n';
|
||||
for (auto i : dec) {
|
||||
cout << i << ' ';
|
||||
}
|
||||
cout << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
cout << cres.size() << '\n';
|
||||
for (auto i : cres) {
|
||||
cout << i << ' ';
|
||||
}
|
||||
cout << '\n';
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/L */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
ll h1, d1, t1;
|
||||
cin >> h1 >> d1 >> t1;
|
||||
ll h2, d2, t2;
|
||||
cin >> h2 >> d2 >> t2;
|
||||
|
||||
h1 -= d2;
|
||||
h2 -= d1;
|
||||
|
||||
if (h1 < 0 && h2 < 0) {
|
||||
cout << "draw\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (h1 < 0) {
|
||||
cout << "player two\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (h2 < 0) {
|
||||
cout << "player one\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
ll killt1 = (h1 / d2 + min(1LL, h1 % d2)) * t2;
|
||||
ll killt2 = (h2 / d1 + min(1LL, h2 % d1)) * t1;
|
||||
|
||||
if (killt1 == killt2) {
|
||||
cout << "draw\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (killt1 > killt2) {
|
||||
cout << "player one\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (killt2 > killt1) {
|
||||
cout << "player two\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/M */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int a, b, c;
|
||||
cin >> a >> b >> c;
|
||||
|
||||
int squares = 2 * a;
|
||||
|
||||
int ret = 0;
|
||||
if (c > 1 && b >= 1) {
|
||||
c -= 2;
|
||||
ret += 2 + b * 2;
|
||||
ret++;
|
||||
}
|
||||
|
||||
ret += 3 * (c / 2);
|
||||
cout << squares + ret << '\n';
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/* Problem URL: https://codeforces.com/gym/104785/problem/N */
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define V vector
|
||||
|
||||
#define rmin(a, b) a = min(a, b)
|
||||
#define rmax(a, b) a = max(a, b)
|
||||
|
||||
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||
|
||||
#define repv(i, v) for (auto &i : (v))
|
||||
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||
#define sortv(v) sort(v.begin(), v.end())
|
||||
#define all(v) (v).begin(), (v).end()
|
||||
|
||||
using vi = vector<int>;
|
||||
using vvi = vector<vi>;
|
||||
using vvvi = vector<vvi>;
|
||||
using vvvvi = vector<vvvi>;
|
||||
|
||||
using ll = long long;
|
||||
|
||||
using vl = vector<ll>;
|
||||
using vvl = vector<vl>;
|
||||
using vvvl = vector<vvl>;
|
||||
using vvvvl = vector<vvvl>;
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||
os << vec[0];
|
||||
for (size_t i = 1; i < vec.size(); i++) {
|
||||
os << ' ' << vec[i];
|
||||
}
|
||||
os << '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
is >> i;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||
for (auto &i : vec) {
|
||||
os << i[0];
|
||||
for (size_t j = 1; j < i.size(); j++) {
|
||||
os << ' ' << i[j];
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class v>
|
||||
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||
for (auto &i : vec) {
|
||||
for (auto &j : i) {
|
||||
is >> j;
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n;
|
||||
cin >> n;
|
||||
|
||||
map<string, string> var;
|
||||
var["0.75"] = "standard";
|
||||
var["15"] = "nebuchadnezzar";
|
||||
var["12"] = "balthazar";
|
||||
|
||||
string now = "a";
|
||||
|
||||
while (n--) {
|
||||
string a;
|
||||
cin >> a;
|
||||
|
||||
size_t i = 0;
|
||||
string b;
|
||||
while (a[i] != 'L' && a[i] == '0') {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (a[i] == 'L') {
|
||||
b = "0";
|
||||
} else {
|
||||
while (a[i] != '.' && a[i] != 'L') {
|
||||
b.push_back(a[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (a[i] != 'L') {
|
||||
i++;
|
||||
string tmp;
|
||||
while (a[i] != 'L') {
|
||||
while (a[i] == '0') {
|
||||
tmp.push_back(a[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (a[i] != 'L') {
|
||||
b += tmp;
|
||||
b += a[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto itr = var.find(b);
|
||||
if (itr == var.end()) {
|
||||
var[b] = now;
|
||||
now += 'a';
|
||||
}
|
||||
|
||||
cout << var[b] << '\n';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user