Compare commits

..

21 Commits

Author SHA1 Message Date
bc1489d320 complete ojuz/KAISTRUN26SPRING_A.cpp 2026-05-08 15:57:19 +09:00
cfb65a4c2d complete jungol/1000.rs 2026-05-06 18:19:34 +09:00
8f0ec6cead hotfix run.py run 2026-05-06 18:11:19 +09:00
be454e4420 Merge branch 'dev' 2026-05-06 18:00:46 +09:00
b4dff1d344 fix StorageManager save, read expression and operation
fix create
fix export; not remove src space
2026-05-06 03:02:05 +09:00
b3cd28471e fix export command to clear space state 2026-05-06 02:53:30 +09:00
b15648a17c fix StateManager to save the state 2026-05-06 02:51:41 +09:00
bfb79e573d fix create 2026-05-06 02:40:41 +09:00
34eac82c7a refactoring stage 8
- minor refactoring
- version
- status
2026-05-06 02:36:37 +09:00
d4aaefa130 refactoring stage 7
- implement StorageManager list_entries
- fix show
- fix find
- fix some minor
2026-05-06 02:22:28 +09:00
7706721eb1 refactoring stage 6
- enhance state command
- enhance init
2026-05-06 00:57:45 +09:00
df8fb68a1d refactoring stage 5
- fix export command
2026-05-05 20:04:07 +09:00
97f1636c57 refactoring stage 4
- modify StateManager to accept Language
- fix load command
- modify create command
2026-05-05 17:42:51 +09:00
843f2ef321 refactoring stage 3
- run command
2026-05-05 15:22:53 +09:00
3e69d7713e rename aloha feat 2026-05-04 15:03:11 +09:00
d1720c1567 rename invalid name in contest 2026-05-04 15:01:08 +09:00
d6777983a1 migrate small contest 2026-05-04 14:59:37 +09:00
cac746a69c add 2026-kaist-run-spring 2026-05-03 18:45:47 +09:00
63ecdae57b refactoring stage 2 2026-05-03 12:40:23 +09:00
21d51e4af9 refactoring stage 1
- add StorageManager StateManager
- use pathlib

Co-authored-by: Copilot <copilot@github.com>
2026-05-03 01:09:31 +09:00
b9a8ea6bad update run.py inorder to ensure there is folder to store file 2026-05-02 07:59:08 +09:00
41 changed files with 1062 additions and 989 deletions

1706
run.py

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,103 @@
#include <algorithm>
#include <iostream>
#include <vector>
#define let auto
#define fn auto
#define usize size_t
using namespace std;
#define UD 1'000'000
fn fastio() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
fn main() -> int {
fastio();
usize n, m;
cin >> n >> m;
let arr = new usize[5 * m];
let music = new usize[n];
let cnts = new usize[n];
for (usize i = 0; i < n; i++) {
music[i] = UD;
cnts[i] = 0;
}
for (usize i = 0; i < m; i++) {
for (usize j = 0; j < 4; j++) {
cin >> arr[5 * i + j];// idx
arr[5 * i + j] -= 1;
cnts[arr[5 * i + j]]++;
}
cin >> arr[5 * i + 4];
}
let cntv = vector<pair<usize, usize>>();
for (usize i = 0; i < n; i++) {
cntv.push_back(pair(cnts[i], i));
}
sort(cntv.begin(), cntv.end());
reverse(cntv.begin(), cntv.end());
usize tot = 0;
usize before = 0;
for (let it = cntv.begin(); it < cntv.end(); it++) {
if (tot > 3 * m) {
music[before] = UD;
break;
} else if (tot == 3 * m) {
break;
}
else {
tot += it->first;
music[it->second] = 0;
before = it->second;
}
}
for (usize i = 0; i < m; i++) {
let x = arr[5 * i + 0];
let y = arr[5 * i + 1];
let z = arr[5 * i + 2];
let w = arr[5 * i + 3];
let k = arr[5 * i + 4];
let mx = music[x];
let my = music[y];
let mz = music[z];
let mw = music[w];
let key = (mx % 4 + my % 4 + mz % 4 + mw % 4) % 4;
if ((mx + my + mz + mw) / UD == 1) {
if (mx == UD) {
music[x] = (k + 4 - key) % 4;
} else if (my == UD) {
music[y] = (k + 4 - key) % 4;
} else if (mz == UD) {
music[z] = (k + 4 - key) % 4;
} else {
music[w] = (k + 4 - key) % 4;
}
}
}
for (usize i = 0; i < n; i++) {
if (music[i] == UD) {
music[i] = 0;
}
}
for (usize i = 0; i < n; i++) {
cout << music[i] << " ";
}
delete[] arr;
delete[] music;
delete[] cnts;
return 0;
}

View File

