Another Training Contest

酱油 posted @ Sat, 08 Aug 2015 13:17:47 +0800 in OI life with tags NOIP 2015 Training Contest , 975 readers

Aug. 8th, 2015

An NOIP2015 Training Contest Prepared by hhw && mxh1999
A very tough contest, right?

Time: 8:00 a.m. ~ 11:30 a.m.

Number of Prob.s: 3

Result:

I didn't know why I became the last contestant... T_T

A car starts with velocity v1 and ends with velocity v2. The car can change its velocity immediately in the area of ±d. There is t that shows total time the car spends on the road.
Then what's the longest distance can the car travel?
Input: 
v1 v2
t d
Output:
S(indicating the longest distance)
Sample Input:
5 6
4 2
Sample Output:
26
Explanations:
5+7+8+6=26
(+2 +1 -2)
For all 20 testcases: 1<=v1,v2<=100; 2<=t<=100; 0<=d<=10; It is confirmed that there is only one fixed answer for each of the testcases.

 

Prob. A was considered as "a bottle of purified water", but I didn't get 100 pts.. In fact I had never realized that until I got the result. Why, only 60 pts.?

After comparing my program with Mars_cat's, I was perfectly shocked! I just made a mistake in searching for the answer, which led to missing of 40 pts. because of WA.

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#define DONS 1010
using namespace std;
int v1,v2,t,d,i,j,sum,f[DONS],g[DONS];
int main()
{
	freopen("trip.in","r",stdin);freopen("trip.out","w",stdout);
	scanf("%d%d%d%d",&v1,&v2,&t,&d);
	for(i=1;i<=t;i++){f[i]=v1+(i-1)*d;g[i]=v2+(t-i)*d;}
	for(i=1;i<=t;i++)if(f[i]-g[i]==0 || (f[i+1]-g[i+1])*(v1-v2)<0)break;
	for(j=1;j<=t;j++)sum+=min(f[j],g[j]);/*Mistake: for(j=1;j<=i;j++)sum+=f[j];for(j=i+1;j<=t;j++)sum+=g[j];*/
	printf("%d\n",sum);
	fclose(stdin);fclose(stdout);return 0;
}

Wondering why I was wrong? Here is an example: (trip8.in)

2 1

2 2

When testing my first version of code, I got WA because my output was 6. But, obviously, the standard answer is 3.

Carelessness led to failure? Now I am sure about that...

 

Prob. B & Prob. C were difficult. Waiting for discussion to solve.

 

I am always a WEAK DISH, so I haven't correct the other two programs into std's yet.

Just like my Chinese nickname, participating in the unscientific contest is exactly "getting a bottle of Soy Sauce".

(Comments are welcomed and it is recommended that you reply in English.)

 

Avatar_small
enable cookies chrom said:
Fri, 12 Apr 2019 17:32:29 +0800

How do I use cookies or chrome in chrome? enable cookies chrome You can learn to go here and see it in a very simple way.

Avatar_small
enable cookies chrom said:
Sat, 29 Jun 2019 16:15:46 +0800

How do I use cookies or chrome in chrome? enable cookies chrome You can learn to go here and see it in a very simple way.

Avatar_small
Anshika said:
Sat, 20 Mar 2021 13:25:34 +0800
A very awesome blog post. We are really grateful for your blog post. Delhi Escorts Delhi Escorts Service Escorts in Delhi Escorts Service in Delhi Delhi EscortYou will find a lot of approaches after visiting your post.
Avatar_small
Delhi Escorts said:
Tue, 18 May 2021 18:52:52 +0800

I simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blog.

Avatar_small
Delhi Escorts said:
Sat, 10 Jul 2021 01:50:52 +0800

The Hot and sexy Girls are here to give all sorts of fun and enjoyment here.

Avatar_small
Saket Escorts said:
Sat, 10 Jul 2021 16:59:34 +0800

I read this article. I think You put a lot of effort to create this article. I appreciate your work.

Avatar_small
Delhi Escorts said:
Sat, 17 Jul 2021 14:50:36 +0800

The Girls here will give all sorts of fun.

Avatar_small
Chennai Escorts said:
Mon, 04 Oct 2021 19:56:25 +0800

