Separate lib, new problems and script for web

This commit is contained in:
2026-08-26 22:25:19 +01:00
parent 6fd6d70b04
commit afdab7d4bd
44 changed files with 1060 additions and 211 deletions
+1
View File
@@ -0,0 +1 @@
https://usaco.org/index.php?page=viewproblem2&cpid=644
+10
View File
@@ -0,0 +1,10 @@
4 3
1 2
2 3
3 4
3
4
1
2
+115
View File
@@ -0,0 +1,115 @@
#include <map>
#include <unordered_set>
#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
// ----- TYPES -----
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
// ----- FILE IO -----
#define STDIN(filename) freopen(filename, "r", stdin)
#define STDOUT(filename) freopen(filename, "w", stdout)
#define FASTIO cin.tie(0)->sync_with_stdio(0)
#define STDIO(filename) FASTIO; string filenamee(filename); STDIN((filenamee + ".in").c_str()); STDOUT((filenamee + ".out").c_str())
#define NL '\n'
#define CM ", "
// ----- FOR LOOPS -----
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FD(i,L,R) for (int i = L; i > R; i--)
#define FDE(i,L,R) for (int i = L; i >= R; i--)
// ----- WEZ -----
#define takeI(n) int n; cin >> n
#define takeII(n,m) int n, m; cin >> n >> m
#define takeIII(n,m,k) int n, m, k; cin >> n >> m >> k
#define takeL(n) ll n; cin >> n
#define takeS(s) string s; cin >> s
#define takeV(v,n) vi v(n); for (auto &x : v) cin >> x
#define takeVL(v,n) vector<ll> v(n); for (auto &x : v) cin >> x
#define whileZ takeI(T); while(T--)
//
// ----- MAX MIN -----
#define REMAX(a,b) (a)=max((a),(b))
#define REMIN(a,b) (a)=min((a),(b))
// ----- PAIRS -----
#define fi first
#define se second
// ----- OUTPUT -----
#define YESNO(b) cout << ((b) ? "YES" : "NO") << NL
// ----- DEBUG -----
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define DBG2(a,b) cerr << #a "=" << (a) << CM << #b "=" << (b) << endl
#define printA(a,L,R) FE(i,L,R) cerr << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,SZ(a)-1)
// ----- STL DS
#define ALL(c) (c).begin(),(c).end()
#define SZ(c) ((int)(c).size())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(ALL(c), greater<>())
#define UNIQ(c) SORT(c), (c).erase(unique(ALL(c)), (c).end())
#define pb push_back
bool is_connected(map<int,unordered_set<int>> edges) {
stack<int> stk;
unordered_set<int> seen;
stk.push(edges.begin()->first);
while (!stk.empty()) {
int node = stk.top(); stk.pop();
if (seen.count(node)) {continue;}
seen.insert(node);
for (auto nbor : edges[node]) {
stk.push(nbor);
}
}
return seen.size() == edges.size();
}
void print_edges(map<int, unordered_set<int>> edges) {
for (auto [u, v] : edges) {
cerr << u << ": ";
for (int x : v) cerr << x << ' ';
cerr << NL;
}
cerr << NL;
}
int main() {
STDIO("closing");
takeII(n,m);
map<int,unordered_set<int>> edges;
F(i,0,m) {
takeII(u,v);
edges[u].insert(v);
edges[v].insert(u);
}
// Populate so length of edges will be every node
F(i,1,n) edges[i];
FD(i,n,0) {
YESNO(is_connected(edges));
takeI(to_remove);
for (auto nbor : edges[to_remove]) {
edges[nbor].erase(to_remove);
}
edges.erase(to_remove);
}
}
+10
View File
@@ -0,0 +1,10 @@
4 3
1 2
2 3
3 4
3
4
1
2
+104
View File
@@ -0,0 +1,104 @@
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iostream>
#include <vector>
using namespace std;
// ----- TYPES -----
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
// ----- FILE IO -----
#define STDIN(filename) freopen(filename, "r", stdin)
#define STDOUT(filename) freopen(filename, "w", stdout)
#define FASTIO cin.tie(0)->sync_with_stdio(0)
#define STDIO(filename) FASTIO; string filenamee(filename); STDIN((filenamee + ".in").c_str()); STDOUT((filenamee + ".out").c_str())
#define NL '\n'
#define CM ", "
// ----- FOR LOOPS -----
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FD(i,L,R) for (int i = L; i > R; i--)
#define FDE(i,L,R) for (int i = L; i >= R; i--)
// ----- WEZ -----
#define takeI(n) int n; cin >> n
#define takeII(n,m) int n, m; cin >> n >> m
#define takeIII(n,m,k) int n, m, k; cin >> n >> m >> k
#define takeL(n) ll n; cin >> n
#define takeS(s) string s; cin >> s
#define takeV(v,n) vi v(n); for (auto &x : v) cin >> x
#define takeVL(v,n) vector<ll> v(n); for (auto &x : v) cin >> x
#define whileZ takeI(T); while(T--)
//
// ----- MAX MIN -----
#define REMAX(a,b) (a)=max((a),(b))
#define REMIN(a,b) (a)=min((a),(b))
// ----- PAIRS -----
#define fi first
#define se second
// ----- OUTPUT -----
#define YESNO(b) cout << ((b) ? "YES" : "NO") << NL
// ----- DEBUG -----
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define DBG2(a,b) cerr << #a "=" << (a) << CM << #b "=" << (b) << endl
#define printA(a,L,R) FE(i,L,R) cerr << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,SZ(a)-1)
// ----- STL DS
#define ALL(c) (c).begin(),(c).end()
#define SZ(c) ((int)(c).size())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(ALL(c), greater<>())
#define UNIQ(c) SORT(c), (c).erase(unique(ALL(c)), (c).end())
#define pb push_back
const int HEART_SIZE = 20;
const int HALF_SIZE = HEART_SIZE / 2;
bool is_in_love(int x, int y);
int main() {
string message = " SYSTEMATIC LOVE ";
int message_indent = (HALF_SIZE - (message.length() / 8)) - 1;
for (int y = 0; y < HEART_SIZE; ++y) {
for (int x = 0; x < HEART_SIZE; ++x) {
cout << ((is_in_love(x, y)) ? "vvvv" : " ");
if (y== HALF_SIZE-1) {
if (x == message_indent) {
cout << message.c_str();
x += (message.length()/4);
}
}
}
cout << endl;
}
return 0;
}
bool is_in_love(int x, int y) {
const float width = 2.2f;
const float height = 3.0f;
const float HEART_COEFFICIENT = 0.7f;
float check_x = ((static_cast<float>(x) / static_cast<float>(HEART_SIZE)) - 0.5f) * width;
float check_y = ((static_cast<float>(HEART_SIZE - y) / static_cast<float>(HEART_SIZE)) - 0.4f) * height;
float top_y = sqrt(1 - pow(check_x, 2)) + (HEART_COEFFICIENT * sqrt(abs(check_x)));
float bottom_y = -sqrt(1 - pow(check_x, 2)) + (HEART_COEFFICIENT* sqrt(abs(check_x)));
if ((bottom_y <= check_y) && (check_y <= top_y)) {
return true;
}
else return false;
}
+1
View File
@@ -0,0 +1 @@
https://judge.yosupo.jp/problem/zalgorithm
+75
View File
@@ -0,0 +1,75 @@
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
// ----- TYPES -----
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
// ----- FILE IO -----
#define STDIN(filename) freopen(filename, "r", stdin)
#define STDOUT(filename) freopen(filename, "w", stdout)
#define FASTIO cin.tie(0)->sync_with_stdio(0)
#define STDIO(filename) FASTIO; string filenamee(filename); STDIN((filenamee + ".in").c_str()); STDOUT((filenamee + ".out").c_str())
#define NL '\n'
#define CM ", "
#define SP " "
// ----- FOR LOOPS -----
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FD(i,L,R) for (int i = L; i > R; i--)
#define FDE(i,L,R) for (int i = L; i >= R; i--)
// ----- WEZ -----
#define takeI(n) int n; cin >> n
#define takeII(n,m) int n, m; cin >> n >> m
#define takeIII(n,m,k) int n, m, k; cin >> n >> m >> k
#define takeL(n) ll n; cin >> n
#define takeS(s) string s; cin >> s
#define takeV(v,n) vi v(n); for (auto &x : v) cin >> x
#define takeVL(v,n) vector<ll> v(n); for (auto &x : v) cin >> x
#define whileZ takeI(T); while(T--)
//
// ----- MAX MIN -----
#define REMAX(a,b) (a)=max((a),(b))
#define REMIN(a,b) (a)=min((a),(b))
// ----- PAIRS -----
#define fi first
#define se second
// ----- OUTPUT -----
#define YESNO(b) cout << ((b) ? "YES" : "NO") << NL
// ----- DEBUG -----
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define DBG2(a,b) cerr << #a "=" << (a) << CM << #b "=" << (b) << endl
#define printA(a,L,R) FE(i,L,R) cerr << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,SZ(a)-1)
// ----- STL DS
#define ALL(c) (c).begin(),(c).end()
#define SZ(c) ((int)(c).size())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(ALL(c), greater<>())
#define UNIQ(c) SORT(c), (c).erase(unique(ALL(c)), (c).end())
#define pb push_back
int main() {
FASTIO;
takeS(s);
int n = s.size();
F(i,0,n) {
int val = 0;
F(j,0,s.size()-i) {
if (s[j] != s[j+i]) break;
++val;
}
cout << val << SP;
}
}
+1
View File
@@ -0,0 +1 @@
abcbcba
+1
View File
@@ -0,0 +1 @@
mississippi
+1
View File
@@ -0,0 +1 @@
ababacaca
+4
View File
@@ -0,0 +1,4 @@
aaaaa
View File