diff --git a/src/CSP-S2023/CSP-S.pdf b/src/CSP-S2023/CSP-S.pdf new file mode 100644 index 0000000..6162316 Binary files /dev/null and b/src/CSP-S2023/CSP-S.pdf differ diff --git a/src/CSP-S2023/lock/lock.cpp b/src/CSP-S2023/lock/lock.cpp new file mode 100644 index 0000000..4c101f4 --- /dev/null +++ b/src/CSP-S2023/lock/lock.cpp @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using ll = long long; +using ull = unsigned long long; +const ll max_num = 6; +short n, arr[max_num]; +std::set> ans_set; + +template +std::ostream &operator<<(std::ostream &os, const std::array &s){ + os<<"array [ "; + if(!s.empty()){ + auto now_it = s.begin(); + const auto rbegin = s.rbegin(); + while(*now_it!=*rbegin){ + os<<*now_it<<", "; + ++now_it; + } + os<<*rbegin<<" ]"; + }else{ + os<<"}"; + } + return os; +} + +template +std::ostream &operator<<(std::ostream &os, const std::set &s){ + os<<"set { "; + if(!s.empty()){ + auto now_it = s.begin(); + const auto rbegin = s.rbegin(); + while(*now_it!=*rbegin){ + os<<*now_it<<", "; + ++now_it; + } + os<<*rbegin<<" }"; + }else{ + os<<"}"; + } + return os; +} + +#ifdef ONLINE_JUDGE +#define DEBUG(code) +#else +#define DEBUG(code)code +#endif + +ll arr_to_ll(const ll *const arr){ + ll ret{}; + for(ll i{1};i<=5;i++){ + DEBUG(std::cout<>n; + for(ll i{1};i<=n;i++){ + for(ll j{1};j<=5;j++){ + std::cin>>arr[j]; + } + std::set> tmp_set; + for(ll j{1};j<=5;j++){ + for(ll k{1};k<=9;k++){ + std::array new_arr{}; + memcpy(new_arr.begin(), arr, sizeof(arr)); + new_arr[j] = (new_arr[j] + k) % 10; + DEBUG( + for(ll i{1};i<=5;i++){ + std::cout< new_arr{}; + memcpy(new_arr.begin(), arr, sizeof(arr)); + new_arr[j] = (new_arr[j] + k) % 10; + new_arr[j+1] = (new_arr[j+1] + k) % 10; + DEBUG( + for(ll i{1};i<=5;i++){ + std::cout<> new_ans_set; + if(i!=1){ + std::set_intersection(ans_set.begin(), ans_set.end(), tmp_set.begin(), tmp_set.end(), std::inserter(new_ans_set, new_ans_set.end())); + }else{ + new_ans_set = std::move(tmp_set); + } + ans_set = std::move(new_ans_set); + DEBUG(std::cout<