Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?
Today I have studied the problem of finding the minimum spanning tree in a directed graph.
This problem is solved using the two Chinese algorithm (Chu-Liu / Edmonds' algorithm). You can read more about this algorithm in Russian using google translator in Oleg Davydov's blog A little about minimal spanning trees, in the ITMO wiki, here, AlgoCode Wiki. In English you can read in detail: Wikipedia, Tarjan's notes, Uri Zwick's detailed post.
I want to practice solving problems on this topic, but while searching I found very few problems.
Let's create a Codeforces sheet from tasks on this topic! Please help me with this! Share with the problem if you have solved on this topic.
Problems List:
Hi to everybody ! I am solving problem Next on e-olymp ( https://www.e-olymp.com/en/problems/686) and i have Memory limit verdict . I don't know ,how i can fix it.Please help me to fix .
/*
ID: computerbox --> Huseyn Hajiyev
LANG: C++
TASK: target_mode_on
*/
#include <bits/stdc++.h>
#define FAST_READ ios_base::sync_with_stdio(0);
#define ll long long
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define MAXN 2000
using namespace std;
ll n;
struct treap
{
ll key,priority;
treap *leftt,*rightt;
};
typedef treap* decart;
decart Tree,L,R;
ll ans;
void split(decart root,decart &L,decart &R,ll key)
{
if(root==nullptr)
{
R=L=nullptr;
return ;
}
if(root->key < key)
{
split(root->rightt,root->rightt,R,key);
L=root;
}
else
{
split(root->leftt,L,root->leftt,key);
R=root;
}
}
decart merge(decart leftt,decart rightt)
{
if(leftt==nullptr)return rightt;
else if(rightt==nullptr)return leftt;
if(leftt->priority > rightt->priority)
{
leftt->rightt=merge(leftt->rightt,rightt);
return leftt;
}
else
{
rightt->leftt=merge(rightt->leftt,leftt);
return rightt;
}
}
decart newNode(ll key)
{
decart temp=new treap;
temp->key=key;
temp->priority=rand();
temp->leftt=temp->rightt=nullptr;
return temp;
}
void insert(decart &root,decart vertex)
{
if(root==nullptr)
{
root=newNode(vertex->key);
return ;
}
if(root->priority > vertex->priority)
{
if(root->key > vertex->key)insert(root->leftt,vertex);
else insert(root->rightt,vertex);
}
split(root,vertex->leftt,vertex->rightt,vertex->key);
root=vertex;
}
ll getmin(decart root)
{
if(root==nullptr)return -1;
if(root->leftt==nullptr)return root->key;
return getmin(root->leftt);
}
void erase(decart &root,ll key)
{
if(root->key==key)merge(root->leftt,root->rightt);
else
{
if(root->key >key)erase(root->leftt,key);
else erase(root->rightt,key);
}
}
void query(ll x)
{
split(Tree,L,R,x);
ans=getmin(R);
cout<<ans<<endl;
Tree=merge(L,R);
}
int main(){
srand(time(NULL));
FAST_READ;
Tree=newNode(0LL);
cin>>n;
ll sig=0;
for(ll i=1;i<=n;i++)
{
char x;
ll y;
cin>>x>>y;
if(x=='+')
{
if(sig)y=(y+ans)%1000000000;
decart nuj=newNode(y);
insert(Tree,nuj);
sig=0;
}
else
{
sig=1;
query(y);
}
}
return 0;
}
Hi ! Let's discuss Croatian Open Competition in Informatics (COCI) Round 6 here . http://hsin.hr/coci/.
How to solve problem Sličice (Dynamic Programming or Greedy ) and Simfonija (Segment Tree ) ?
Name |
---|