52102023-04-22 18:01:41SleepyOverlordGladiátorok (40 pont)cpp17Elfogadva 40/4074ms28476 KiB
#include <vector>
#include <string> 
#include <set> 
#include <map> 
#include <unordered_set>
#include <unordered_map>
#include <queue> 
#include <bitset> 
#include <stack>
#include <list>

#include <numeric> 
#include <algorithm> 
#include <random>
#include <chrono>

#include <cstdio>
#include <fstream>
#include <iostream> 
#include <sstream> 
#include <iomanip>
#include <climits>

#include <cctype>
#include <cmath> 
#include <ctime>
#include <cassert>

using namespace std;

#define ULL unsigned long long
#define LL long long
#define PII pair <int, int>
#define VB vector <bool>
#define VI vector <int>
#define VLL vector <LL>
#define VD vector <double>
#define VS vector <string>
#define VPII vector <pair <int, int> >
#define VVI vector < VI >
#define VVB vector < VB >
#define SI set < int >
#define USI unordered_set <int>
#define MII map <int, int>
#define UMII unordered_map <int, int>
#define MS multiset
#define US unordered_set
#define UM unordered_map
#define UMS unordered_multiset
#define UMM unordered_multimap

#define FORN(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)

#define SZ size()
#define BG begin() 
#define EN end() 
#define CL clear()
#define X first
#define Y second
#define RS resize
#define PB push_back
#define MP make_pair
#define ALL(x) x.begin(), x.end()
#define INS insert
#define ER erase
#define CNT count

int n, q;
VPII a;
VLL prefMax;

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	cin >> n >> q;
	a.RS(n + 1);
	prefMax.RS(n + 1);

	FOR(i, 1, n) cin >> a[i].X >> a[i].Y;
	sort(a.BG + 1, a.EN);
	LL sum = 0;
	FOR(i, 1, n)
	{
		prefMax[i] = max(prefMax[i - 1], a[i].X - sum);
		sum += a[i].Y;
	}
	FOR(i, 1, q)
	{
		int x;
		cin >> x;
		cout << upper_bound(ALL(prefMax), x) - prefMax.BG - 1 << " ";
	}

	return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/40
1Elfogadva0/03ms1896 KiB
2Elfogadva0/014ms3308 KiB
3Elfogadva2/23ms2692 KiB
4Elfogadva2/23ms2916 KiB
5Elfogadva2/24ms3300 KiB
6Elfogadva2/24ms3580 KiB
7Elfogadva2/24ms3872 KiB
8Elfogadva2/24ms3996 KiB
9Elfogadva2/24ms4024 KiB
10Elfogadva2/24ms4100 KiB
11Elfogadva2/212ms5184 KiB
12Elfogadva2/252ms9296 KiB
13Elfogadva2/248ms9288 KiB
14Elfogadva2/274ms13468 KiB
15Elfogadva2/272ms15988 KiB
16Elfogadva2/272ms18656 KiB
17Elfogadva2/272ms20872 KiB
18Elfogadva2/254ms22292 KiB
19Elfogadva2/254ms23900 KiB
20Elfogadva2/254ms25316 KiB
21Elfogadva2/257ms26880 KiB
22Elfogadva2/257ms28476 KiB