# Codeforces Round #473 (Div. 2)

Source: Internet
Author: User
Tags printf
```/* B: Test instructions: Give a set of strings and the value of each string, give a string number that can replace the value with each other, and finally give a line of string, asking the minimum value of the string.

Sample one because Second and loser in the same group, so you can use the value of loser instead of second value, get the smallest total value.
Idea: Find the smallest value in each group that can be a string, so that the value of all strings in that group equals the minimum value.
*/#include <bits/stdc++.h> using namespace std;
#define INF 0x3f3f3f3f struct Node {string s;
int cost;
}CL;
int a;
Map<string,int> s;
int main () {Ios_base::sync_with_stdio (false);
Cin.tie (0);
Cout.tie (0);
int n,k,m;
cin>>n>>k>>m;
int mi;
for (int i = 0; i < n; i++) cin>>cl[i].s;
for (int i = 0; i < n; i++) {cin>>cl[i].cost;
S[CL[I].S] = Cl[i].cost;
} while (k--) {mi = inf;
int x, y;
cin>>x;
for (int i = 0; i < x; i++) {cin>>y;
A[i] = y-1;
mi = min (cl[a[i]].cost,mi);
} for (int i = 0; i < x; i++) {cl[a[i]].cost = mi;
S[CL[A[I]].S] = mi;       }} long long sum = 0;
while (m--) {string str;
cin>>str;
Sum + = S[str];
} cout<<sum<<endl;
return 0;
}```

```/* C Test instructions: slightly ... (see sample explanation) Idea: when n is less than or equal to 5 o'clock the solution is correct, more than 5 o'clock, put three nodes under 1, the rest is placed under 2 can be constructed with test instructions solution is different.
So that each node has only one child node can be constructed with the same title.
*/#include <bits/stdc++.h> using namespace std;
int main () {Ios_base::sync_with_stdio (false);
Cin.tie (0);
Cout.tie (0);
int n;
cin>>n;
if (n <= 5) {cout<< "-1" <<endl;
for (int i = 2; I <= n/2+1; i++) printf ("1%d\n", i);
for (int i = n/2+2; I <= n; i++) printf ("2%d\n", I);
} else {for (int i = 2; I <= n/2+1; i++) printf ("1%d\n", i);
for (int i = n/2+2; I <= n; i++) printf ("2%d\n", I);
if (n% 2 = = 0) {for (int i = 2; I <= n/2+1; i++) printf ("1%d\n", i);
for (int i = 2; i < n/2+1; i++) printf ("%d%d\n", I,I+N/2);
} else {for (int i = 2; I <= n/2+1; i++) printf ("1%d\n", i); For (int i = 2; I <= n/2+1;
i++) printf ("%d%d\n", I,I+N/2);
}} return 0;
}```
```/*
E
Test Instructions: Give a graph, the number of nodes of the graph is 1~n, each node
has an edge, the edge is two nodes of the number of XOR and, ask the
minimum spanning tree of this graph.
idea: For each node number x, find the minimum value in 1~x-1 and X,
this value should be the last digit in the X binary 1, for
example: to find x for the binary number 11100, should be found in the 1~11011, should be
It is 11000, and the result of the last XOR is 100, or 8. But the 10^12 of the title n is a
direct request for each number and the sum will time out. Then
we can hit the table to find out some of the values corresponding to the law.
you can see every 4 there is a 2, every 8 there is a 4, every
three to have a 8 ...
*/
#include <bits/stdc++.h>
using namespace std;
#define LL Long Long
LL lowbit (LL x)
{
return x & (-X);
}
int main ()
{
Ios_base::sync_with_stdio (false);
Cin.tie (0);
Cout.tie (0);
LL N;
LL x = 1;
LL sum = 0;
cin>>n;
n--;
/*for (LL i = 1; i < n; i++)
{
sum + = Lowbit (i);
Cout<<lowbit (i) <<endl;
} *
/while (n > 0)
{
//cout<<n<<endl;
cout<<x<<endl;
Sum + = ((n+1) >>1) *x;
x = x << 1;
n >>= 1;
}
cout<<sum<<endl;
return 0;
}
```

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.