consolidate all repos to one for archive

This commit is contained in:
2025-01-28 13:46:42 +01:00
commit a6610fbc7a
5350 changed files with 2705721 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,11 @@
10 8 10
+ 4 5 4
+ 6 8 2
+ 3 0 6
+ 7 4 4
- 1
+ 5 1 2
- 3
+ 4 0 10
+ 2 0 4
-6

View File

@@ -0,0 +1,10 @@
8
8
6
6
7
7
8
4
4
7

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
struct pillow
{
int x, y, s;
};
int main(int argc, char *argv[])
{
std::ifstream in(argv[1]);
if (!in.is_open())
{
std::cout << "Error opening file" << std::endl;
return 1;
}
int N, V, S;
in >> N >> V >> S;
std::vector<std::multiset<int>> columns(S);
char c;
int row;
std::vector<pillow> pillows;
pillows.reserve(N);
pillow p;
int max_fall = 0;
for (size_t i = 0; i < N; i++)
{
in >> c;
if (c == '+')
{
in >> p.x >> p.y >> p.s;
p.s--;
pillows.push_back(p);
for (int j = p.y; j <= p.y + p.s; j++)
{
columns[j].insert(p.x);
}
}
else
{
in >> row;
pillow p = pillows[row - 1];
for (int j = p.y; j <= p.y + p.s; j++)
{
columns[j].erase(columns[j].find(p.x));
}
}
for (auto &i : columns)
{
auto it = i.begin();
if (it == i.end())
{
max_fall = V;
break;
}
else
{
if (*it > max_fall)
max_fall = *it;
}
}
std::cout << max_fall << std::endl;
max_fall = 0;
}
return 0;
}

View File

@@ -0,0 +1,31 @@
CC=g++
CFLAGS= -std=c++23
INCLUDE_DIR= include
SRC_DIR= src
# Get all cpp files from src directory
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
all: main run
main: main.cpp $(SRCS)
$(CC) $(CFLAGS) -O3 -I$(INCLUDE_DIR) $(SRCS) main.cpp -o main
debug: main.cpp $(SRCS)
$(CC) $(CFLAGS) -I$(INCLUDE_DIR) $(SRCS) -g main.cpp -o main
profile: main.cpp $(SRCS)
$(CC) $(CFLAGS) main.cpp -g -pg -static-libgcc -o main
run: main
time ./main ./examples/testni_primer2.txt > out.txt
diff out.txt ./examples/testni_primer2_resitev.txt
zip:
zip -r main.zip main.cpp $(INCLUDE_DIR) $(SRC_DIR) makefile
clean:
rm main