Vibe code scripts to edit and add usaco solutions

This commit is contained in:
2026-08-25 00:45:15 +01:00
parent a79ff12290
commit 6fd6d70b04
26 changed files with 1156 additions and 6 deletions
@@ -0,0 +1,68 @@
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
// ----- FILE IO -----
#define STDIN(filename) freopen(filename, "r", stdin)
#define STDOUT(filename) freopen(filename, "w", stdout)
#define NL '\n'
// ----- 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 whileZ takeI(T); while(T--)
// ----- VECTOR -----
// ----- MAX MIN -----
#define REMAX(a,b) (a)=max((a),(b))
#define REMIN(a,b) (a)=min((a),(b))
// ----- DEBUG -----
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define printA(a,L,R) FE(i,L,R) cerr << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
// ----- STL DS
#define ALL(c) (c).begin(),(c).end()
int main() {
STDIN("circlecross.in");
STDOUT("circlecross.out");
vector<pair<int,int>> C(26, pair<int,int>(-1, -1) );
F(i,0,52) {
char ch;
cin >> ch;
size_t idx = ch - 'A';
if (C[idx].first == -1) {
C[idx].first = i;
} else {
C[idx].second = i;
}
}
int res = 0;
F(i,0,25) {
F(j,i+1,26) {
auto a = C[i];
auto b = C[j];
if (b.first < a.first or b.first > a.second) {
if ( b.second > a.first and b.second < a.second) res++;
} else {
if ( b.second < a.first or b.second > a.second) res++;
}
}
}
cout << res;
}