This site gives a brilliant and informative message to us.

Avatar_small
Escorts in Aerocity said:
Wed, 04 May 2022 20:08:13 +0800

I am interested in such topics so I will address page where it is cool described https://6243ef2e8c96c.site123.me/

Avatar_small
Female Escorts said:
Wed, 04 May 2022 20:10:13 +0800

This is such a great web page with such wonderful content. 6243ef2e8c96c.site123.me/Guys to make your day I have the best link here

Avatar_small
Click Here said:
Wed, 04 May 2022 20:13:33 +0800

Hi, This is a High-Profile VIP Independent girl To Your lusty Desires with a curvy and juicy body, To visit me just click on the link.

Avatar_small
Swedish Massage Serv said:
Wed, 04 May 2022 20:14:34 +0800

Tremendous, Nice post and the content is very well with simplicity so may everyone read and get it easily.

Avatar_small
Escorts in Goa said:
Wed, 04 May 2022 20:15:37 +0800

Fantastic post on this web page but luckly, I am here for those people who want Escorts who may fulfill their sexual desires. To take advantage visit the link.

Avatar_small
Goa Call Girls said:
Wed, 04 May 2022 20:17:16 +0800

This post has really great knowledge with getable words, I appreciate the person who worked on it, Keep it continue, To get something Extraordinary click on the link.

Avatar_small
Russian Escorts in A said:
Wed, 04 May 2022 20:18:58 +0800

Nice post, Amazing content you have written here, I personally liked it, Great work and i personally shared it with my friend.

Avatar_small
Escort Service in De said:
Wed, 04 May 2022 20:20:52 +0800

Hey guys, There is something Extra and far better even you didn't think about it, To check just click on the link.

Avatar_small
Escort Service in De said:
Wed, 04 May 2022 20:21:45 +0800

wow, This is such an informative and unique page but guys I have also something unique links.

Avatar_small
BSNL Bill View said:
Tue, 09 Aug 2022 19:42:47 +0800

You can view, download, and print the present or old duplicate bills, but bill downloading for BSNL landline or broadband restricted to 12 months usage or six issued telephone bills. BSNL Bill View Nowadays many customers can do BSNL bill payment at quick pay portal on getting SMS to their mobiles, where sometimes the customer wants the copy for which also paid. At that time they are not having due to some common reasons, It is like, misplaced the BSNL bill copy or didn’t get the invoice through post or courier.

Avatar_small
MBOSE Model Paper Cl said:
Thu, 25 Aug 2022 18:42:18 +0800

Meghalaya Board Model Paper 2023 Class 8 Pdf Download with Answers for Bengali Medium, English Medium, Hindi Medium, Urdu Medium & Students for Small Answers, Long Answer, Very Long Answer Questions, and Essay Type MBOSE Model Paper Class 8 Questions to Term1 & Term2 Exams at official website. New Exam Scheme or Question Pattern for Sammittive Assignment Exams (SA1 & SA2): Very Long Answer (VLA), Long Answer (LA), Small Answer (SA), Very Small Answer (VSA), Single Answer, Multiple Choice and etc.

Avatar_small
Electronic City Esco said:
Sat, 17 Dec 2022 13:18:44 +0800

It is truly superb, unintentionally, to look at the information with this handle.

Avatar_small
Majestic Escorts Ser said:
Sat, 17 Dec 2022 13:19:06 +0800

I'm perseveringly looking on the web for stories that can oblige me. There is obviously a substitute to sort out this.

Avatar_small
things to do said:
Thu, 13 Apr 2023 18:31:42 +0800

What are the best things to do near me in Quebec, - one of the most famous cities of Canada?

Avatar_small
other social media p said:
Thu, 11 May 2023 20:40:37 +0800

YouTube views can also be impacted by external factors, such as changes to the platform's algorithm or shifts in popular culture.

Avatar_small
How Does Purified Wa said:
Tue, 16 May 2023 20:36:44 +0800

Limescale build-up restricts the flow of steam and reduces the heat-transferring ability in these appliances. This also increases energy usage and can cause them to fail prematurely. It is far easier to prevent limescale build up than it is to remove it. The easiest way to prevent it being to substitute purified water for tapwater in all appliances that have tanks.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter