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
+73
View File
@@ -0,0 +1,73 @@
#include <algorithm>
#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--)
//
// ----- 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("taming.in");
STDOUT("taming.out");
takeI(n);
vector<int> logs(n);
F(i,0,n) cin >> logs[i];
if (logs[0] > 0) {
cout << -1 << endl;
return 0;
}
logs[0] = 0;
int countdown = -1, min_breakouts = 0, max_breakouts = 0;
FDE(i,n-1,0) {
if (countdown >= 0 and logs[i] >= 0 and logs[i] != countdown) {
cout << -1 << endl;
return 0;
}
if (logs[i] >= 0) {
countdown = logs[i];
}
if (countdown <= 0) {
max_breakouts++;
}
if (countdown == 0) {
min_breakouts++;
}
countdown--;
}
cout << min_breakouts << ' ' << max_breakouts << endl;
}
+2
View File
@@ -0,0 +1,2 @@
4
-1 -1 -1 1