Submission #1455831


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

const int maxn = 500009;
struct point{
	double v, t;
} u, q[maxn];
int n, L, l = 1, r;
double X, Y;

int main(){
	scanf("%d%d", &n, &L);
	for (int i=1; i<=n; i++){
		scanf("%lf%lf", &u.t, &u.v);
		X += u.v; Y += u.v*u.t;
		while (L < X){
			if (X-L >= q[l].v){ Y -= q[l].v * q[l].t; X -= q[l++].v; }
			else { Y -= q[l].t*(X-L); q[l].v -= X-L; X = L; }
		}
		printf("%.8lf\n", Y/X);
		while (l <= r && q[r].t >= u.t){
			u.t = (q[r].t*q[r].v + u.t*u.v) / (q[r].v+u.v);
			u.v += q[r--].v;
		}
		q[++r] = u;
	}
	return 0;
}

Submission Info

Submission Time
Task F - Dam
User Cyanic
Language C++14 (GCC 5.4.1)
Score 900
Code Size 595 Byte
Status AC
Exec Time 679 ms
Memory 17280 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:12:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &L);
                       ^
./Main.cpp:14:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf%lf", &u.t, &u.v);
                              ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 900 / 900
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00-00.txt, 00-01.txt, 00-02.txt
All 00-00.txt, 00-01.txt, 00-02.txt, 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt
Case Name Status Exec Time Memory
00-00.txt AC 1 ms 256 KB
00-01.txt AC 1 ms 256 KB
00-02.txt AC 1 ms 256 KB
01-00.txt AC 663 ms 16512 KB
01-01.txt AC 679 ms 9600 KB
01-02.txt AC 656 ms 16768 KB
01-03.txt AC 654 ms 13184 KB
01-04.txt AC 677 ms 9344 KB
01-05.txt AC 665 ms 16512 KB
01-06.txt AC 679 ms 9472 KB
01-07.txt AC 663 ms 17024 KB
01-08.txt AC 653 ms 13184 KB
01-09.txt AC 673 ms 9344 KB
01-10.txt AC 619 ms 17280 KB
01-11.txt AC 616 ms 17280 KB
01-12.txt AC 625 ms 17280 KB
01-13.txt AC 625 ms 17280 KB