Skip to content

Commit

Permalink
Big change
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueimaginate committed Feb 23, 2021
1 parent 8fe0f2b commit e27f147
Show file tree
Hide file tree
Showing 274 changed files with 250 additions and 447 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"Local: 1080","url":"/Users/peter/Desktop/Study/Coding/BOJ/1080.cpp","tests":[{"id":1602423845311,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"/Users/peter/Desktop/Study/Coding/BOJ/1080.cpp","group":"local","local":true}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"Local: 11931","url":"/Users/peter/Desktop/Study/Coding/BOJ/11931.cpp","tests":[{"id":1602422484747,"input":"5\n1\n2\n3\n4\n5","output":"5\n4\n3\n2\n1"}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"/Users/peter/Desktop/Study/Coding/BOJ/11931.cpp","group":"local","local":true}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
140 changes: 70 additions & 70 deletions BOJ/14425.cpp → Archive/BOJ/14425.cpp
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
#include <bits/stdc++.h>

using namespace std;

const int ALPHABET = 26;
int toNumber(char ch){return ch - 'a';}

struct TrieNode{
TrieNode* children[ALPHABET];
bool terminal;

TrieNode() : terminal(false){
memset(children, 0, sizeof(children));
}

~TrieNode(){
for(int i=0; i<ALPHABET; ++i){
if(children[i])
delete children[i];
}
}

void insert(const char* key){
if(*key == 0){
terminal = true;
}
else{
int next = toNumber(*key);
if(children[next] == NULL){
children[next] = new TrieNode();
}
children[next]->insert(key + 1);
}

}

bool find(const char* key){
if(*key == 0) return terminal;
int next = toNumber(*key);
if(children[next] == NULL) return false;
return children[next]->find(key + 1);
}
};

int N,M;

int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> M;

TrieNode* node = new TrieNode();

for(int i=0; i<N; ++i){
char ch[500];
cin >> ch;
node->insert(ch);
}
int cnt = 0;
for(int i=0; i<M; ++i){
char ch[500];
cin >> ch;
if(node->find(ch)){
cnt++;
}
}

cout << cnt << '\n';
return 0;
#include <bits/stdc++.h>

using namespace std;

const int ALPHABET = 26;
int toNumber(char ch){return ch - 'a';}

struct TrieNode{
TrieNode* children[ALPHABET];
bool terminal;

TrieNode() : terminal(false){
memset(children, 0, sizeof(children));
}

~TrieNode(){
for(int i=0; i<ALPHABET; ++i){
if(children[i])
delete children[i];
}
}

void insert(const char* key){
if(*key == 0){
terminal = true;
}
else{
int next = toNumber(*key);
if(children[next] == NULL){
children[next] = new TrieNode();
}
children[next]->insert(key + 1);
}

}

bool find(const char* key){
if(*key == 0) return terminal;
int next = toNumber(*key);
if(children[next] == NULL) return false;
return children[next]->find(key + 1);
}
};

int N,M;

int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> M;

TrieNode* node = new TrieNode();

for(int i=0; i<N; ++i){
char ch[500];
cin >> ch;
node->insert(ch);
}
int cnt = 0;
for(int i=0; i<M; ++i){
char ch[500];
cin >> ch;
if(node->find(ch)){
cnt++;
}
}

cout << cnt << '\n';
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
88 changes: 44 additions & 44 deletions BOJ/1759.cpp → Archive/BOJ/1759.cpp
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

char arr[16];
char tmp[16];
int N,M;


void dfs(int start, int cnt){
if(cnt == N){
int vowelN = 0, consonant = 0;
for(int i=0; i<N; ++i){
if(tmp[i] == 'a' || tmp[i] == 'e' || tmp[i] == 'i' || tmp[i] == 'o' || tmp[i] == 'u') {
vowelN++;
}
}
consonant = N - vowelN;

if(vowelN >= 1 && consonant >= 2){
for(int i=0; i<N; ++i){
cout << tmp[i];
}
cout << endl;
}
return;
}

for(int i=start; i<M; ++i){
tmp[cnt] = arr[i];
dfs(i+1, cnt+1);
}
}

int main(){
cin >> N >> M;
for(int i=0; i<M; ++i){
cin >> arr[i];
}

sort(arr, arr+M);
dfs(0,0);

return 0;
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

char arr[16];
char tmp[16];
int N,M;


void dfs(int start, int cnt){
if(cnt == N){
int vowelN = 0, consonant = 0;
for(int i=0; i<N; ++i){
if(tmp[i] == 'a' || tmp[i] == 'e' || tmp[i] == 'i' || tmp[i] == 'o' || tmp[i] == 'u') {
vowelN++;
}
}
consonant = N - vowelN;

if(vowelN >= 1 && consonant >= 2){
for(int i=0; i<N; ++i){
cout << tmp[i];
}
cout << endl;
}
return;
}

for(int i=start; i<M; ++i){
tmp[cnt] = arr[i];
dfs(i+1, cnt+1);
}
}

int main(){
cin >> N >> M;
for(int i=0; i<M; ++i){
cin >> arr[i];
}

sort(arr, arr+M);
dfs(0,0);

return 0;
}
File renamed without changes.
60 changes: 30 additions & 30 deletions BOJ/1764.cpp → Archive/BOJ/1764.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

map<string, int> m;
map<string, int> result;
int N, M;

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;

while(N--){
string temp; cin >> temp;
m[temp] = 1;
}

while(M--){
string temp; cin >> temp;
if(m.find(temp) != m.end()){
result[temp] = 1;
}
}

cout << result.size() << endl;
for(auto i : result){
cout << i.first << endl;
}
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

map<string, int> m;
map<string, int> result;
int N, M;

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;

while(N--){
string temp; cin >> temp;
m[temp] = 1;
}

while(M--){
string temp; cin >> temp;
if(m.find(temp) != m.end()){
result[temp] = 1;
}
}

cout << result.size() << endl;
for(auto i : result){
cout << i.first << endl;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 33 additions & 33 deletions BOJ/18870.cpp → Archive/BOJ/18870.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int C;
vector<int> vec;
map<int, int> result;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> C;
for(int i=0; i<C; ++i){
int temp; cin >> temp;
vec.push_back(temp);
}
vector<int> copy(vec);

sort(vec.begin(), vec.end());

result[vec[0]] = 0;
int k = 1;
for(int i=1; i<C; ++i){
if(vec[i] == vec[i-1]) continue;
else{
result[vec[i]] = k++;
}
}

for(auto i : copy){
cout << result[i] << " ";
}
cout << endl;
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int C;
vector<int> vec;
map<int, int> result;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> C;
for(int i=0; i<C; ++i){
int temp; cin >> temp;
vec.push_back(temp);
}
vector<int> copy(vec);

sort(vec.begin(), vec.end());

result[vec[0]] = 0;
int k = 1;
for(int i=1; i<C; ++i){
if(vec[i] == vec[i-1]) continue;
else{
result[vec[i]] = k++;
}
}

for(auto i : copy){
cout << result[i] << " ";
}
cout << endl;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions Archive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Preparing Coding Test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e27f147

Please sign in to comment.