Codeforces Round #478 (Div. 2) ABC

A. Aramic script

In Aramic language words can only represent objects.

Words in Aramic have special properties:

  • A word is a root if it does not contain the same letter more than once.
  • root and all its permutations represent the same object.
  • The root xx of a word yy is the word that contains all letters that appear in yy in a way that each letter appears once. For example, the rootof "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
  • Any word in Aramic represents the same object as its root.

You have an ancient script in Aramic. What is the number of different objects mentioned in the script?

Input

The first line contains one integer nn (1n1031≤n≤103) — the number of words in the script.

The second line contains nn words s1,s2,,sns1,s2,…,sn — the script itself. The length of each string does not exceed 103103.

It is guaranteed that all characters of the strings are small latin letters.

Output

Output one integer — the number of different objects mentioned in the given ancient Aramic script.

Examples
input
Copy
5
a aa aaa ab abb
output
Copy
2
input
Copy
3
amer arem mrea
output
Copy
1
Note

In the first test, there are two objects mentioned. The roots that represent them are "a","ab".

In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".

 

 查找有多少个root,英语渣渣的我看了好久才看到,ab,ba 是一个单词,它的原根是ab,求原根的话是将一个单词重复的字符去掉,比如aaabbb的原根是ab,因为只出现a字符和b字符。懂意思就好做了。

 1 #include <bits/stdc++.h>
 2 #define ll long long
 3 using namespace std;
 4 const int N = 1010;
 5 set<int> st;
 6 string s;
 7 int n;
 8 int main() {
 9     cin >> n;
10     int ans = 0;
11     for(int i = 0; i < n; i ++) {
12         cin >> s;
13         int cnt = 0;
14         for(int j = 0; j < s.length(); j ++) {
15             cnt |= (1<<(s[j]-'a'));
16         }
17         st.insert(cnt);
18     }
19     cout << st.size() << endl;
20     return 0;
21 }

 

B. Mancala

Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.

Initially, each hole has aiai stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next holes in a counter-clockwise direction.

Note that the counter-clockwise order means if the player takes the stones from hole ii, he will put one stone in the (i+1)(i+1)-th hole, then in the (i+2)(i+2)-th, etc. If he puts a stone in the 1414-th hole, the next one will be put in the first hole.

After the move, the player collects all the stones from holes that contain even number of stones. The number of stones collected by player is the score, according to Resli.

Resli is a famous Mancala player. He wants to know the maximum score he can obtain after one move.

Input

The only line contains 14 integers a1,a2,,a14a1,a2,…,a14 (0ai1090≤ai≤109) — the number of stones in each hole.

It is guaranteed that for any ii (1i141≤i≤14) aiai is either zero or odd, and there is at least one stone in the board.

Output

Output one integer, the maximum possible score after one move.

Examples
input
Copy
0 1 1 0 0 0 0 0 0 7 0 0 0 0
output
Copy
4
input
Copy
5 1 1 1 1 0 0 0 0 0 0 0 0 0
output
Copy
8
Note

In the first test case the board after the move from the hole with 77 stones will look like 1 2 2 0 0 0 0 0 0 0 1 1 1 1. Then the player collects the even numbers and ends up with a score equal to 44.

 

 模拟,14个洞,从第i个洞取出全部石头,然后在第i+1上放一个,第i+2上放一个,循环直到全部放完,然后把14个洞里偶数的数相加,求最大值。

 1 #include <bits/stdc++.h>
 2 #define ll long long
 3 using namespace std;
 4 const int N = 110;
 5 ll a[15], b[15];
 6 void init() {
 7     for(int i = 0; i < 14; i ++) b[i] = a[i];
 8 }
 9 int main() {
10     for(int i = 0; i < 14; i ++) {
11         cin >> a[i];
12     }
13     ll MAX = 0;
14     for(int i = 0; i < 14; i ++) {
15         init();
16         ll x = b[i];
17         b[i] = 0;
18         for(int j = 0; j < 14; j ++) {
19             b[j] += x/14;
20         }
21         x = x%14;
22         for(int j = 0; j < x; j ++) {
23             b[(i+j+1)%14] ++;
24         }
25         ll cnt = 0;
26         for(int j = 0; j < 14; j ++) {
27             if(b[j]%2==0) cnt += b[j];
28         }
29         MAX = max(MAX, cnt);
30     }
31     // for(int i = 0; i < 14; i ++) printf("%lld ",b[i]);printf("\n");
32     cout << MAX << endl;
33     return 0;
34 }

C. Valhalla Siege

Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.

Ivar has nn warriors, he places them on a straight line in front of the main gate, in a way that the ii-th warrior stands right after (i1)(i−1)-th warrior. The first warrior leads the attack.

