Initial commit
This commit is contained in:
87
2019/republic/11_d1/bare.cpp
Normal file
87
2019/republic/11_d1/bare.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
int getMinRest(int L, int lengths[], int K) {
|
||||
for (int i = 0; i < K; i++) {
|
||||
if (L % lengths[i] == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sort(lengths, lengths + K);
|
||||
for (int i = 1; i < K; i++) {
|
||||
if (lengths[i] - lengths[i - 1] == 1 && lengths[i] * lengths[i - 1] < L) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (K < 2) {
|
||||
return L % lengths[0];
|
||||
}
|
||||
|
||||
|
||||
set<int> processed_lengths;
|
||||
set<int> new_lengths;
|
||||
unordered_map<int, bool> detected_lengths;
|
||||
|
||||
for (int i = 0; i < K; i++) {
|
||||
processed_lengths.insert(lengths[i]);
|
||||
new_lengths.insert(lengths[i]);
|
||||
detected_lengths[lengths[i]] = true;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
// cout << "Processed: " << processed_lengths.size() << "; New: " << new_lengths.size() << endl;
|
||||
set<int> found_lengths;
|
||||
|
||||
for (auto i: processed_lengths) {
|
||||
for (auto j: new_lengths) {
|
||||
int new_len = i + j;
|
||||
if (new_len <= L && detected_lengths[new_len] == false) {
|
||||
found_lengths.insert(new_len);
|
||||
detected_lengths[new_len] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processed_lengths.insert(new_lengths.begin(), new_lengths.end());
|
||||
if (found_lengths.size() == 0) {
|
||||
break;
|
||||
}
|
||||
new_lengths = found_lengths;
|
||||
}
|
||||
|
||||
auto m = processed_lengths.end();
|
||||
m--;
|
||||
return L - *m;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
|
||||
int L, K;
|
||||
input_stream >> L;
|
||||
input_stream >> K;
|
||||
|
||||
int lengths[K];
|
||||
for (int i = 0; i < K; i++) {
|
||||
input_stream >> lengths[i];
|
||||
}
|
||||
|
||||
cout << getMinRest(L, lengths, K) << endl;
|
||||
|
||||
input_stream.close();
|
||||
return 0;
|
||||
}
|
||||
BIN
2019/republic/11_d1/condition.pdf
Normal file
BIN
2019/republic/11_d1/condition.pdf
Normal file
Binary file not shown.
111
2019/republic/11_d1/sobol.cpp
Normal file
111
2019/republic/11_d1/sobol.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
struct Node {
|
||||
public:
|
||||
uint32_t number;
|
||||
Node *left, *right;
|
||||
|
||||
Node(uint32_t n):number(n) {
|
||||
}
|
||||
|
||||
Node(): number(0) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool locateLeftmostNode (Node *node, uint32_t level, uint32_t targetLevel) {
|
||||
if (level == targetLevel) {
|
||||
cout << node -> number << " ";
|
||||
return 1;
|
||||
} else {
|
||||
// Search left. If unsuccessfull, search through right
|
||||
if (node -> left != nullptr) {
|
||||
if (locateLeftmostNode(node -> left, level + 1, targetLevel)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Search right. If unsuccessful, this should return 0
|
||||
if (node -> right != nullptr) {
|
||||
return locateLeftmostNode(node -> right, level + 1, targetLevel);
|
||||
}
|
||||
|
||||
// Previous searches didn't return anything, meaning node has no children. Return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool locateRightmostNode (Node *node, uint32_t level, uint32_t targetLevel) {
|
||||
if (level == targetLevel) {
|
||||
cout << node -> number << endl;
|
||||
return 1;
|
||||
} else {
|
||||
// Search right. If unsuccessfull, search through left
|
||||
if (node -> right != nullptr) {
|
||||
if (locateRightmostNode(node -> right, level + 1, targetLevel)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Search left. If unsuccessful, this should return 0
|
||||
if (node -> left != nullptr) {
|
||||
return locateRightmostNode(node -> left, level + 1, targetLevel);
|
||||
}
|
||||
|
||||
// Previous searches didn't return anything, meaning node has no children. Return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
|
||||
uint32_t N;
|
||||
uint16_t K;
|
||||
input_stream >> N;
|
||||
input_stream >> K;
|
||||
|
||||
unordered_map<uint32_t, Node*> orphanNodes;
|
||||
Node *nodes[N];
|
||||
|
||||
for (uint32_t i = 0; i < N; i++) {
|
||||
nodes[i] = new Node(i + 1);
|
||||
orphanNodes[i + 1] = nodes[i];
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < (N - 1); i++) {
|
||||
uint32_t parentId, childId;
|
||||
char direction;
|
||||
|
||||
input_stream >> parentId;
|
||||
input_stream >> childId;
|
||||
input_stream >> direction;
|
||||
|
||||
// Remove orphan mark from child
|
||||
orphanNodes.erase(childId);
|
||||
|
||||
// Assign child to parent
|
||||
if(direction == 'S') {
|
||||
nodes[parentId - 1] -> left = nodes[childId - 1];
|
||||
} else {
|
||||
nodes[parentId - 1] -> right = nodes[childId - 1];
|
||||
}
|
||||
}
|
||||
|
||||
Node *rootNode = orphanNodes.begin() -> second;
|
||||
locateLeftmostNode(rootNode, 0, K);
|
||||
locateRightmostNode(rootNode, 0, K);
|
||||
|
||||
input_stream.close();
|
||||
return 0;
|
||||
}
|
||||
60
2019/republic/11_d1/unsolved_arena.cpp
Normal file
60
2019/republic/11_d1/unsolved_arena.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
ifstream input_stream;
|
||||
|
||||
|
||||
struct Point
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
Point(double i, double j): x(i), y(j) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
double getDistance(Point *p1, Point *p2) {
|
||||
double x_distance = abs(p1 -> x - p2 -> x);
|
||||
double y_distance = abs(p1 -> y - p2 -> y);
|
||||
return pow(x_distance, 2) + pow(y_distance, 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint16_t findSides(Point *points[3]) {
|
||||
double d1 = getDistance(points[0], points[1]);
|
||||
double d2 = getDistance(points[0], points[2]);
|
||||
double d3 = getDistance(points[1], points[2]);
|
||||
|
||||
if (d1 == d2 && d1 == d3) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
|
||||
Point *points[3];
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
double tmp_x, tmp_y;
|
||||
input_stream >> tmp_x;
|
||||
input_stream >> tmp_y;
|
||||
|
||||
points[i] = new Point(tmp_x, tmp_y);
|
||||
}
|
||||
|
||||
cout << findSides(points) << endl;
|
||||
|
||||
input_stream.close();
|
||||
return 0;
|
||||
}
|
||||
58
2019/republic/11_d2/bacterii.cpp
Normal file
58
2019/republic/11_d2/bacterii.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <deque>
|
||||
#include <numeric>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
uint64_t dequeSum(deque<uint64_t> &d) {
|
||||
return accumulate(d.begin(), d.end(), 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
uint16_t P, T, N;
|
||||
input_stream >> P;
|
||||
input_stream >> T;
|
||||
input_stream >> N;
|
||||
|
||||
deque<uint64_t> bacteria;
|
||||
bacteria.push_front(P);
|
||||
|
||||
uint16_t i;
|
||||
uint64_t mature = 0;
|
||||
|
||||
// Populate list until death of first generation
|
||||
for (i=1; i < T && i <= N; i++) {
|
||||
// Reproduction
|
||||
bacteria.push_front(mature);
|
||||
|
||||
// Maturity
|
||||
mature += bacteria[1];
|
||||
}
|
||||
|
||||
// Run loop considering death until experiment is complete
|
||||
for(i; i <= N; i++) {
|
||||
// Reproduction
|
||||
bacteria.push_front(mature);
|
||||
|
||||
// Death
|
||||
mature -= bacteria.back();
|
||||
bacteria.pop_back();
|
||||
|
||||
// Maturity
|
||||
mature += bacteria[1];
|
||||
}
|
||||
|
||||
output_stream << dequeSum(bacteria) << endl;
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
BIN
2019/republic/11_d2/condition.pdf
Normal file
BIN
2019/republic/11_d2/condition.pdf
Normal file
Binary file not shown.
152
2019/republic/11_d2/experimente.cpp
Normal file
152
2019/republic/11_d2/experimente.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
int matchCode(string code1, string code2) {
|
||||
int match = 0;
|
||||
const int lim = min(code1.length(), code2.length());
|
||||
for (int i = 0; i < lim; i++) {
|
||||
if (code1[i] == code2[i]) {
|
||||
match++;
|
||||
}
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
void task1() {
|
||||
uint16_t n;
|
||||
input_stream >> n;
|
||||
|
||||
uint16_t m;
|
||||
input_stream >> m;
|
||||
|
||||
uint16_t G;
|
||||
input_stream >> G;
|
||||
|
||||
string monea_code;
|
||||
input_stream >> monea_code;
|
||||
|
||||
int16_t best_match = -1;
|
||||
vector<string> matches;
|
||||
matches.reserve(m * n);
|
||||
|
||||
for (uint16_t y = 0; y < n; y++) {
|
||||
for (uint16_t x = 0; x < m; x++) {
|
||||
string cat_code;
|
||||
input_stream >> cat_code;
|
||||
|
||||
uint8_t match = matchCode(monea_code, cat_code);
|
||||
|
||||
if (match > best_match && match > G) {
|
||||
best_match = match;
|
||||
matches.clear();
|
||||
matches.push_back(to_string(y + 1) + " " + to_string(x + 1) + " " + cat_code);
|
||||
} else if (match == best_match) {
|
||||
matches.push_back(to_string(y + 1) + " " + to_string(x + 1) + " " + cat_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_match > 0) {
|
||||
output_stream << best_match << endl;
|
||||
for (auto i = matches.begin(); i != matches.end(); i++) {
|
||||
output_stream << *i << endl;
|
||||
}
|
||||
} else {
|
||||
output_stream << "MONEA NU ARE RUDE" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void task2() {
|
||||
uint16_t n;
|
||||
input_stream >> n;
|
||||
|
||||
uint16_t m;
|
||||
input_stream >> m;
|
||||
|
||||
uint16_t G;
|
||||
input_stream >> G;
|
||||
|
||||
string monea_code;
|
||||
input_stream >> monea_code;
|
||||
|
||||
bool town[n][m] = {};
|
||||
|
||||
for (uint16_t y = 0; y < n; y++) {
|
||||
for (uint16_t x = 0; x < m; x++) {
|
||||
string cat_code;
|
||||
input_stream >> cat_code;
|
||||
|
||||
if (matchCode(monea_code, cat_code) > G) {
|
||||
town[y][x] = true;
|
||||
} else {
|
||||
town[y][x] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t sum[n][m] = {};
|
||||
uint16_t max_of_s, max_i, max_j = 0;
|
||||
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
sum[i][m - 1] = town[i][m - 1];
|
||||
}
|
||||
|
||||
for (uint16_t j = 0; j < m; j++) {
|
||||
sum[n - 1][j] = town[n - 1][j];
|
||||
}
|
||||
|
||||
for (int16_t i = n-2; i >= 0; i--) {
|
||||
for (int16_t j = m-2; j >= 0; j--) {
|
||||
if (town[i][j]) {
|
||||
sum[i][j] = min(sum[i][j+1], min(sum[i+1][j], sum[i+1][j+1])) + 1;
|
||||
if (sum[i][j] >= max_of_s) {
|
||||
max_of_s = sum[i][j];
|
||||
max_i = i;
|
||||
max_j = j;
|
||||
}
|
||||
} else {
|
||||
sum[i][j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (max_of_s > 0) {
|
||||
output_stream << (max_i + 1) << " " << (max_j + 1) << " " << max_of_s << endl;
|
||||
} else {
|
||||
output_stream << "MONEA NU ARE RUDE" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
char task;
|
||||
input_stream >> task;
|
||||
|
||||
|
||||
if (task == '1') {
|
||||
task1();
|
||||
} else {
|
||||
task2();
|
||||
}
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
61
2019/republic/12_d1/anagrame.cpp
Normal file
61
2019/republic/12_d1/anagrame.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
int findAnagramPos(string content, string title) {
|
||||
const uint32_t CONTENT_LEN = content.length();
|
||||
const uint32_t TITLE_LEN = title.length();
|
||||
|
||||
unordered_map<char, uint32_t> target, anagram;
|
||||
for (uint32_t i = 0; i < TITLE_LEN; i++) {
|
||||
target[title[i]]++;
|
||||
anagram[content[i]]++;
|
||||
}
|
||||
|
||||
if (target == anagram) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint32_t i = TITLE_LEN; i < CONTENT_LEN; i++) {
|
||||
/**
|
||||
Old first character pos = i - TITLE_LEN
|
||||
New first character pos = i - TITLE_LEN + 1
|
||||
Old last character pos = i - 1
|
||||
New last character pos = i
|
||||
*/
|
||||
char firstChar = content[i - TITLE_LEN];
|
||||
anagram[firstChar]--;
|
||||
|
||||
if (anagram[firstChar] == 0) {
|
||||
anagram.erase(firstChar);
|
||||
}
|
||||
|
||||
anagram[content[i]]++;
|
||||
|
||||
if (target == anagram) {
|
||||
return i - TITLE_LEN;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
|
||||
string content, title;
|
||||
input_stream >> content;
|
||||
input_stream >> title;
|
||||
|
||||
cout << findAnagramPos(content, title) << endl;
|
||||
|
||||
input_stream.close();
|
||||
return 0;
|
||||
}
|
||||
111
2019/republic/12_d1/cartita.cpp
Normal file
111
2019/republic/12_d1/cartita.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
struct Node {
|
||||
public:
|
||||
uint32_t number;
|
||||
Node *left, *right;
|
||||
|
||||
Node(uint32_t n):number(n) {
|
||||
}
|
||||
|
||||
Node(): number(0) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool locateLeftmostNode (Node *node, uint32_t level, uint32_t targetLevel) {
|
||||
if (level == targetLevel) {
|
||||
cout << node -> number << " ";
|
||||
return 1;
|
||||
} else {
|
||||
// Search left. If unsuccessfull, search through right
|
||||
if (node -> left != nullptr) {
|
||||
if (locateLeftmostNode(node -> left, level + 1, targetLevel)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Search right. If unsuccessful, this should return 0
|
||||
if (node -> right != nullptr) {
|
||||
return locateLeftmostNode(node -> right, level + 1, targetLevel);
|
||||
}
|
||||
|
||||
// Previous searches didn't return anything, meaning node has no children. Return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool locateRightmostNode (Node *node, uint32_t level, uint32_t targetLevel) {
|
||||
if (level == targetLevel) {
|
||||
cout << node -> number << endl;
|
||||
return 1;
|
||||
} else {
|
||||
// Search right. If unsuccessfull, search through left
|
||||
if (node -> right != nullptr) {
|
||||
if (locateRightmostNode(node -> right, level + 1, targetLevel)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Search left. If unsuccessful, this should return 0
|
||||
if (node -> left != nullptr) {
|
||||
return locateRightmostNode(node -> left, level + 1, targetLevel);
|
||||
}
|
||||
|
||||
// Previous searches didn't return anything, meaning node has no children. Return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
|
||||
uint32_t N;
|
||||
uint16_t K;
|
||||
input_stream >> N;
|
||||
input_stream >> K;
|
||||
|
||||
unordered_map<uint32_t, Node*> orphanNodes;
|
||||
Node *nodes[N];
|
||||
|
||||
for (uint32_t i = 0; i < N; i++) {
|
||||
nodes[i] = new Node(i + 1);
|
||||
orphanNodes[i + 1] = nodes[i];
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < (N - 1); i++) {
|
||||
uint32_t parentId, childId;
|
||||
char direction;
|
||||
|
||||
input_stream >> parentId;
|
||||
input_stream >> childId;
|
||||
input_stream >> direction;
|
||||
|
||||
// Remove orphan mark from child
|
||||
orphanNodes.erase(childId);
|
||||
|
||||
// Assign child to parent
|
||||
if(direction == 'S') {
|
||||
nodes[parentId - 1] -> left = nodes[childId - 1];
|
||||
} else {
|
||||
nodes[parentId - 1] -> right = nodes[childId - 1];
|
||||
}
|
||||
}
|
||||
|
||||
Node *rootNode = orphanNodes.begin() -> second;
|
||||
locateLeftmostNode(rootNode, 0, K);
|
||||
locateRightmostNode(rootNode, 0, K);
|
||||
|
||||
input_stream.close();
|
||||
return 0;
|
||||
}
|
||||
66
2019/republic/12_d1/clubul.cpp
Normal file
66
2019/republic/12_d1/clubul.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
|
||||
void fillList(list<uint16_t> &L) {
|
||||
int counter = 1;
|
||||
for (auto i = L.begin(); i != L.end(); i++) {
|
||||
*i = counter;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
list<uint16_t> getPositions() {
|
||||
uint16_t N, K, R;
|
||||
input_stream >> N;
|
||||
input_stream >> K;
|
||||
input_stream >> R;
|
||||
|
||||
list<uint16_t> positions (N, 0);
|
||||
fillList(positions);
|
||||
|
||||
for (uint16_t i; i < R; i++) {
|
||||
uint16_t loser;
|
||||
input_stream >> loser;
|
||||
|
||||
auto loser_it = positions.begin();
|
||||
advance(loser_it, loser-1);
|
||||
|
||||
loser = *loser_it;
|
||||
|
||||
positions.erase(loser_it);
|
||||
positions.push_back(loser);
|
||||
|
||||
}
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
list<uint16_t> positions = getPositions();
|
||||
|
||||
uint16_t P;
|
||||
input_stream >> P;
|
||||
|
||||
auto dan_it = positions.begin();
|
||||
advance(dan_it, P - 1);
|
||||
cout << *dan_it << endl;
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
44
2019/republic/12_d1/clubul2.cpp
Normal file
44
2019/republic/12_d1/clubul2.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
uint32_t N, K, R, P;
|
||||
input_stream >> N;
|
||||
input_stream >> K;
|
||||
input_stream >> R;
|
||||
|
||||
uint32_t rounds[R] = {};
|
||||
|
||||
for (uint32_t i = 0; i < R; i++) {
|
||||
input_stream >> rounds[i];
|
||||
}
|
||||
|
||||
input_stream >> P;
|
||||
|
||||
for (int i = R - 1; i >=0; i--) {
|
||||
if (P == N) {
|
||||
P = rounds[i];
|
||||
} else if (P >= rounds[i]) {
|
||||
P++;
|
||||
}
|
||||
}
|
||||
|
||||
cout << P << endl;
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
BIN
2019/republic/12_d1/condition.pdf
Normal file
BIN
2019/republic/12_d1/condition.pdf
Normal file
Binary file not shown.
152
2019/republic/12_d2/cercetari.cpp
Normal file
152
2019/republic/12_d2/cercetari.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
set<char> readCode() {
|
||||
char str[20] = {};
|
||||
input_stream >> str;
|
||||
|
||||
set<char> code = set<char>(begin(str), end(str));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t getIntersection(set<char> set1, set<char> set2) {
|
||||
set<char> result;
|
||||
set_intersection(set1.begin(), set1.end(), set2.begin(), set2.end(), inserter(result, result.begin()));
|
||||
return result.size() - 1;
|
||||
}
|
||||
|
||||
|
||||
void task1() {
|
||||
uint16_t n;
|
||||
input_stream >> n;
|
||||
|
||||
uint16_t m;
|
||||
input_stream >> m;
|
||||
|
||||
uint16_t G;
|
||||
input_stream >> G;
|
||||
|
||||
set<char> monea_code = readCode();
|
||||
int16_t best_match = -1;
|
||||
vector<string> matches;
|
||||
matches.reserve(m * n);
|
||||
|
||||
for (uint16_t y = 0; y < n; y++) {
|
||||
for (uint16_t x = 0; x < m; x++) {
|
||||
char cat[20] = {};
|
||||
input_stream >> cat;
|
||||
set<char> cat_code = set<char>(begin(cat), end(cat));
|
||||
|
||||
uint8_t match = getIntersection(monea_code, cat_code);
|
||||
|
||||
if (match > best_match && match > G) {
|
||||
best_match = match;
|
||||
matches.clear();
|
||||
matches.push_back(to_string(y + 1) + " " + to_string(x + 1) + " " + string(cat));
|
||||
} else if (match == best_match) {
|
||||
matches.push_back(to_string(y + 1) + " " + to_string(x + 1) + " " + string(cat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_match > 0) {
|
||||
output_stream << best_match << endl;
|
||||
for (auto i = matches.begin(); i != matches.end(); i++) {
|
||||
output_stream << *i << endl;
|
||||
}
|
||||
} else {
|
||||
output_stream << "MONEA NU ARE RUDE" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void task2() {
|
||||
uint16_t n;
|
||||
input_stream >> n;
|
||||
|
||||
uint16_t m;
|
||||
input_stream >> m;
|
||||
|
||||
uint16_t G;
|
||||
input_stream >> G;
|
||||
|
||||
set<char> monea_code = readCode();
|
||||
bool town[n][m] = {};
|
||||
|
||||
for (uint16_t y = 0; y < n; y++) {
|
||||
for (uint16_t x = 0; x < m; x++) {
|
||||
set<char> cat_code = readCode();
|
||||
|
||||
if (getIntersection(monea_code, cat_code) > G) {
|
||||
town[y][x] = true;
|
||||
} else {
|
||||
town[y][x] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t sum[n][m] = {};
|
||||
uint16_t max_of_s, max_i, max_j = 0;
|
||||
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
sum[i][m - 1] = town[i][m - 1];
|
||||
}
|
||||
|
||||
for (uint16_t j = 0; j < m; j++) {
|
||||
sum[n - 1][j] = town[n - 1][j];
|
||||
}
|
||||
|
||||
for (int16_t i = n-2; i >= 0; i--) {
|
||||
for (int16_t j = m-2; j >= 0; j--) {
|
||||
if (town[i][j]) {
|
||||
sum[i][j] = min(sum[i][j+1], min(sum[i+1][j], sum[i+1][j+1])) + 1;
|
||||
if (sum[i][j] >= max_of_s) {
|
||||
max_of_s = sum[i][j];
|
||||
max_i = i;
|
||||
max_j = j;
|
||||
}
|
||||
} else {
|
||||
sum[i][j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (max_of_s > 0) {
|
||||
output_stream << (max_i + 1) << " " << (max_j + 1) << " " << max_of_s << endl;
|
||||
} else {
|
||||
output_stream << "MONEA NU ARE RUDE" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
char task;
|
||||
input_stream >> task;
|
||||
|
||||
|
||||
if (task == '1') {
|
||||
task1();
|
||||
} else {
|
||||
task2();
|
||||
}
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
BIN
2019/republic/12_d2/condition.pdf
Normal file
BIN
2019/republic/12_d2/condition.pdf
Normal file
Binary file not shown.
143
2019/republic/12_d2/pante.cpp
Normal file
143
2019/republic/12_d2/pante.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
bool checkAscending(string numStr) {
|
||||
char highestDigit = numStr[0];
|
||||
|
||||
for (uint8_t i = 1; i < numStr.length(); i++) {
|
||||
if (numStr[i] < highestDigit) {
|
||||
return false;
|
||||
}
|
||||
highestDigit = numStr[i];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t n_choose_m(uint8_t n, uint8_t m) {
|
||||
if (m > n) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m * 2 > n) {
|
||||
m = n - m;
|
||||
}
|
||||
|
||||
if (m == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t res = n;
|
||||
|
||||
for (int i = 2; i <= m; i++) {
|
||||
res *= n - i + 1;
|
||||
res /= i;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t pos_combinations(uint8_t pos) {
|
||||
/**
|
||||
pos starts at 0 from right end of number
|
||||
10^pos <> 10^pos-1
|
||||
*/
|
||||
if (pos == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return n_choose_m(8 + pos, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t following_combinations(uint8_t first_num, uint8_t pos) {
|
||||
/**
|
||||
10^pos+1 <> first_num * 10^pos
|
||||
available = 10 - (first_num - 1) + allowed_repeats (pos)
|
||||
*/
|
||||
return n_choose_m(10 - first_num + pos, pos + 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t preceeding_combinations(uint8_t first_num, uint8_t pos) {
|
||||
/**
|
||||
first_num * 10^pos <> 10^pos
|
||||
*/
|
||||
return pos_combinations(pos + 1) - following_combinations(first_num, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint64_t find_ascending(string start, string end) {
|
||||
uint64_t result = 0;
|
||||
const uint8_t end_len = end.length();
|
||||
|
||||
if (end_len == 1) {
|
||||
result += stoi(end) - stoi(start) + 1;
|
||||
} else if (start == "1") {
|
||||
char highest_digit = '1';
|
||||
bool sequence_integrity = true;
|
||||
|
||||
// Run this loop until a digit lower than the others is encountered
|
||||
uint8_t i;
|
||||
for (i = 0; i < end_len - 1; i++) {
|
||||
uint8_t pos = end_len - i - 1;
|
||||
result += pos_combinations(pos);
|
||||
|
||||
if (end[i] > highest_digit) {
|
||||
result += preceeding_combinations(end[i] - '0', pos) - preceeding_combinations(highest_digit - '0', pos);
|
||||
highest_digit = end[i];
|
||||
} else if (end[i] < highest_digit) {
|
||||
sequence_integrity = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
for (i; i < end_len - 1; i++) {
|
||||
uint8_t pos = end_len - i - 1;
|
||||
result += pos_combinations(pos);
|
||||
}
|
||||
|
||||
if (sequence_integrity && end[end_len - 1] >= highest_digit) {
|
||||
result += end[end_len - 1] - highest_digit + 1;
|
||||
}
|
||||
} else {
|
||||
result += find_ascending("1", end) - find_ascending("1", start);
|
||||
|
||||
if (checkAscending(start)) {
|
||||
result += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
string A;
|
||||
string B;
|
||||
|
||||
input_stream >> A;
|
||||
input_stream >> B;
|
||||
|
||||
cout << find_ascending(A, B) << endl;
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
58
2019/republic/12_d2/vasul.cpp
Normal file
58
2019/republic/12_d2/vasul.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <deque>
|
||||
#include <numeric>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
uint64_t dequeSum(deque<uint64_t> &d) {
|
||||
return accumulate(d.begin(), d.end(), 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
uint16_t P, T, N;
|
||||
input_stream >> P;
|
||||
input_stream >> T;
|
||||
input_stream >> N;
|
||||
|
||||
deque<uint64_t> bacteria;
|
||||
bacteria.push_front(P);
|
||||
|
||||
uint16_t i;
|
||||
uint64_t mature = 0;
|
||||
|
||||
// Populate list until death of first generation
|
||||
for (i=1; i < T && i <= N; i++) {
|
||||
// Reproduction
|
||||
bacteria.push_front(mature);
|
||||
|
||||
// Maturity
|
||||
mature += bacteria[1];
|
||||
}
|
||||
|
||||
// Run loop considering death until experiment is complete
|
||||
for(i; i <= N; i++) {
|
||||
// Reproduction
|
||||
bacteria.push_front(mature);
|
||||
|
||||
// Death
|
||||
mature -= bacteria.back();
|
||||
bacteria.pop_back();
|
||||
|
||||
// Maturity
|
||||
mature += bacteria[1];
|
||||
}
|
||||
|
||||
output_stream << dequeSum(bacteria) << endl;
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
BIN
2020/sector/condition_moda.jpg
Normal file
BIN
2020/sector/condition_moda.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 257 KiB |
BIN
2020/sector/condition_prince.jpg
Normal file
BIN
2020/sector/condition_prince.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
108
2020/sector/moda.cpp
Normal file
108
2020/sector/moda.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ifstream input_stream;
|
||||
ofstream output_stream;
|
||||
|
||||
|
||||
class Order {
|
||||
public:
|
||||
int hour;
|
||||
int value;
|
||||
int pos;
|
||||
Order (int O, int V, int P) {
|
||||
hour = O;
|
||||
value = V;
|
||||
pos = P;
|
||||
}
|
||||
Order () {
|
||||
hour = -1;
|
||||
value = -1;
|
||||
pos = -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool compValue(Order &a, Order &b) {
|
||||
/**
|
||||
Sort orders by value
|
||||
*/
|
||||
if (a.value < b.value) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
input_stream.open("input.txt");
|
||||
output_stream.open("output.txt");
|
||||
|
||||
int N;
|
||||
input_stream >> N;
|
||||
|
||||
// plain orders array is used as a tmp-holder to read data
|
||||
Order orders[N];
|
||||
// Data from orders per hour is gradually appended to order queue
|
||||
vector<Order> orders_by_hour[24];
|
||||
|
||||
for (int i=0; i < 24; i++) {
|
||||
orders_by_hour[i].reserve(16);
|
||||
}
|
||||
|
||||
int gain = 0;
|
||||
int loss = 0;
|
||||
for (int i=0; i < N; i++) {
|
||||
// Read data for each order, calculate max possible gain
|
||||
input_stream >> orders[i].hour;
|
||||
|
||||
input_stream >> orders[i].value;
|
||||
gain += orders[i].value;
|
||||
|
||||
orders[i].pos = i + 1;
|
||||
|
||||
orders_by_hour[orders[i].hour - 1].push_back(orders[i]);
|
||||
}
|
||||
|
||||
// Queue is appended for each hour, then it is sorted by value
|
||||
vector<Order> order_queue;
|
||||
order_queue.reserve(N);
|
||||
|
||||
// Resulting sequence of orders in reverse.
|
||||
vector<Order> order_sequence;
|
||||
order_sequence.reserve(N);
|
||||
|
||||
for (int i = 23; i >= 0; i--) {
|
||||
// Add orders from this hour to queue
|
||||
order_queue.insert(order_queue.end(), orders_by_hour[i].begin(), orders_by_hour[i].end());
|
||||
|
||||
// If queue is not empty, add the most expensive order from queue to sequence
|
||||
if(order_queue.size() > 0) {
|
||||
sort(order_queue.begin(), order_queue.end(), compValue);
|
||||
order_sequence.push_back(order_queue.back());
|
||||
order_queue.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust gain/loss based on the orders left in queue
|
||||
for (auto i: order_queue) {
|
||||
loss += i.value;
|
||||
gain -= i.value;
|
||||
}
|
||||
|
||||
cout << gain << " " << loss << endl;
|
||||
|
||||
for (auto i = order_sequence.rbegin(); i != order_sequence.rend(); i++) {
|
||||
cout << (*i).pos << endl;
|
||||
}
|
||||
|
||||
|
||||
input_stream.close();
|
||||
output_stream.close();
|
||||
return 0;
|
||||
}
|
||||
3
2022/city/10/domino/tests/1-domino.in
Normal file
3
2022/city/10/domino/tests/1-domino.in
Normal file
@@ -0,0 +1,3 @@
|
||||
1
|
||||
1 2
|
||||
|
||||
1
2022/city/10/domino/tests/1-domino.ok
Normal file
1
2022/city/10/domino/tests/1-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
11
2022/city/10/domino/tests/10-domino.in
Normal file
11
2022/city/10/domino/tests/10-domino.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
0 1
|
||||
2 3
|
||||
4 5
|
||||
6 6
|
||||
0 2
|
||||
0 3
|
||||
0 4
|
||||
0 5
|
||||
0 6
|
||||
1 1
|
||||
1
2022/city/10/domino/tests/10-domino.ok
Normal file
1
2022/city/10/domino/tests/10-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
10
|
||||
18
2022/city/10/domino/tests/11-domino.in
Normal file
18
2022/city/10/domino/tests/11-domino.in
Normal file
@@ -0,0 +1,18 @@
|
||||
15
|
||||
1 2
|
||||
2 2
|
||||
2 3
|
||||
3 3
|
||||
3 4
|
||||
4 4
|
||||
4 5
|
||||
5 5
|
||||
5 6
|
||||
6 6
|
||||
1 1
|
||||
0 0
|
||||
0 6
|
||||
6 4
|
||||
4 2
|
||||
|
||||
|
||||
1
2022/city/10/domino/tests/11-domino.ok
Normal file
1
2022/city/10/domino/tests/11-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
13
|
||||
16
2022/city/10/domino/tests/12-domino.in
Normal file
16
2022/city/10/domino/tests/12-domino.in
Normal file
@@ -0,0 +1,16 @@
|
||||
15
|
||||
0 0
|
||||
1 2
|
||||
6 6
|
||||
2 3
|
||||
3 3
|
||||
3 4
|
||||
4 5
|
||||
5 6
|
||||
1 1
|
||||
0 6
|
||||
6 4
|
||||
4 2
|
||||
2 2
|
||||
5 5
|
||||
4 4
|
||||
1
2022/city/10/domino/tests/12-domino.ok
Normal file
1
2022/city/10/domino/tests/12-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
13
|
||||
19
2022/city/10/domino/tests/13-domino.in
Normal file
19
2022/city/10/domino/tests/13-domino.in
Normal file
@@ -0,0 +1,19 @@
|
||||
18
|
||||
0 0
|
||||
1 2
|
||||
6 6
|
||||
2 3
|
||||
3 3
|
||||
3 4
|
||||
4 5
|
||||
5 6
|
||||
1 1
|
||||
0 6
|
||||
6 4
|
||||
4 2
|
||||
2 2
|
||||
5 5
|
||||
4 4
|
||||
5 2
|
||||
6 2
|
||||
3 6
|
||||
1
2022/city/10/domino/tests/13-domino.ok
Normal file
1
2022/city/10/domino/tests/13-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
16
|
||||
19
2022/city/10/domino/tests/14-domino.in
Normal file
19
2022/city/10/domino/tests/14-domino.in
Normal file
@@ -0,0 +1,19 @@
|
||||
18
|
||||
0 0
|
||||
1 2
|
||||
6 6
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
1 1
|
||||
0 6
|
||||
6 4
|
||||
4 2
|
||||
2 2
|
||||
5 5
|
||||
4 4
|
||||
5 2
|
||||
6 2
|
||||
3 6
|
||||
3 5
|
||||
1 6
|
||||
1
2022/city/10/domino/tests/14-domino.ok
Normal file
1
2022/city/10/domino/tests/14-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
17
|
||||
20
2022/city/10/domino/tests/15-domino.in
Normal file
20
2022/city/10/domino/tests/15-domino.in
Normal file
@@ -0,0 +1,20 @@
|
||||
19
|
||||
0 0
|
||||
0 1
|
||||
0 5
|
||||
0 6
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
1
2022/city/10/domino/tests/15-domino.ok
Normal file
1
2022/city/10/domino/tests/15-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
18
|
||||
20
2022/city/10/domino/tests/16-domino.in
Normal file
20
2022/city/10/domino/tests/16-domino.in
Normal file
@@ -0,0 +1,20 @@
|
||||
19
|
||||
0 0
|
||||
0 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
1
2022/city/10/domino/tests/16-domino.ok
Normal file
1
2022/city/10/domino/tests/16-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
17
|
||||
19
2022/city/10/domino/tests/17-domino.in
Normal file
19
2022/city/10/domino/tests/17-domino.in
Normal file
@@ -0,0 +1,19 @@
|
||||
17
|
||||
0 0
|
||||
1 1
|
||||
5 6
|
||||
4 6
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
4 4
|
||||
4 5
|
||||
5 5
|
||||
6 6
|
||||
|
||||
1
2022/city/10/domino/tests/17-domino.ok
Normal file
1
2022/city/10/domino/tests/17-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
15
|
||||
21
2022/city/10/domino/tests/18-domino.in
Normal file
21
2022/city/10/domino/tests/18-domino.in
Normal file
@@ -0,0 +1,21 @@
|
||||
19
|
||||
2 5
|
||||
3 3
|
||||
2 6
|
||||
3 4
|
||||
3 5
|
||||
4 4
|
||||
3 6
|
||||
4 5
|
||||
6 6
|
||||
5 5
|
||||
0 0
|
||||
1 1
|
||||
1 3
|
||||
5 6
|
||||
1 2
|
||||
4 6
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
|
||||
1
2022/city/10/domino/tests/18-domino.ok
Normal file
1
2022/city/10/domino/tests/18-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
18
|
||||
22
2022/city/10/domino/tests/19-domino.in
Normal file
22
2022/city/10/domino/tests/19-domino.in
Normal file
@@ -0,0 +1,22 @@
|
||||
20
|
||||
0 0
|
||||
0 1
|
||||
0 3
|
||||
0 4
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 6
|
||||
2 2
|
||||
2 3
|
||||
2 5
|
||||
3 3
|
||||
3 4
|
||||
3 6
|
||||
4 4
|
||||
4 5
|
||||
5 5
|
||||
5 6
|
||||
6 6
|
||||
|
||||
1
2022/city/10/domino/tests/19-domino.ok
Normal file
1
2022/city/10/domino/tests/19-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
18
|
||||
8
2022/city/10/domino/tests/2-domino.in
Normal file
8
2022/city/10/domino/tests/2-domino.in
Normal file
@@ -0,0 +1,8 @@
|
||||
7
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
1
2022/city/10/domino/tests/2-domino.ok
Normal file
1
2022/city/10/domino/tests/2-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
23
2022/city/10/domino/tests/20-domino.in
Normal file
23
2022/city/10/domino/tests/20-domino.in
Normal file
@@ -0,0 +1,23 @@
|
||||
22
|
||||
0 0
|
||||
0 1
|
||||
0 3
|
||||
0 4
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 6
|
||||
2 2
|
||||
2 3
|
||||
2 5
|
||||
3 3
|
||||
3 4
|
||||
3 6
|
||||
4 4
|
||||
4 5
|
||||
5 5
|
||||
5 6
|
||||
6 6
|
||||
0 5
|
||||
0 6
|
||||
1
2022/city/10/domino/tests/20-domino.ok
Normal file
1
2022/city/10/domino/tests/20-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
21
|
||||
10
2022/city/10/domino/tests/3-domino.in
Normal file
10
2022/city/10/domino/tests/3-domino.in
Normal file
@@ -0,0 +1,10 @@
|
||||
8
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
2 3
|
||||
|
||||
1
2022/city/10/domino/tests/3-domino.ok
Normal file
1
2022/city/10/domino/tests/3-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
3
|
||||
12
2022/city/10/domino/tests/4-domino.in
Normal file
12
2022/city/10/domino/tests/4-domino.in
Normal file
@@ -0,0 +1,12 @@
|
||||
9
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
2 3
|
||||
3 4
|
||||
|
||||
|
||||
1
2022/city/10/domino/tests/4-domino.ok
Normal file
1
2022/city/10/domino/tests/4-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
5
|
||||
5
2022/city/10/domino/tests/5-domino.in
Normal file
5
2022/city/10/domino/tests/5-domino.in
Normal file
@@ -0,0 +1,5 @@
|
||||
4
|
||||
3 6
|
||||
3 5
|
||||
3 0
|
||||
6 6
|
||||
1
2022/city/10/domino/tests/5-domino.ok
Normal file
1
2022/city/10/domino/tests/5-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
3
|
||||
11
2022/city/10/domino/tests/6-domino.in
Normal file
11
2022/city/10/domino/tests/6-domino.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
0 0
|
||||
4 5
|
||||
3 5
|
||||
6 6
|
||||
3 0
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
3 6
|
||||
5 5
|
||||
1
2022/city/10/domino/tests/6-domino.ok
Normal file
1
2022/city/10/domino/tests/6-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
7
|
||||
11
2022/city/10/domino/tests/7-domino.in
Normal file
11
2022/city/10/domino/tests/7-domino.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
1 0
|
||||
2 3
|
||||
4 5
|
||||
1 2
|
||||
5 5
|
||||
3 3
|
||||
2 2
|
||||
3 4
|
||||
1 1
|
||||
4 4
|
||||
1
2022/city/10/domino/tests/7-domino.ok
Normal file
1
2022/city/10/domino/tests/7-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
10
|
||||
11
2022/city/10/domino/tests/8-domino.in
Normal file
11
2022/city/10/domino/tests/8-domino.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
3 4
|
||||
0 0
|
||||
2 3
|
||||
4 4
|
||||
6 6
|
||||
0 1
|
||||
5 6
|
||||
1 1
|
||||
4 5
|
||||
1 2
|
||||
1
2022/city/10/domino/tests/8-domino.ok
Normal file
1
2022/city/10/domino/tests/8-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
10
|
||||
15
2022/city/10/domino/tests/9-domino.in
Normal file
15
2022/city/10/domino/tests/9-domino.in
Normal file
@@ -0,0 +1,15 @@
|
||||
10
|
||||
0 4
|
||||
0 6
|
||||
0 1
|
||||
1 2
|
||||
2 3
|
||||
4 6
|
||||
5 6
|
||||
1 6
|
||||
2 6
|
||||
5 3
|
||||
|
||||
|
||||
|
||||
|
||||
1
2022/city/10/domino/tests/9-domino.ok
Normal file
1
2022/city/10/domino/tests/9-domino.ok
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
20
2022/city/10/domino/tests/teste.txt
Normal file
20
2022/city/10/domino/tests/teste.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
1 5
|
||||
2 5
|
||||
3 5
|
||||
4 5
|
||||
5 5
|
||||
6 5
|
||||
7 5
|
||||
8 5
|
||||
9 5
|
||||
10 5
|
||||
11 5
|
||||
12 5
|
||||
13 5
|
||||
14 5
|
||||
15 5
|
||||
16 5
|
||||
17 5
|
||||
18 5
|
||||
19 5
|
||||
20 5
|
||||
7
2022/city/10/energie/tests/1-energie.in
Normal file
7
2022/city/10/energie/tests/1-energie.in
Normal file
@@ -0,0 +1,7 @@
|
||||
4
|
||||
Postasul Valentina 38
|
||||
Munteanu Ion 25
|
||||
Prisacaru Viorica 59
|
||||
Paduraru Vasile 100
|
||||
|
||||
|
||||
3
2022/city/10/energie/tests/1-energie.ok
Normal file
3
2022/city/10/energie/tests/1-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
55.50
|
||||
Paduraru Vasile 100
|
||||
Munteanu Ion 25
|
||||
12
2022/city/10/energie/tests/10-energie.in
Normal file
12
2022/city/10/energie/tests/10-energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
Postasul Valentina 3983
|
||||
Munteanu Ion 3999
|
||||
Prisacaru Viorica 3998
|
||||
Paduraru Vasile 3997
|
||||
Mocanu Petru 4000
|
||||
Levinta Ecaterina 3995
|
||||
Moraru Victoria 3994
|
||||
Munteanu Elena 3996
|
||||
Panzaru Maria 3982
|
||||
Rotaru Constantin 3981
|
||||
|
||||
3
2022/city/10/energie/tests/10-energie.ok
Normal file
3
2022/city/10/energie/tests/10-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
3992.50
|
||||
Mocanu Petru 4000
|
||||
Rotaru Constantin 3981
|
||||
9
2022/city/10/energie/tests/2-energie.in
Normal file
9
2022/city/10/energie/tests/2-energie.in
Normal file
@@ -0,0 +1,9 @@
|
||||
5
|
||||
Postasul Valentina 38
|
||||
Munteanu Ion 25
|
||||
Prisacaru Viorica 59
|
||||
Paduraru Vasile 100
|
||||
Levinta Ecaterina 134
|
||||
|
||||
|
||||
|
||||
3
2022/city/10/energie/tests/2-energie.ok
Normal file
3
2022/city/10/energie/tests/2-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
71.20
|
||||
Levinta Ecaterina 134
|
||||
Munteanu Ion 25
|
||||
11
2022/city/10/energie/tests/3-energie.in
Normal file
11
2022/city/10/energie/tests/3-energie.in
Normal file
@@ -0,0 +1,11 @@
|
||||
6
|
||||
Postasul Valentina 1
|
||||
Munteanu Ion 2
|
||||
Prisacaru Viorica 3
|
||||
Paduraru Vasile 8
|
||||
Levinta Ecaterina 5
|
||||
Moraru Victoria 6
|
||||
|
||||
|
||||
|
||||
|
||||
3
2022/city/10/energie/tests/3-energie.ok
Normal file
3
2022/city/10/energie/tests/3-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
4.17
|
||||
Paduraru Vasile 8
|
||||
Postasul Valentina 1
|
||||
12
2022/city/10/energie/tests/4-energie.in
Normal file
12
2022/city/10/energie/tests/4-energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
7
|
||||
Postasul Valentina 451
|
||||
Munteanu Ion 232
|
||||
Prisacaru Viorica 332
|
||||
Paduraru Vasile 258
|
||||
Mocanu Petru 2919
|
||||
Levinta Ecaterina 3125
|
||||
Moraru Victoria 645
|
||||
|
||||
|
||||
|
||||
|
||||
3
2022/city/10/energie/tests/4-energie.ok
Normal file
3
2022/city/10/energie/tests/4-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
1137.43
|
||||
Levinta Ecaterina 3125
|
||||
Munteanu Ion 232
|
||||
14
2022/city/10/energie/tests/5-energie.in
Normal file
14
2022/city/10/energie/tests/5-energie.in
Normal file
@@ -0,0 +1,14 @@
|
||||
8
|
||||
Postasul Valentina 1451
|
||||
Munteanu Ion 1232
|
||||
Prisacaru Viorica 3332
|
||||
Paduraru Vasile 2258
|
||||
Mocanu Petru 2919
|
||||
Levinta Ecaterina 3125
|
||||
Moraru Victoria 645
|
||||
Munteanu Elena 3289
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
2022/city/10/energie/tests/5-energie.ok
Normal file
3
2022/city/10/energie/tests/5-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
2281.38
|
||||
Prisacaru Viorica 3332
|
||||
Moraru Victoria 645
|
||||
10
2022/city/10/energie/tests/6-energie.in
Normal file
10
2022/city/10/energie/tests/6-energie.in
Normal file
@@ -0,0 +1,10 @@
|
||||
9
|
||||
Postasul Valentina 1451
|
||||
Munteanu Ion 1232
|
||||
Prisacaru Viorica 3332
|
||||
Paduraru Vasile 2258
|
||||
Mocanu Petru 4000
|
||||
Levinta Ecaterina 3125
|
||||
Moraru Victoria 645
|
||||
Munteanu Elena 3289
|
||||
Panzaru Maria 3999
|
||||
3
2022/city/10/energie/tests/6-energie.ok
Normal file
3
2022/city/10/energie/tests/6-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
2592.33
|
||||
Mocanu Petru 4000
|
||||
Moraru Victoria 645
|
||||
12
2022/city/10/energie/tests/7-energie.in
Normal file
12
2022/city/10/energie/tests/7-energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
Postasul Valentina 1451
|
||||
Munteanu Ion 4000
|
||||
Prisacaru Viorica 3332
|
||||
Paduraru Vasile 2258
|
||||
Mocanu Petru 3901
|
||||
Levinta Ecaterina 3125
|
||||
Moraru Victoria 645
|
||||
Munteanu Elena 3289
|
||||
Panzaru Maria 3999
|
||||
Rotaru Constantin 3998
|
||||
|
||||
3
2022/city/10/energie/tests/7-energie.ok
Normal file
3
2022/city/10/energie/tests/7-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
2999.80
|
||||
Munteanu Ion 4000
|
||||
Moraru Victoria 645
|
||||
12
2022/city/10/energie/tests/8-energie.in
Normal file
12
2022/city/10/energie/tests/8-energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
Postasul Valentina 1451
|
||||
Munteanu Ion 200
|
||||
Prisacaru Viorica 3332
|
||||
Paduraru Vasile 2258
|
||||
Mocanu Petru 901
|
||||
Levinta Ecaterina 125
|
||||
Moraru Victoria 645
|
||||
Munteanu Elena 3289
|
||||
Panzaru Maria 3999
|
||||
Rotaru Constantin 98
|
||||
|
||||
3
2022/city/10/energie/tests/8-energie.ok
Normal file
3
2022/city/10/energie/tests/8-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
1629.80
|
||||
Panzaru Maria 3999
|
||||
Rotaru Constantin 98
|
||||
12
2022/city/10/energie/tests/9-energie.in
Normal file
12
2022/city/10/energie/tests/9-energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
Postasul Valentina 3993
|
||||
Munteanu Ion 3999
|
||||
Prisacaru Viorica 3998
|
||||
Paduraru Vasile 3997
|
||||
Mocanu Petru 3996
|
||||
Levinta Ecaterina 3995
|
||||
Moraru Victoria 3994
|
||||
Munteanu Elena 4000
|
||||
Panzaru Maria 3992
|
||||
Rotaru Constantin 3991
|
||||
|
||||
3
2022/city/10/energie/tests/9-energie.ok
Normal file
3
2022/city/10/energie/tests/9-energie.ok
Normal file
@@ -0,0 +1,3 @@
|
||||
3995.50
|
||||
Munteanu Elena 4000
|
||||
Rotaru Constantin 3991
|
||||
12
2022/city/10/energie/tests/energie.in
Normal file
12
2022/city/10/energie/tests/energie.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
Postasul Valentina 3983
|
||||
Munteanu Ion 3999
|
||||
Prisacaru Viorica 3998
|
||||
Paduraru Vasile 3997
|
||||
Mocanu Petru 4000
|
||||
Levinta Ecaterina 3995
|
||||
Moraru Victoria 3994
|
||||
Munteanu Elena 3996
|
||||
Panzaru Maria 3982
|
||||
Rotaru Constantin 3981
|
||||
|
||||
10
2022/city/10/energie/tests/teste.txt
Normal file
10
2022/city/10/energie/tests/teste.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
2022/city/10/numere/tests/1-numere.in
Normal file
11
2022/city/10/numere/tests/1-numere.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
I
|
||||
V
|
||||
VI
|
||||
VII
|
||||
VIII
|
||||
IX
|
||||
X
|
||||
II
|
||||
III
|
||||
IV
|
||||
11
2022/city/10/numere/tests/1-numere.ok
Normal file
11
2022/city/10/numere/tests/1-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
1
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
2
|
||||
3
|
||||
4
|
||||
11
2022/city/10/numere/tests/10-numere.in
Normal file
11
2022/city/10/numere/tests/10-numere.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
CCXXXIX
|
||||
MDLVIII
|
||||
MCMXLIX
|
||||
MMMMCDXXXIV
|
||||
DLXXXIX
|
||||
MMMMCDXLIX
|
||||
MMXXXVIII
|
||||
MDLXIX
|
||||
CDXCIX
|
||||
MMMMMMCDXLIV
|
||||
11
2022/city/10/numere/tests/10-numere.ok
Normal file
11
2022/city/10/numere/tests/10-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
239
|
||||
1558
|
||||
1949
|
||||
4434
|
||||
589
|
||||
4449
|
||||
2038
|
||||
1569
|
||||
499
|
||||
6444
|
||||
11
2022/city/10/numere/tests/2-numere.in
Normal file
11
2022/city/10/numere/tests/2-numere.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
XIV
|
||||
XV
|
||||
XVI
|
||||
XVIII
|
||||
XIX
|
||||
XX
|
||||
XI
|
||||
XII
|
||||
XVII
|
||||
XIII
|
||||
11
2022/city/10/numere/tests/2-numere.ok
Normal file
11
2022/city/10/numere/tests/2-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
14
|
||||
15
|
||||
16
|
||||
18
|
||||
19
|
||||
20
|
||||
11
|
||||
12
|
||||
17
|
||||
13
|
||||
11
2022/city/10/numere/tests/3-numere.in
Normal file
11
2022/city/10/numere/tests/3-numere.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
XXI
|
||||
XXII
|
||||
XXVII
|
||||
XXVIII
|
||||
XXIX
|
||||
XXX
|
||||
XXIII
|
||||
XXIV
|
||||
XXV
|
||||
XXVI
|
||||
11
2022/city/10/numere/tests/3-numere.ok
Normal file
11
2022/city/10/numere/tests/3-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
21
|
||||
22
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
12
2022/city/10/numere/tests/4-numere.in
Normal file
12
2022/city/10/numere/tests/4-numere.in
Normal file
@@ -0,0 +1,12 @@
|
||||
10
|
||||
XXXI
|
||||
XXXII
|
||||
XXXIII
|
||||
XXXVII
|
||||
XXXVIII
|
||||
XXXIX
|
||||
XL
|
||||
XXXIV
|
||||
XXXV
|
||||
XXXVI
|
||||
|
||||
11
2022/city/10/numere/tests/4-numere.ok
Normal file
11
2022/city/10/numere/tests/4-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
31
|
||||
32
|
||||
33
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
34
|
||||
35
|
||||
36
|
||||
11
2022/city/10/numere/tests/5-numere.in
Normal file
11
2022/city/10/numere/tests/5-numere.in
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
LI
|
||||
LII
|
||||
LIII
|
||||
LIV
|
||||
LV
|
||||
LVI
|
||||
LVII
|
||||
LVIII
|
||||
LIX
|
||||
LX
|
||||
11
2022/city/10/numere/tests/5-numere.ok
Normal file
11
2022/city/10/numere/tests/5-numere.ok
Normal file
@@ -0,0 +1,11 @@
|
||||
10
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
7
2022/city/10/numere/tests/6-numere.in
Normal file
7
2022/city/10/numere/tests/6-numere.in
Normal file
@@ -0,0 +1,7 @@
|
||||
6
|
||||
MCDXVIII
|
||||
MMDCCCXCIX
|
||||
MMMMMMMMMM
|
||||
MMMMCDLXVIII
|
||||
LMIII
|
||||
DLXIV
|
||||
7
2022/city/10/numere/tests/6-numere.ok
Normal file
7
2022/city/10/numere/tests/6-numere.ok
Normal file
@@ -0,0 +1,7 @@
|
||||
6
|
||||
1418
|
||||
2899
|
||||
10000
|
||||
4468
|
||||
953
|
||||
564
|
||||
8
2022/city/10/numere/tests/7-numere.in
Normal file
8
2022/city/10/numere/tests/7-numere.in
Normal file
@@ -0,0 +1,8 @@
|
||||
7
|
||||
MMI
|
||||
MMII
|
||||
MMIII
|
||||
MMIV
|
||||
MCMIX
|
||||
MCMXCIX
|
||||
MDXLIV
|
||||
8
2022/city/10/numere/tests/7-numere.ok
Normal file
8
2022/city/10/numere/tests/7-numere.ok
Normal file
@@ -0,0 +1,8 @@
|
||||
7
|
||||
2001
|
||||
2002
|
||||
2003
|
||||
2004
|
||||
1909
|
||||
1999
|
||||
1544
|
||||
13
2022/city/10/numere/tests/8-numere.in
Normal file
13
2022/city/10/numere/tests/8-numere.in
Normal file
@@ -0,0 +1,13 @@
|
||||
9
|
||||
LXIV
|
||||
MMXCVII
|
||||
MMMDCVIII
|
||||
MMDCCCLXIV
|
||||
CMLXIX
|
||||
MMMCDLXV
|
||||
MMMDCCCXCVII
|
||||
XCIX
|
||||
CDXLIV
|
||||
|
||||
|
||||
|
||||
10
2022/city/10/numere/tests/8-numere.ok
Normal file
10
2022/city/10/numere/tests/8-numere.ok
Normal file
@@ -0,0 +1,10 @@
|
||||
9
|
||||
64
|
||||
2097
|
||||
3608
|
||||
2864
|
||||
969
|
||||
3465
|
||||
3897
|
||||
99
|
||||
444
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user