Skip to content

Instantly share code, notes, and snippets.

View Acarus's full-sized avatar

Oleh Klishch Acarus

View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline bool can(vector<ll>& points, ll max_dist, int c) {
ll curr_dist = 0;
int cc = 1;
for (int i = 1; i < points.size(); ++i) {
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
return !b ? a : gcd(b, a % b);
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
@Acarus
Acarus / main.cc
Created March 18, 2017 18:24
A. Мишка и условие дружбы
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char **argv) {
ios::sync_with_stdio(false);
srand(time(0));
@Acarus
Acarus / main.cc
Created March 11, 2017 14:44
B. Максимизируй сумму цифр
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll GetNum(vector<int>& digits) {
while (!digits.empty() && digits[0] == 0) digits.erase(begin(digits));
ll ans = 0;
for (auto digit: digits) ans = ans * 10 + digit;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char **argv) {
// ios::sync_with_stdio(false);
srand(time(0));
@Acarus
Acarus / main.cc
Last active February 21, 2017 09:53
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll getAt(ll x, ll cl, ll cr, ll pos) {
if (x < 2) {
return x;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll getAt(ll x, ll cl, ll cr, ll pos) {
if (cl == cr && cl == pos) {
return x;
}
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
inline bool match(const string& s, string pattern) {
int i = 0;
@Override
public boolean interpret(String expression, String actorId) {
String[] checks = expression.split(AND);
for (String check : checks) {
String[] operands = check.split(COLON);
String scopeId = operands[0].trim();
String permissionName = operands[1].trim();
boolean value;
if (scopeId.equals(ANY)) {