Love丶FFC's Blog
为了用事实说明挖掘机技术到底哪家强,PAT 组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。
输入在第 1 行给出不超过 105 的正整数 N,即参赛人数。随后 N 行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从 1 开始连续编号)、及其比赛成绩(百分制),中间以空格分隔。
在一行中给出总得分最高的学校的编号、及其总分,中间以空格分隔。题目保证答案唯一,没有并列。
6
3 65
2 80
1 100
2 70
3 40
3 0
2 150
1.思考题目,会发现学校编号和列表下标可以有一一对应的关系,这样就不必每次都判断该编号是否出现过
2.使用动态扩展列表的方法,每当学校编号大于列表长度时,就根据差值扩展列表
3.输入的时候直接将Score赋给Number下标-1的元素即可
也许因为Python性能的缘故,最后一个测试点超时,在网上查阅了很多代码,依然无法解决,最后选择使用C来解决超时问题
NOP = int(input()) School = list() for i in range(NOP): Number, Score = map(int, input().split()) if Number >= len(School) + 1: # 学校编号大于当前列表长度,注意学校编号-1=列表下标 for j in range(Number - len(School)): # 根据学校编号与列表长度的差值动态扩展列表,例如出现了编号4,此时列表长度为2,就需要扩展4-2=2个长度 School.append(0) School[Number - 1] += Score else: School[Number - 1] += Score # 因为题目明确了答案唯一,所以利用max方法找出列表的最大值,再利用index方法找出最大值对应的下标,该下标+1就是学校编号 print(School.index(max(School)) + 1, max(School))
#include <stdio.h> int main() { int School[100000]; for (int i=0;i < 100000;i++) { School[i] = 0; } int NOP; scanf("%d", & NOP); for (int i=0;i < NOP;i++) { int Number; int Score; scanf("%d %d", & Number, & Score); School[Number-1] += Score; } int Max=0; int MaxID; for (int i=0;i < 100000;i++) { if (School[i] > Max) { Max = School[i]; MaxID = i; } } printf("%d %d", MaxID+1, Max); return 0; }
Abupguele
FDA Living with Fibromyalgia, Drugs Approved to Manage Pain, Medical Guide for Nonsteroidal Anti Inflammatory Drugs NSAIDS cialis 5mg online 1 fat calories derived from soy oil
Outlils
propecia hair growth Tamoxifen daily dose and duration of treatment
cheap louis vuitton bags
I just wanted to thank you for the fast service. or it may be they look great. I received them a day earlier than expected. similar to I will definitely continue to buy from this site. blue jays I will recommend this site to my friends. Thanks!
cheap louis vuitton bags https://www.bestlouisvuittonoutlet.com/
authentic cheap jordans
I just wanted to thank you for the fast service. or else they look great. I received them a day earlier than expected. for example the I will definitely continue to buy from this site. in any event I will recommend this site to my friends. Thanks!
authentic cheap jordans https://www.realjordansretro.com/
cheap jordans online
I just wanted to thank you for the fast service. and they look great. I received them a day earlier than expected. enjoy the I will definitely continue to buy from this site. an invaluable I will recommend this site to my friends. Thanks!
cheap jordans online https://www.cheaprealjordan.com/
cheap louis vuitton handbags
Read reviews and was a little hesitant since I had already inputted my order. or even a but thank god, I had no issues. like received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
cheap louis vuitton handbags https://www.cheaplouisvuittonsale.com/
louis vuitton outlet
Read reviews and was a little hesitant since I had already inputted my order. or even but thank god, I had no issues. decline received item in a timely matter, they are in new condition. you ultimately choose so happy I made the purchase. Will be definitely be purchasing again.
louis vuitton outlet https://www.louisvuittonsoutletstore.com/
cheap real jordans
Read reviews and was a little hesitant since I had already inputted my order. or perhaps a but thank god, I had no issues. significantly received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
cheap real jordans https://www.cheapretrojordan.com/
louis vuitton outlet online
Read reviews and was a little hesitant since I had already inputted my order. to but thank god, I had no issues. such received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
louis vuitton outlet online https://www.louisvuittonsoutletonline.com/
aol slot lounge play free slots
online slots that pay real money free slots just for fun casino slots free games aol slot lounge play free slots
online gambling for real money
free signup bonus no deposit casino free bonus
no deposit casino online casino with free signup bonus real money usa no
deposit online gambling for real money
invoimi
best over the counter viagra Membr Cell Biol
online casino free signup bonus no deposit required
online casino with free signup bonus real money usa free welcome bonus no
deposit required free casinos bonus online casino free signup bonus no deposit required
free no deposit casino
online real money casino bonus no deposit play blackjack online money free no deposit casino
sign up casino bonus
best online casino welcome bonus top online casino biggest
online casino bonus sign up casino bonus
bovada online casino
us online casinos online casino free spins real
money casinos bovada online casino
online casinos for us players
best online casino real money free no deposit online casino signup bonus no deposit online casinos for us players
no deposit casino online
best no deposit bonus best online casino welcome bonus casino welcome bonuses no deposit casino online
casino free bonus
real money online casino win real money online casino games for real money casino free bonus
best online casino welcome bonuses
best online usa casinos real casino games online no deposit casino bonus best online casino welcome bonuses
no deposit slots for real money
casino sign up bonus no deposit online casino best bonus best usa
online casinos no deposit slots for real money
invoimi
13, 292, 392 Again, it is important to mention that advanced and or metastatic disease places patients at an increased risk of TE propecia dosage 2015 Jul; 2 4 199 205
https://cse.google.com.et/url?q=https://www.topraybansoutlet.com/
|There are hundreds of thousands of hair accessory possibilities. You can choose from lots of options, including headbands, scrunchies, bows, barrettes and extensions. Include various hair accessories for practical and aesthetic purposes. The right hair accessory can set off an entire outfit. When you are going out on the town, choose a headband that compliments your outfit.
https://cse.google.com.mm/url?sa=i&url=https://www.topuggbootsoutlet.com/
|An easy way to keep hair off your neck and shoulders is to do a casual up-do. Long hair can sometimes be a hassle. If you have no time to spend with your hair, get an elastic hairband and pull your hair up into a bun. Even if it is a little messy, it will look cute.
JosephKip
zestoretic cost
Davidevelf
clindamycin 600 mg
CurtisHed
malegra 100 for sale uk
CurtisHed
how to get vardenafil without a prescription
MaryLit
600 mg motrin
IyVfJLRX
After a median follow up of 30 months, the median OS of the entire cohort was 42 months acheter levitra en connexion November 2016 saw the official opening of Liverpool2, an extension to the port that allows post Panamax vessels to dock in Liverpool
Elwoodexcix
atenolol 25 mg tablet price in india
jordan outlet
An interesting dialogue is price comment. I believe that you should write extra on this subject, it won’t be a taboo topic but typically individuals are not enough to talk on such topics. To the next. Cheers
SueLit
buy cheap metformin online
off white outlet
Nice post. I be taught one thing tougher on totally different blogs everyday. It’ll all the time be stimulating to learn content from other writers and apply a little something from their store. I抎 want to make use of some with the content on my blog whether you don抰 mind. Natually I抣l provide you with a link on your web blog. Thanks for sharing.
off white jordan 1
An fascinating discussion is price comment. I think that it is best to write more on this topic, it might not be a taboo topic however typically individuals are not enough to talk on such topics. To the next. Cheers
jordan
This really answered my problem, thank you!
Davidevelf
ventolin australia price
golden goose
An interesting discussion is worth comment. I think that it is best to write more on this subject, it may not be a taboo subject but generally persons are not enough to talk on such topics. To the next. Cheers
JosephKip
xenical online pharmacy
jordan shoes
The following time I read a weblog, I hope that it doesnt disappoint me as a lot as this one. I imply, I know it was my option to read, but I actually thought youd have something attention-grabbing to say. All I hear is a bunch of whining about one thing that you may fix when you werent too busy on the lookout for attention.
bape hoodie
An impressive share, I simply given this onto a colleague who was doing slightly analysis on this. And he in fact bought me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying extra on this topic. If possible, as you turn out to be experience, would you mind updating your blog with more particulars? It’s highly useful for me. Large thumb up for this weblog put up!
kobe shoes
Oh my goodness! a tremendous article dude. Thank you Nonetheless I’m experiencing issue with ur rss . Don抰 know why Unable to subscribe to it. Is there anybody getting similar rss drawback? Anyone who is aware of kindly respond. Thnkx
supreme official
You made some respectable factors there. I regarded on the web for the difficulty and found most people will associate with with your website.
goyard tote bag
I am often to blogging and i actually appreciate your content. The article has actually peaks my interest. I’m going to bookmark your site and keep checking for brand spanking new information.
yeezy 700
After study a few of the weblog posts on your web site now, and I really like your way of blogging. I bookmarked it to my bookmark website listing and can be checking back soon. Pls take a look at my web site as well and let me know what you think.
Williamjotly
where to get atenolol
Elwoodexcix
rx cialis canada
Williamjotly
buy diflucan 1
Elwoodexcix
bupropion buy online india
pMKqud
Definitions and assessment cialis for daily use
AlanLit
cymbalta 20 mg price
AlanLit
baclofen over the counter usa
SueLit
buy robaxin australia
SamLit
cost of generic lipitor in canada
Williamjotly
phenergan tablets over the counter
SamuelEcors
zithromax canada
JoeLit
robaxin 500mg generic
JackLit
cialis 10 mg tablets
Michaelsmopy
how much is generic lipitor
DavisIgnip
cialis 2.5 mg daily
SamuelEcors
lipitor 10mg price comparison
MaryLit
levaquin cipro
AshLit
allopurinol online
Elwoodexcix
generic cymbalta best price
JoeLit
robaxin medicine
EyeLit
prednisolone buy usa
AlanLit
phenergan with codeine cough syrup
SamLit
zithromax z-pak
Michaelsmopy
prednisolone 20mg
Elwoodexcix
generic atenolol price
MaryLit
uk pharmacy no prescription
JackLit
atarax 10mg buy online
MaryLit
triamterene capsule
MaryLit
online pharmacy pain
SamuelEcors
triamterene 25 mg capsule
SamLit
baclofen cream 60 mg
MaryLit
cost of metformin 500mg
DavisIgnip
metformin 500mg tablets cost
DarrylBox
atenolol 5mg tablet
SamuelEcors
tenormin uk
SamuelEcors
levaquin 750 mg
MaryLit
order generic tadalafil
Michaelsmopy
atarax discount
ZakLit
buy tamaxophen
Richardatone
cymbalta 80 mg
Williamjotly
atarax weight loss
Michaelsmopy
cymbalta prescription cost
IvyLit
lipitor canada price
Davidevelf
dexamethasone tablets uk
SamLit
online pharmacy without scripts
CurtisHed
cialis prescription prices
AshLit
valtrex where to buy canada
AlanLit
buy cheap cymbalta
IvyLit
buy dexamethasone australia
Michaelsmopy
prazosin anxiety
Williamjotly
baclofen uk price
Michaelsmopy
atenolol 12.5
DavisIgnip
60 lisinopril cost
DarrylBox
purchase prednisone no prescription
SamuelEcors
phenergan online pharmacy
IvyLit
propranolol pill 30 mg
SamuelEcors
buy bactrim online australia
SueLit
inderal 10 mg cost
CurtisHed
plavix 37.5 mg
AlanLit
synthoid
ZakLit
prednisone for dogs
SamLit
hydroxychloroquine antiviral
Elwoodexcix
buy phenergan 25mg online
Elwoodexcix
tizanidine generic price
SueLit
strattera 40
IvyLit
clopidogrel tablet price
SamuelEcors
where can i get lisinopril
SueLit
prednisone over the counter uk
SamLit
strattera 18 mg
JackLit
plavix 75 mg tablet price
JackLit
zestril 20 mg price canadian pharmacy
Richardatone
prednisone 2 mg
DarrylBox
diflucan 750 mg
AlanLit
buy generic phenergan
Elwoodexcix
can i purchase phenergan over the counter
JosephKip
augmentin 125 mg
AshLit
plavix 75 mg price canada
SamuelEcors
lyrica 500
MaryLit
keflex 3597
IvyLit
buy diflucan online without prescription
DarrylBox
where to get diflucan over the counter
AlanLit
amoxil price australia
IvyLit
prednisone 10
ZakLit
phenergan canada
EyeLit
phenergan on line
Davidevelf
plavix pill price
Davidevelf
strattera prices south africa
SueLit
retino
Michaelsmopy
diflucan 150 tab
Michaelsmopy
suhagra 100 price
DarrylBox
amoxicillin medicine price in india
Davidevelf
plaquenil generic coupon
DarrylBox
flomax canada pharmacy
SamuelEcors
prednisone 50 mg price
SamuelEcors
buy diflucan online south africa
Elwoodexcix
flomax back pain
MaryLit
diflucan 200 mg price
Elwoodexcix
strattera 25 mg generic
JosephKip
generic plavix available in usa
DavisIgnip
where can you buy diflucan over the counter
DavisIgnip
lyrica price in mexico
Michaelsmopy
buy suhagra tablet
JackLit
synthroid 175 mcg coupon
ZakLit
lisinopril 40 mg daily