diff --git a/ABC451/cnvxlns/A.cpp b/ABC451/cnvxlns/A.cpp new file mode 100644 index 0000000..34778c0 --- /dev/null +++ b/ABC451/cnvxlns/A.cpp @@ -0,0 +1,48 @@ +#include + +#define int long long +#define endl "\n" + +using namespace std; +using vi = vector; +using vvi = vector; +using pii = pair; +using tiii = tuple; +using vpii = vector; + +const int inf = 4e18; +const int MOD = 1e9 + 9; + +vpii drc = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; + +pii operator+(pii A, pii B){ + return {A.first + B.first, A.second + B.second}; +} +pii operator-(pii A, pii B){ + return {A.first - B.first, A.second - B.second}; +} + +void init(){ + +} + +void solve(){ + string s; + cin >> s; + if(s.size() % 5 == 0){ + cout << "Yes" << endl; + }else{ + cout << "No" <sync_with_stdio(0); + init(); + int t = 1; + // cin >> t; + while(t--) + solve(); + + return 0; +} diff --git a/ABC451/cnvxlns/A.py b/ABC451/cnvxlns/A.py new file mode 100644 index 0000000..07376c6 --- /dev/null +++ b/ABC451/cnvxlns/A.py @@ -0,0 +1,36 @@ +import sys +import math +import heapq +from collections import deque, defaultdict, Counter +from itertools import permutations, combinations, product +from bisect import bisect_left, bisect_right + +sys.setrecursionlimit(int(1e6)) +inf = math.inf +input = sys.stdin.readline + +MOD = 1e9 + 7 + +drc = [(-1, 0), (0, 1), (1, 0), (0, -1)] + +def init(): + + return + +def solve(): + s = input() + print(len(s)) + if len(s) % 5 == 0: + print("Yes") + else: + print("No") + return + +if __name__ == "__main__": + init() + t = 1 + # t = int(input()) + while t: + t -= 1 + solve() + \ No newline at end of file diff --git a/ABC451/cnvxlns/B.cpp b/ABC451/cnvxlns/B.cpp new file mode 100644 index 0000000..5f58551 --- /dev/null +++ b/ABC451/cnvxlns/B.cpp @@ -0,0 +1,53 @@ +#include + +#define int long long +#define endl "\n" + +using namespace std; +using vi = vector; +using vvi = vector; +using pii = pair; +using tiii = tuple; +using vpii = vector; + +const int inf = 4e18; +const int MOD = 1e9 + 9; + +vpii drc = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; + +pii operator+(pii A, pii B){ + return {A.first + B.first, A.second + B.second}; +} +pii operator-(pii A, pii B){ + return {A.first - B.first, A.second - B.second}; +} + +void init(){ + +} + +void solve(){ + int N, M; + cin >> N >> M; + vi A(N), B(N); + vi members1(M + 1, 0), members2(M + 1, 0); + for(auto i = 0; i < N; ++i){ + cin >> A[i] >> B[i]; + members1[A[i]]++; + members2[B[i]]++; + } + for(auto i = 1; i <= M; ++i){ + cout << members2[i] - members1[i] << endl; + } +} + +int32_t main(){ + cin.tie(0)->sync_with_stdio(0); + init(); + int t = 1; + // cin >> t; + while(t--) + solve(); + + return 0; +} diff --git a/ABC451/cnvxlns/C.cpp b/ABC451/cnvxlns/C.cpp new file mode 100644 index 0000000..a91146b --- /dev/null +++ b/ABC451/cnvxlns/C.cpp @@ -0,0 +1,54 @@ +#include + +#define int long long +#define endl "\n" + +using namespace std; +using vi = vector; +using vvi = vector; +using pii = pair; +using tiii = tuple; +using vpii = vector; + +const int inf = 4e18; +const int MOD = 1e9 + 9; + +vpii drc = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; + +pii operator+(pii A, pii B){ + return {A.first + B.first, A.second + B.second}; +} +pii operator-(pii A, pii B){ + return {A.first - B.first, A.second - B.second}; +} + +void init(){ + +} + +void solve(){ + int Q; + cin >> Q; + multiset ms; + while(Q--){ + int q, h; + cin >> q >> h; + if(q == 1){ + ms.insert(h); + }else{ + ms.erase(ms.begin(), ms.upper_bound(h)); + } + cout << ms.size() << endl; + } +} + +int32_t main(){ + cin.tie(0)->sync_with_stdio(0); + init(); + int t = 1; + // cin >> t; + while(t--) + solve(); + + return 0; +} diff --git a/ABC451/cnvxlns/D.cpp b/ABC451/cnvxlns/D.cpp new file mode 100644 index 0000000..2729604 --- /dev/null +++ b/ABC451/cnvxlns/D.cpp @@ -0,0 +1,89 @@ +#include + +#define int long long +#define endl "\n" + +using namespace std; +using vi = vector; +using vvi = vector; +using pii = pair; +using tiii = tuple; +using vpii = vector; + +const int inf = 4e18; +const int MOD = 1e9 + 9; + +vpii drc = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; + +pii operator+(pii A, pii B){ + return {A.first + B.first, A.second + B.second}; +} +pii operator-(pii A, pii B){ + return {A.first - B.first, A.second - B.second}; +} + +vector pieces; +set ans; + +string inttostr(int num){ + string ret = ""; + while(num > 0){ + char n = (num % 10) + '0'; + ret += n; + } + return ret; +} + +int stringtoint(string num){ + int ret = 0; + for(auto i: num){ + ret *= 10; + ret += i - '0'; + } + return ret; +} + +void dfs(string val){ + if(val.size() > 10){ + return ; + } + ans.insert(stringtoint(val)); + for(const auto &i: pieces){ + dfs(val + i); + } +} + +void init(){ + for(auto i = 1; i <= (1 << 29); i *= 2){ + if(i == 128){ + continue; + } + pieces.push_back(inttostr(i)); + } + for(auto i: pieces){ + dfs(i); + } +} + +void solve(){ + int N; + cin >> N; + int cnt = 0; + for(auto i: ans){ + if(cnt++ > N){ + cout << i << endl; + return ; + } + } +} + +int32_t main(){ + cin.tie(0)->sync_with_stdio(0); + init(); + int t = 1; + // cin >> t; + while(t--) + solve(); + + return 0; +} diff --git a/ABC451/cnvxlns/D_AC.cpp b/ABC451/cnvxlns/D_AC.cpp new file mode 100644 index 0000000..1008acf --- /dev/null +++ b/ABC451/cnvxlns/D_AC.cpp @@ -0,0 +1,75 @@ +#include + +#define int long long +#define endl "\n" + +using namespace std; +using vi = vector; +using vvi = vector; +using pii = pair; +using tiii = tuple; +using vpii = vector; + +const int inf = 4e18; +const int MOD = 1e9 + 9; + +vpii drc = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; + +pii operator+(pii A, pii B){ + return {A.first + B.first, A.second + B.second}; +} +pii operator-(pii A, pii B){ + return {A.first - B.first, A.second - B.second}; +} + +vector pieces; +set ans; + +void dfs(string val){ + ans.insert(stoll(val)); + + for(const auto &i: pieces){ + if(stoll(val + i) > 1e9){ + continue; + } + dfs(val + i); + } +} + +void init(){ + for(auto i = 1; i <= (1 << 29); i *= 2){ + if(i == 128){ + continue; + } + pieces.push_back(to_string(i)); + } + for(auto i: pieces){ + dfs(i); + } +} + +void solve(){ + int N; + cin >> N; + int cnt = 0; + + for(auto i: ans){ + if(cnt == N - 1){ + cout << i << endl; + return ; + } + cnt++; + } +} + +int32_t main(){ + cin.tie(0)->sync_with_stdio(0); + init(); + + int t = 1; + // cin >> t; + while(t--) + solve(); + + return 0; +} \ No newline at end of file