Submission #397504

# Submission time Handle Problem Language Result Execution time Memory
397504 2021-05-02T10:03:46 Z Iwanttobreakfree Tuna (COCI17_tuna) C++
50 / 50
1 ms 296 KB
#include <iostream>
using namespace std;
int main(){
	long long int n,x,p1,p2,p3,dif,sum=0;
	cin>>n>>x;
	while(n--){
		cin>>p1>>p2;
		dif=p2-p1;
		p3=max(p2,p1);
		if(dif<0)dif*=-1;
		if(dif>x)cin>>p3;
		sum+=p3;
	}
	cout<<sum;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 276 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 296 KB Output is correct