@@ -0,0 +1,36 @@
#include <algorithm>
#include <iostream>
#include <vector>
#define let auto
#define fn auto
#define usize size_t
using namespace std;
fn fastio() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
fn main() -> int {
fastio();
usize r, u, n;
cin >> r >> u >> n;
usize cnt = r * u;
if (n <= 10) {
usize fibn = 2;
usize fibns1 = 1;
usize fibns2 = 1;
for (usize i = 3; i < n; i++) {
fibns2 = fibns1;
fibns1 = fibn;
fibn = fibns2 + fibns1;
}
usize delta = ((u - 1) * fibns1 + (r - 1) * fibns2);
cout << delta / fibns1 + delta / fibns2 - (delta / (fibns1 * fibns2)) + 1 << endl;
} else {
cout << cnt << endl;
}
}

View File

@@ -0,0 +1,80 @@
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#define let auto
#define fn auto
#define usize size_t
#define UMAX 0xfffffff
using namespace std;
fn fastio() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
struct Fire {
usize f;
usize v;
};
fn main() -> int {
fastio();
let _comp = [](Fire &a, const Fire &b) { return a.f < b.f; };
usize n, m;
cin >> n >> m;
let fs = vector<Fire>(n);
let bs = vector<usize>(m);
for (usize i = 0; i < n; i++) {
cin >> fs[i].f;
cin >> fs[i].v;
}
sort(fs.begin(), fs.end(), _comp);
for (usize i = 0; i < m; i++) {
cin >> bs[i];
}
// 1pass
usize last = UMAX;
let vfx = vector<usize>();
for (usize i = 0; i < m; i++) {
let t = bs[i];
Fire tf = {
.f = t,
.v = 0,
};
}
if (last == UMAX) {
last = m;
}
// 2pass
sort(vfx.begin(), vfx.end());
let heap = priority_queue<usize>();
usize total_v = 0;
while (vfx.size() > 0) {
let key = *(vfx.end() - 1);
vfx.pop_back();
while (fs.size() > 0 && (fs.end() - 1)->f >= key) {
heap.push((fs.end() - 1)->v);
fs.pop_back();
}
total_v += heap.top();
heap.pop();
}
cout << last << " " << total_v << endl;
}

View File

@@ -0,0 +1,13 @@
use std::io::{read_to_string, stdin};
fn main() {
let temp = read_to_string(stdin()).unwrap();
let mut iter = temp
.split_ascii_whitespace()
.map(|x| x.parse::<usize>().unwrap());
let a = iter.next().unwrap();
let b = iter.next().unwrap();
println!("{}", a + b);
}

View File

@@ -0,0 +1,113 @@
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdint>
#define let auto
#define fn auto
#define usize size_t
using u32 = uint32_t;
using namespace std;
const u32 KX = 123456789;
const u32 KY = 362436069;
const u32 KZ = 521288629;
const u32 KW = 88675123;
fn fastio() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
struct Rand {
u32 x, y, z, w;
static Rand new_seed(u32 seed) {
return {KX ^ seed, KY ^ seed, KZ, KW};
}
u32 rand() {
u32 t = x ^ (x << 11);
x = y;
y = z;
z = w;
w ^= (w >> 19) ^ t ^ (t >> 8);
return w;
}
template<typename T>
void shuffle(vector<T>& a) {
if (a.empty()) return;
usize i = a.size() - 1;
while (i > 0) {
usize j = rand() % (i + 1);
swap(a[i], a[j]);
i--;
}
}
u32 rand_range(u32 a, u32 b) {
u32 m = b - a + 1;
return a + rand() % m;
}
double rand_float() {
return static_cast<double>(rand()) / static_cast<double>((u32)-1);
}
};
fn main() -> int {
fastio();
istreambuf_iterator<char> it(cin), end;
string temp(it, end);
vector<u32> vals;
usize pos = 0;
while (pos < temp.size()) {
while (pos < temp.size() && isspace(temp[pos])) pos++;
if (pos >= temp.size()) break;
usize start = pos;
while (pos < temp.size() && !isspace(temp[pos])) pos++;
vals.push_back(stoul(temp.substr(start, pos - start)));
}
auto it2 = vals.begin();
u32 n = *it2++;
u32 m = *it2++;
vector<tuple<u32, u32, u32, u32, u32>> requests;
for (u32 i = 0; i < m; i++) {
u32 w = *it2++ - 1;
u32 x = *it2++ - 1;
u32 y = *it2++ - 1;
u32 z = *it2++ - 1;
u32 k = *it2++;
requests.emplace_back(w, x, y, z, k);
}
u32 trial = 0;
while (true) {
Rand rand = Rand::new_seed(trial);
vector<u32> music(n);
for (u32 i = 0; i < n; i++) {
music[i] = rand.rand_range(0, 3);
}
u32 cnt = 0;
for (const auto& req : requests) {
u32 w, x, y, z, k;
tie(w, x, y, z, k) = req;
if ((music[w] + music[x] + music[y] + music[z]) % 4 == k) {
cnt++;
}
}
if (m / 4 <= cnt) {
for (u32 a : music) {
cout << a << ' ';
}
break;
}
trial++;
}
return 0;
}