Submission #2097116


Source Code Expand

// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数(Greatest Common Divisor)
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数(Least Common Multiple)
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	cin >> N;
	VP AB;
	LL ans = 0;
	FOR(i, 0, N) {
		LL a, b;
		cin >> a >> b;
		AB.push_back(MP(a, b));
	}
	sort(AB.begin(), AB.end());
	FOR(i, 0, AB.size()) {
		if (i == 0) {
			ans += AB[i].first;
		}
		else {
			ans += AB[i].first - AB[i - 1].first;
			if (i == AB.size() - 1) {
				ans += AB[i].second;
			}
		}
	}
	O(ans);

	return 0;
}

Submission Info

Submission Time
Task B - Different Distribution
User conchan_akita
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2772 Byte
Status WA
Exec Time 29 ms
Memory 2420 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 21
WA × 2
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 29 ms 2420 KB
02.txt AC 28 ms 2420 KB
03.txt AC 29 ms 2420 KB
04.txt AC 28 ms 2420 KB
05.txt AC 29 ms 2420 KB
06.txt AC 29 ms 2420 KB
07.txt AC 28 ms 2420 KB
08.txt AC 29 ms 2420 KB
09.txt AC 28 ms 2420 KB
10.txt AC 29 ms 2420 KB
11.txt AC 24 ms 2420 KB
12.txt AC 27 ms 2420 KB
13.txt AC 27 ms 2420 KB
14.txt AC 28 ms 2420 KB
15.txt WA 1 ms 256 KB
16.txt AC 1 ms 256 KB
17.txt WA 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