Compare commits
3 Commits
be454e4420
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bc1489d320 | |||
| cfb65a4c2d | |||
| 8f0ec6cead |
7
run.py
7
run.py
@@ -644,12 +644,10 @@ def run(lang: str, testcase: tuple[str, ...], verbose: bool):
|
|||||||
f_in_path = f"{TC_DIR}/{tc}.in"
|
f_in_path = f"{TC_DIR}/{tc}.in"
|
||||||
f_out_path = f"{TC_DIR}/{tc}.out"
|
f_out_path = f"{TC_DIR}/{tc}.out"
|
||||||
|
|
||||||
with (
|
with open(f_out_path, "r", encoding="utf-8") as f_out:
|
||||||
open(f_in_path, "r", encoding="utf-8") as f_in,
|
|
||||||
open(f_out_path, "r", encoding="utf-8") as f_out,
|
|
||||||
):
|
|
||||||
expected = f_out.read().strip()
|
expected = f_out.read().strip()
|
||||||
|
|
||||||
|
f_in = open(f_in_path, "r", encoding="utf-8")
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
target_language.executable_command,
|
target_language.executable_command,
|
||||||
stdin=f_in,
|
stdin=f_in,
|
||||||
@@ -663,6 +661,7 @@ def run(lang: str, testcase: tuple[str, ...], verbose: bool):
|
|||||||
print(line, end="")
|
print(line, end="")
|
||||||
|
|
||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
|
f_in.close()
|
||||||
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
click.secho(">>>>>> [RUN TIME ERROR] >>>>>>", fg="red", bold=True)
|
click.secho(">>>>>> [RUN TIME ERROR] >>>>>>", fg="red", bold=True)
|
||||||
|
|||||||
13
storage/jungol/rs/completed/1000.rs
Normal file
13
storage/jungol/rs/completed/1000.rs
Normal 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);
|
||||||
|
}
|
||||||
113
storage/ojuz/cpp/completed/KAISTRUN26SPRING_A.cpp
Normal file
113
storage/ojuz/cpp/completed/KAISTRUN26SPRING_A.cpp
Normal 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user