Another Training Contest

酱油 posted @ Sat, 08 Aug 2015 13:17:47 +0800 in OI life with tags NOIP 2015 Training Contest , 320 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


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?
v1 v2
t d
S(indicating the longest distance)
Sample Input:
5 6
4 2
Sample Output:
(+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()
	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];*/
	fclose(stdin);fclose(stdout);return 0;

Wondering why I was wrong? Here is an example: (

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.)


Login *

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