Contest Duration: - (local time) (100 minutes) Back to Home

Submission #6059353

Source Code Expand

Copy
```// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#include <bits/stdc++.h>

using namespace std;

#define BOOST 			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ALL(a) 			(a).begin(), (a).end()
#define SZ(a) 			(int)(a).size()
#define FOR(a, b, c) 	for (int a = (b); a <  (c); a++)
#define FORR(a, b, c) 	for (int a = (b); a >= (c); a--)
#define TRAV(a, b) 		for (auto& a : b)
#define ELO 			exit(0)
#define SORT(a)         sort(ALL(a))
#define REV(a)          reverse(ALL(a))
#define SORTR(a)        SORT(a), REV(a)
#define PB              push_back
using ll = 				long long;
using ld = 				long double; // 'long double' is 2.2 times slower than double
using pii = 			pair<int, int>;
using pll = 			pair<ll, ll>;
using vi = 				vector<int>;
using vll = 			vector<ll>;
using vpii = 			vector<pii>;
using vpll = 			vector<pll>;

template <class T> inline bool setmin(T& a, T b) {if (a > b) return a = b, 1; return 0; }
template <class T> inline bool setmax(T& a, T b) {if (a < b) return a = b, 1; return 0; }

namespace fastio {
template <class T> istream &operator>>(istream &os, vector<T> & vec){for (auto &u : vec)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> & vec){for (auto &u : vec)os << u << " ";return os;}
template<class T1, class T2> inline istream& operator>>(istream& os, pair<T1, T2>& p) { return os >> p.first >> p.second; }
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << p.first << " " << p.second; }
template <class T> ostream &operator<<(ostream &os, set<T> & con) { for (auto &u : con) os << u << " "; return os; }

void re() {}
template <typename T, typename... args> void re(T& x, args&... tail) { cin >> x; re(tail...); }
void pr() {}
template <typename T, typename... args> void pr(T x, args... tail) { cout << x << " "; pr(tail...);}
template <typename... args> void prln(args... tail) { pr(tail...); cout << "\n";}
}
using namespace fastio;

namespace debug {
template < typename _T > inline void _debug(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _debug(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _debug(s + 1, a...); }

#if 1
#define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
#define cerr cout
#else
#define debug(...) 1999
#define cerr if(0) cout
#endif
}
using namespace debug;

//////////////_________CODE_________//////////////

constexpr int MOD = 1e9 + 7; // 998244353
constexpr int INF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;

int main() {
BOOST;
int n; re(n);
vpii tab(n); re(tab);
sort(ALL(tab), [&](pii const& a, pii const& b) {
if(a.second != b.second) {
return a.second < b.second;
}
return a.first < b.first;
});

int ob = 0;
TRAV(i, tab) {
ob += i.first;
if(ob > i.second) {
prln("No");
ELO;
}
}

prln("Yes");
ELO;
}```

#### Submission Info

Submission Time 2019-06-22 21:13:40+0900 D - Megalomania DomiKo C++14 (GCC 5.4.1) 400 3304 Byte AC 51 ms 1792 KB

#### Judge Result

Score / Max Score 0 / 0 400 / 400
Status
 AC × 3
 AC × 32
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sub1_01.txt AC 1 ms 256 KB
sub1_02.txt AC 50 ms 1792 KB
sub1_03.txt AC 19 ms 896 KB
sub1_04.txt AC 49 ms 1792 KB
sub1_05.txt AC 1 ms 256 KB
sub1_06.txt AC 1 ms 256 KB
sub1_07.txt AC 48 ms 1792 KB
sub1_08.txt AC 48 ms 1792 KB
sub1_09.txt AC 1 ms 256 KB
sub1_10.txt AC 50 ms 1792 KB
sub1_11.txt AC 49 ms 1792 KB
sub1_12.txt AC 2 ms 256 KB
sub1_13.txt AC 2 ms 256 KB
sub1_14.txt AC 29 ms 1152 KB
sub1_15.txt AC 8 ms 512 KB
sub1_16.txt AC 51 ms 1792 KB
sub1_17.txt AC 6 ms 384 KB
sub1_18.txt AC 6 ms 384 KB
sub1_19.txt AC 2 ms 256 KB
sub1_20.txt AC 49 ms 1792 KB
sub1_21.txt AC 49 ms 1792 KB
sub1_22.txt AC 50 ms 1792 KB
sub1_23.txt AC 10 ms 512 KB
sub1_24.txt AC 1 ms 256 KB
sub1_25.txt AC 1 ms 256 KB
sub1_26.txt AC 1 ms 256 KB
sub1_27.txt AC 2 ms 256 KB
sub1_28.txt AC 48 ms 1792 KB
sub1_29.txt AC 48 ms 1792 KB