Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions ABC451/cnvxlns/A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include<bits/stdc++.h>

#define int long long
#define endl "\n"

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vpii = vector<pii>;

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" <<endl;
}
}

int32_t main(){
cin.tie(0)->sync_with_stdio(0);
init();
int t = 1;
// cin >> t;
while(t--)
solve();

return 0;
}
36 changes: 36 additions & 0 deletions ABC451/cnvxlns/A.py
Original file line number Diff line number Diff line change
@@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input을 input = lambda: sys.stdin.readline().rstrip("\n") 으로 해주면 편하고
MOD도 1e9+7 하면 float 타입일거라 10**9+7로 써야합니다

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input에 rstrip포함은 꿀팁이네요


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()

53 changes: 53 additions & 0 deletions ABC451/cnvxlns/B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include<bits/stdc++.h>

#define int long long
#define endl "\n"

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vpii = vector<pii>;

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;
}
54 changes: 54 additions & 0 deletions ABC451/cnvxlns/C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include<bits/stdc++.h>

#define int long long
#define endl "\n"

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vpii = vector<pii>;

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<int> 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;
}
89 changes: 89 additions & 0 deletions ABC451/cnvxlns/D.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include<bits/stdc++.h>

#define int long long
#define endl "\n"

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vpii = vector<pii>;

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<string> pieces;
set<int> 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;
}
75 changes: 75 additions & 0 deletions ABC451/cnvxlns/D_AC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include<bits/stdc++.h>

#define int long long
#define endl "\n"

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vpii = vector<pii>;

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<string> pieces;
set<int> 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;
}