Submission #696182

# Submission time Handle Problem Language Result Execution time Memory
696182 2023-02-05T17:40:51 Z amirhoseinfar1385 Measures (CEOI22_measures) C++17
59 / 100
179 ms 4196 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,m,d;
	cin>>n>>m>>d;
	if(n>0){
		vector<int>allm(n);
		for(int i=0;i<n;i++){
			cin>>allm[i];
		}
		for(int asd=0;asd<m;asd++){
			int ds;
			cin>>ds;
			allm.push_back(ds);
			sort(allm.begin(),allm.end());
		//	cout<<asd<<": \n";
		//	for(auto x:allm){
		//		cout<<x<<" ";
		//	}
		//	cout<<"\n";
			long double res=0;
			long double last=allm[0];
			cout<<setprecision(30);
			for(int i=1;i<(int)allm.size();i++){
				long double dp=last+d;
				if(dp>allm[i]){
					if(abs(dp-allm[i])>res){
						long double fz=abs(dp-allm[i])-res;
						res+=fz/2;
						last=allm[i]+res;
					}
					else{
						last=dp;
					}
				}
				else{
					last=max(dp,allm[i]-res);
				}
	//			cout<<res<<" ";
			}
			cout<<res<<" ";
		}	
		cout<<"\n";
		return 0;
	}
	vector<int>allm(m);
	for(int i=0;i<m;i++){
		cin>>allm[i];
	}
	sort(allm.begin(),allm.end());
	long double res=0;
	long double last=allm[0];
	cout<<setprecision(30)<<res<<" ";
	for(int i=1;i<m;i++){
		long double dp=last+d;
		if(dp>allm[i]){
			if(abs(dp-allm[i])>res){
				long double fz=abs(dp-allm[i])-res;
				res+=fz/2;
				last=allm[i]+res;
			}
			else{
				last=dp;
			}
		}
		else{
			last=max(dp,allm[i]-res);
		}
		cout<<res<<" ";
	}
	cout<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 352 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 352 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 124 ms 3788 KB Output is correct
10 Correct 167 ms 3776 KB Output is correct
11 Correct 70 ms 3780 KB Output is correct
12 Correct 179 ms 3768 KB Output is correct
13 Correct 59 ms 3348 KB Output is correct
14 Correct 111 ms 3780 KB Output is correct
15 Correct 109 ms 3144 KB Output is correct
16 Correct 72 ms 3776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 2144 KB Output is correct
2 Correct 165 ms 4008 KB Output is correct
3 Correct 158 ms 4004 KB Output is correct
4 Correct 102 ms 1888 KB Output is correct
5 Correct 144 ms 3096 KB Output is correct
6 Correct 116 ms 2212 KB Output is correct
7 Correct 150 ms 3276 KB Output is correct
8 Correct 119 ms 1896 KB Output is correct
9 Correct 156 ms 1864 KB Output is correct
10 Correct 166 ms 4196 KB Output is correct
11 Correct 122 ms 2704 KB Output is correct
12 Correct 161 ms 3628 KB Output is correct
13 Correct 135 ms 1928 KB Output is correct
14 Correct 154 ms 3776 KB Output is correct
15 Correct 152 ms 3660 KB Output is correct
16 Correct 131 ms 1808 KB Output is correct
17 Correct 142 ms 3172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 2144 KB Output is correct
2 Correct 165 ms 4008 KB Output is correct
3 Correct 158 ms 4004 KB Output is correct
4 Correct 102 ms 1888 KB Output is correct
5 Correct 144 ms 3096 KB Output is correct
6 Correct 116 ms 2212 KB Output is correct
7 Correct 150 ms 3276 KB Output is correct
8 Correct 119 ms 1896 KB Output is correct
9 Correct 156 ms 1864 KB Output is correct
10 Correct 166 ms 4196 KB Output is correct
11 Correct 122 ms 2704 KB Output is correct
12 Correct 161 ms 3628 KB Output is correct
13 Correct 135 ms 1928 KB Output is correct
14 Correct 154 ms 3776 KB Output is correct
15 Correct 152 ms 3660 KB Output is correct
16 Correct 131 ms 1808 KB Output is correct
17 Correct 142 ms 3172 KB Output is correct
18 Incorrect 127 ms 2452 KB Output isn't correct
19 Halted 0 ms 0 KB -