Submission #4009649


Source Code Expand

//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

/*ll gcd(ll a, ll b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}*/

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int main () {
	int n;
	cin >> n;
	vector<pair<int, int>> p;
	int a, b;
	rep (i, n) {
		cin >> a >> b;
		p.emplace_back (a, b);
	}
	sort (all (p));
	int ans = p[0].first ;
	rep (i, n-1) {
		ans += p[i + 1].first - p[i].first;
	}
	ans += p[n - 1].second - 0;
	cout << ans << endl;
}

Submission Info

Submission Time
Task B - Different Distribution
User mickey_1024
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1303 Byte
Status AC
Exec Time 98 ms
Memory 1400 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 23
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 86 ms 1400 KB
02.txt AC 86 ms 1400 KB
03.txt AC 86 ms 1400 KB
04.txt AC 87 ms 1400 KB
05.txt AC 86 ms 1400 KB
06.txt AC 87 ms 1400 KB
07.txt AC 98 ms 1400 KB
08.txt AC 86 ms 1400 KB
09.txt AC 86 ms 1400 KB
10.txt AC 86 ms 1400 KB
11.txt AC 63 ms 1400 KB
12.txt AC 75 ms 1400 KB
13.txt AC 75 ms 1400 KB
14.txt AC 87 ms 1400 KB
15.txt AC 1 ms 256 KB
16.txt AC 1 ms 256 KB
17.txt AC 1 ms 256 KB
18.txt AC 1 ms 256 KB
19.txt AC 1 ms 256 KB
20.txt AC 1 ms 256 KB
s1.txt AC 1 ms 256 KB
s2.txt AC 1 ms 256 KB
s3.txt AC 1 ms 256 KB