Each attacker can take up to aiai arrows before he falls to the ground, where aiai is the ii-th warrior's strength.

Lagertha orders her warriors to shoot kiki arrows during the ii-th minute, the arrows one by one hit the first still standing warrior. After all Ivar's warriors fall and all the currently flying arrows fly by, Thor smashes his hammer and all Ivar's warriors get their previous strengths back and stand up to fight again. In other words, if all warriors die in minute tt, they will all be standing to fight at the end of minute tt.

The battle will last for qq minutes, after each minute you should tell Ivar what is the number of his standing warriors.

Input

The first line contains two integers nn and qq (1n,q2000001≤n,q≤200000) — the number of warriors and the number of minutes in the battle.

The second line contains nn integers a1,a2,,ana1,a2,…,an (1ai1091≤ai≤109) that represent the warriors' strengths.

The third line contains qq integers k1,k2,,kqk1,k2,…,kq (1ki10141≤ki≤1014), the ii-th of them represents Lagertha's order at the ii-th minute: kiki arrows will attack the warriors.

Output

Output qq lines, the ii-th of them is the number of standing warriors after the ii-th minute.

Examples
input
Copy
5 5
1 2 1 2 1
3 10 1 1 1
output
Copy
3
5
4
4
3
input
Copy
4 4
1 2 3 4
9 1 10 6
output
Copy
1
4
4
1
Note

In the first example:

  • after the 1-st minute, the 1-st and 2-nd warriors die.
  • after the 2-nd minute all warriors die (and all arrows left over are wasted), then they will be revived thus answer is 5 — all warriors are alive.
  • after the 3-rd minute, the 1-st warrior dies.
  • after the 4-th minute, the 2-nd warrior takes a hit and his strength decreases by 1.
  • after the 5-th minute, the 2-nd warrior dies.

二分查找。

有n个战士,每个战士都有个值ai,表示需要射ai只箭才死,从第一个战士开始射,全部死后就会全部复活。

每射k只箭,求还活着的战士。

 1 #include <bits/stdc++.h>
 2 #define ll long long
 3 using namespace std;
 4 const int N = 2e5+10;
 5 ll a[N], n, q, sum[N];
 6 int main() {
 7     cin >> n >> q >> a[0];
 8     for(int i = 1; i < n; i ++) {
 9         cin >> a[i];
10         a[i] += a[i-1];
11     }
12     ll id = 0, ans = 0;
13     while(q--) {
14         ll k;
15         cin >> k;
16         ans += k;
17         id = upper_bound(a,a+n,ans)-a;
18         if(id == n) id = 0, ans = 0;
19         cout << n - id << endl;
20     }
21     return 0;
22 }

 

转载于:https://www.cnblogs.com/xingkongyihao/p/9031761.html

内容概要:本文详细介绍了扫描单分子定位显微镜(scanSMLM)技术及其在三维超分辨体积成像中的应用。scanSMLM通过电调透镜(ETL)实现快速轴向扫描,结合4f检测系统将不同焦平面的荧光信号聚焦到固定成像面,从而实现快速、大视场的三维超分辨成像。文章不仅涵盖了系统硬件的设计与实现,还提供了详细的软件代码实现,包括ETL控制、3D样本模拟、体积扫描、单分子定位、3D重建和分子聚类分析等功能。此外,文章还比较了循环扫描与常规扫描模式,展示了前者在光漂白效应上的优势,并通过荧光珠校准、肌动蛋白丝、线粒体网络和流感A病毒血凝素(HA)蛋白聚类的三维成像实验,验证了系统的性能和应用潜力。最后,文章深入探讨了HA蛋白聚类与病毒感染的关系,模拟了24小时内HA聚类的动态变化,提供了从分子到细胞尺度的多尺度分析能力。 适合人群:具备生物学、物理学或工程学背景,对超分辨显微成像技术感兴趣的科研人员,尤其是从事细胞生物学、病毒学或光学成像研究的科学家和技术人员。 使用场景及目标:①理解和掌握scanSMLM技术的工作原理及其在三维超分辨成像中的应用;②学习如何通过Python代码实现完整的scanSMLM系统,包括硬件控制、图像采集、3D重建和数据分析;③应用于单分子水平研究细胞内结构和动态过程,如病毒入侵机制、蛋白质聚类等。 其他说明:本文提供的代码不仅实现了scanSMLM系统的完整工作流程,还涵盖了多种超分辨成像技术的模拟和比较,如STED、GSDIM等。此外,文章还强调了系统在硬件改动小、成像速度快等方面的优势,为研究人员提供了从理论到实践的全面指导。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值