problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p03038
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define dump(x) cerr << #x << " = " << (x...
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define dump(x) cerr << #x << " = " << (x...
replace
22
23
22
23
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (int i = a; i < b; i++) #define ALL(v) v.begin(), v.end() #define pb push_back #define eb emplace_back #define mp make_pair typedef long long ll; typed...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (int i = a; i < b; i++) #define ALL(v) v.begin(), v.end() #define pb push_back #define eb emplace_back #define mp make_pair typedef long long ll; typed...
insert
58
58
58
59
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } map<int, int> mp; for (int i = 0; i < N; i++) { mp[A[i]]++; } priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } map<int, int> mp; for (int i = 0; i < N; i++) { mp[A[i]]++; } priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<...
insert
24
24
24
27
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repp(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define repm(i, n) for (int(i) = (n - 1); (i) >= 0; (i)--) #define INF (1ll << 60) typedef long long lint; const lint MOD = 1000000007; const lint MAX = 10000000;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define repp(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define repm(i, n) for (int(i) = (n - 1); (i) >= 0; (i)--) #define INF (1ll << 60) typedef long long lint; const lint MOD = 1000000007; const lint MAX = 10000000;...
replace
68
69
68
69
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N, M; cin >> N >> M; priority_queue<int, vector<int>, greater<int>> que; for (int i = 0; i < N; i++) { int a; cin >> a; que.push(a); } vector<pair<int, int>> v; for (int i = 0; i < N; i++) { int B, C; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N, M; cin >> N >> M; priority_queue<int, vector<int>, greater<int>> que; for (int i = 0; i < N; i++) { int a; cin >> a; que.push(a); } vector<pair<int, int>> v; for (int i = 0; i < M; i++) { int B, C; ...
replace
16
17
16
17
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef long long ll; int main() { int n, m; cin >> n >> m; vector<ll> a(n); rep(i, n) cin >> a.at(i); vector<pair<ll, ll>> sousa; rep(i, m) { ll b, c; cin >> b >> c; sousa.p...
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef long long ll; int main() { int n, m; cin >> n >> m; vector<ll> a(n); rep(i, n) cin >> a.at(i); vector<pair<ll, ll>> sousa; rep(i, m) { ll b, c; cin >> b >> c; sousa.p...
replace
35
36
35
36
0
p03038
C++
Time Limit Exceeded
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // need #include <algorithm> #include <iostream> // data structure #include <bitset> #include <complex> #include <map> #include <queue> #include <set> #include <stack>...
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // need #include <algorithm> #include <iostream> // data structure #include <bitset> #include <complex> #include <map> #include <queue> #include <set> #include <stack>...
replace
207
209
207
209
TLE
p03038
C++
Runtime Error
/*****/ #include <algorithm> #include <array> #include <cmath> #include <iomanip> //cout << fixed << setprecision(桁数); #include <iostream> #include <map> #include <queue> #include <stack> #include <stdexcept> #include <string> #include <vector> // #define int long long using namespace std; using ll = long long; usi...
/*****/ #include <algorithm> #include <array> #include <cmath> #include <iomanip> //cout << fixed << setprecision(桁数); #include <iostream> #include <map> #include <queue> #include <stack> #include <stdexcept> #include <string> #include <vector> // #define int long long using namespace std; using ll = long long; usi...
insert
131
131
131
133
0
i : 0 A[i] : 5 i : 1 A[i] : 4 i : 2 A[i] : 5
p03038
C++
Runtime Error
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <numeric> #include <queue> #include <regex> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; bool compare(const pair<long long, long lon...
#include <algorithm> #include <array> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <numeric> #include <queue> #include <regex> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; bool compare(const pair<long long, long lon...
replace
44
45
44
45
0
p03038
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long int lli; using namespace std; typedef pair<int, int> ii; #define int long long int inline void swap(int &a, int &...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef long long int lli; using namespace std; typedef pair<int, int> ii; #define int long long int inline void swap(int &a, int &...
replace
51
55
51
54
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rp(i, k, n) for (int i = k; i < n; i++) typedef long long ll; typedef double ld; ll mod = 1000000007ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { ...
#include <bits/stdc++.h> using namespace std; #define rp(i, k, n) for (int i = k; i < n; i++) typedef long long ll; typedef double ld; ll mod = 1000000007ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { ...
replace
55
61
55
61
0
p03038
C++
Runtime Error
#include <algorithm> #include <cstdio> const int maxn = 1e5 + 5; int n, m, a[maxn]; struct Op { int b, c; bool operator<(Op b) const { return c > b.c; } } p[maxn]; long long ans; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), ans += a[i]; for (int i = 1; i <= m; ++i)...
#include <algorithm> #include <cstdio> const int maxn = 1e5 + 5; int n, m, a[maxn]; struct Op { int b, c; bool operator<(Op b) const { return c > b.c; } } p[maxn]; long long ans; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), ans += a[i]; for (int i = 1; i <= m; ++i)...
replace
18
19
18
19
0
p03038
C++
Runtime Error
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef map<int, int> mii; typedef map<char, int> mci; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<pair<int, int>> vii; typedef vector<char> vc; typedef vecto...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef map<int, int> mii; typedef map<char, int> mci; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<pair<int, int>> vii; typedef vector<char> vc; typedef vecto...
replace
43
44
43
44
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #define boost \ ios::sync_with_stdio(0); \ cin.tie(0...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #define boost \ ios::sync_with_stdio(0); \ cin.tie(0...
replace
41
42
41
42
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, l, r, zero = 0, ans = 0, cur = 0; cin >> n >> m; vector<long long> a(n + 10); vector<pair<long long, long long>> b(m + 10); for (i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); for (i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, l, r, zero = 0, ans = 0, cur = 0; cin >> n >> m; vector<long long> a(n + 10); vector<pair<long long, long long>> b(m + 10); for (i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); for (i = 0; i < n; i++) { ...
replace
22
23
22
23
0
p03038
C++
Time Limit Exceeded
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define...
insert
60
60
60
64
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n, m; cin >> n >> m; ll arr[n + 1]; for (ll i = 0; i < n; i++) cin >> arr[i]; map<ll, ll> mp; for (ll i = 0; i < m; i++) { ll a, b; cin >> a >> b; mp[b] += a; } sort(arr, arr + n); for (ll...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n, m; cin >> n >> m; ll arr[n + 1]; for (ll i = 0; i < n; i++) cin >> arr[i]; map<ll, ll> mp; for (ll i = 0; i < m; i++) { ll a, b; cin >> a >> b; mp[b] += a; } sort(arr, arr + n); for (ll...
insert
29
29
29
31
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using P = pair<int, int>; using namespace std; template <class T> void vin(vector<T> &v, int n) { v.resize(n); for (int i = 0; i < n; ++i) { cin >> v[i]; } } int main() { int N, ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = (0); (i) < (int)(n); ++(i)) using ll = long long; using P = pair<int, int>; using namespace std; template <class T> void vin(vector<T> &v, int n) { v.resize(n); for (int i = 0; i < n; ++i) { cin >> v[i]; } } int main() { int N, ...
replace
19
20
19
20
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; typedef long long ll; /* 1, 2, 3 2, 5 5, 2, 3 = 10 2, 5, 3 = 10 */ int main() { int N, M; cin >> N >> M; vector<int> A(N); REP(i, 0, N) cin >> A[i]; vector...
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < n; i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; typedef long long ll; /* 1, 2, 3 2, 5 5, 2, 3 = 10 2, 5, 3 = 10 */ int main() { int N, M; cin >> N >> M; vector<int> A(N); REP(i, 0, N) cin >> A[i]; vector...
replace
29
30
29
30
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; priority_queue<ll> pq; for (int i = 0; i < n; i++) { ll a; cin >> a; pq.push(a); } vector<pair<ll, ll>> b(m); for (int i = 0; i < m; i++) { cin >> b[i].second >> b[i].first; } sor...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; priority_queue<ll> pq; for (int i = 0; i < n; i++) { ll a; cin >> a; pq.push(a); } vector<pair<ll, ll>> b(m); for (int i = 0; i < m; i++) { cin >> b[i].second >> b[i].first; } sor...
insert
25
25
25
27
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) using ll = long long; using namespace std; ll n, m, sum = 0; ll a[110000]; pair<ll, ll> x[110000]; int main() { cin >> n >> m; ll ps1 = 0, ps2 = m - 1; // 降順ソート出来ればps2=0 rep(i...
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) using ll = long long; using namespace std; ll n, m, sum = 0; ll a[110000]; pair<ll, ll> x[110000]; int main() { cin >> n >> m; ll ps1 = 0, ps2 = m - 1; // 降順ソート出来ればps2=0 rep(i...
replace
21
22
21
22
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define swap(a, b) \ do { \ typeof(a) __tmp = (a); \ (a...
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define swap(a, b) \ do { \ typeof(a) __tmp = (a); \ (a...
replace
25
28
25
26
0
p03038
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; struct var { int b, c; var(int x, int y) { b = x, c = y; } }; struct cmp { bool operator()(var a, var b) { return a.c < b.c; } }; priority_queue<var, vector<var>, cmp> q; vector<int> v; int main() { ...
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; struct var { int b, c; var(int x, int y) { b = x, c = y; } }; struct cmp { bool operator()(var a, var b) { return a.c < b.c; } }; priority_queue<var, vector<var>, cmp> q; vector<int> v; int main() { ...
replace
16
17
16
17
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < n; i++) #define all(v) v.begin(), v.end() using vi = vector<int>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける using vvvi = vector<vvi>; using ll = long long; // long longをllだけにした using vll = ve...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < n; i++) #define all(v) v.begin(), v.end() using vi = vector<int>; // intの1次元の型に vi という別名をつける using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける using vvvi = vector<vvi>; using ll = long long; // long longをllだけにした using vll = ve...
replace
304
306
304
308
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int main() { int n, m; scanf("%d %d", &n, &m); int inp[n]; for (int i = 0; i < n; i++) scanf("%d", &inp[i]); sort(inp, inp + n); ii op[m]; for (int i = 0; i < m; i++) scanf("%d %d", &op[i].second, &o...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int main() { int n, m; scanf("%d %d", &n, &m); int inp[n]; for (int i = 0; i < n; i++) scanf("%d", &inp[i]); sort(inp, inp + n); ii op[m]; for (int i = 0; i < m; i++) scanf("%d %d", &op[i].second, &o...
replace
25
26
25
26
0
p03038
C++
Time Limit Exceeded
/* * written by Yaqi Zhang (zhang623@wisc.edu) * University of Wisconsin-Madison * 2020 */ #include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> A(n); for (int i = 0; i < n; ++i) cin >> A[i];...
/* * written by Yaqi Zhang (zhang623@wisc.edu) * University of Wisconsin-Madison * 2020 */ #include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> A(n); for (int i = 0; i < n; ++i) cin >> A[i];...
insert
36
36
36
40
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> TUP; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define mp(a, b) make_pair(a, b) const ll MOD = 1000000007; ll maxx(ll x, ll y, ll z) { return max(ma...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> TUP; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define mp(a, b) make_pair(a, b) const ll MOD = 1000000007; ll maxx(ll x, ll y, ll z) { return max(ma...
replace
28
29
28
29
0
p03038
C++
Runtime Error
#include <algorithm> #include <cctype> #include <deque> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>...
#include <algorithm> #include <cctype> #include <deque> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <unordered_map> #include <vector> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>...
insert
178
178
178
180
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; priority_queue<ll, vector<ll>, greater<ll>> a; for (int i = 0; i < n; i++) { int x; cin >> x; a.push(x); } vector<pair<ll, ll>> bc(m); for (int i = 0; i < m; i++) { int b, c; cin ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; priority_queue<ll, vector<ll>, greater<ll>> a; for (int i = 0; i < n; i++) { int x; cin >> x; a.push(x); } vector<pair<ll, ll>> bc(m); for (int i = 0; i < m; i++) { int b, c; cin ...
replace
24
25
24
25
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define REPr(i, n) for (int i = (n)-1; i >= 0; --i) #define FORq(i, m, n) for (int i = (m); i <= (n); ++i) #define FORqr(i, m, n) for (int i = (n); i >= (m); --i) #define PB push_back #define M...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define REPr(i, n) for (int i = (n)-1; i >= 0; --i) #define FORq(i, m, n) for (int i = (m); i <= (n); ++i) #define FORqr(i, m, n) for (int i = (n); i >= (m); --i) #define PB push_back #define M...
replace
66
67
66
67
0
p03038
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int i, j; int N, M; cin >> N >> M; vector<int> A(N); vector<pair<int, int>> P(M); for (i = 0; i < N; i++) cin >> A[i]; // 都合上,BとCを逆順に入力している for (i = 0; i < M; i++) cin >> P[i].second >> P[i].first; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int i, j; int N, M; cin >> N >> M; vector<int> A(N); vector<pair<int, int>> P(M + 1); for (i = 0; i < N; i++) cin >> A[i]; // 都合上,BとCを逆順に入力している for (i = 0; i < M; i++) cin >> P[i].second >> P[i].first;...
replace
11
12
11
12
0
p03038
C++
Time Limit Exceeded
#include <algorithm> #include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #define ll long long #define ri register int using namespace std; template <class T> inline void read(T &x) { x = 0; int ne = 0; char c; while (!isdigit(c = getchar())) ne = c ...
#include <algorithm> #include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #define ll long long #define ri register int using namespace std; template <class T> inline void read(T &x) { x = 0; int ne = 0; char c; while (!isdigit(c = getchar())) ne = c ...
replace
28
29
28
29
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> #ifdef HIRO #define d(f_, ...) printf((f_), ##__VA_ARGS__) #else #define d(f_, ...) #endif using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<long long, long long> pllll; typedef vector<int> vi; typedef vector<long long> vll; typedef vec...
#include <bits/stdc++.h> #ifdef HIRO #define d(f_, ...) printf((f_), ##__VA_ARGS__) #else #define d(f_, ...) #endif using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<long long, long long> pllll; typedef vector<int> vi; typedef vector<long long> vll; typedef vec...
replace
91
94
91
93
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define int long long using namespace std; using LL = long long; using P = pair<int, int>; #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; const LL INFL =...
#include <bits/stdc++.h> #define int long long using namespace std; using LL = long long; using P = pair<int, int>; #define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() const int INF = (int)1e9; const LL INFL =...
replace
35
36
35
36
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; struct Bc { int b, c; Bc(int inputB, int inputC) { b = inputB; c = inputC; } bool operator<(const Bc &another) const { return c < another.c; } }; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.a...
#include <bits/stdc++.h> using namespace std; struct Bc { int b, c; Bc(int inputB, int inputC) { b = inputB; c = inputC; } bool operator<(const Bc &another) const { return c < another.c; } }; int main() { int N, M; cin >> N >> M; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.a...
insert
38
38
38
42
0
p03038
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include ...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include ...
insert
68
68
68
69
0
p03038
C++
Runtime Error
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; vector<...
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n, m; cin >> n >> m; vector<...
replace
34
35
34
35
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const ll LINF = 1LL << 50; const int NIL = -1; const int MAX = 10000; const int mod = 1000000007; const double pi = 3.141592653589; /* global variables */ /* function */ ...
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const ll LINF = 1LL << 50; const int NIL = -1; const int MAX = 10000; const int mod = 1000000007; const double pi = 3.141592653589; /* global variables */ /* function */ ...
replace
30
31
30
31
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int n, q, A[N]; pair<int, int> B[N]; multiset<int> S; int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) scanf("%d", &A[i]); for (int i = 1; i <= q; i++) scanf("%d%d", &B[i].second, &B[i].first); sort(B + 1, B + q + 1); ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int n, q, A[N]; pair<int, int> B[N]; multiset<int> S; int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) scanf("%d", &A[i]); for (int i = 1; i <= q; i++) scanf("%d%d", &B[i].second, &B[i].first); sort(B + 1, B + q + 1); ...
replace
19
20
19
20
0
p03038
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define pb push_back #define eb ...
insert
43
43
43
45
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; typedef pair<ll, ll> PLL; typedef vector<int> VI; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<ll> VLL; typedef vector<PLL> VP; const static int INF = 1000000000; const stat...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; typedef pair<ll, ll> PLL; typedef vector<int> VI; typedef vector<char> VC; typedef vector<double> VD; typedef vector<string> VS; typedef vector<ll> VLL; typedef vector<PLL> VP; const static int INF = 1000000000; const stat...
insert
102
102
102
107
TLE
p03038
C++
Runtime Error
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; typedef long long ll; ll inf = -1; ll mod = pow(10, 9) + 7; int main() { int n, m; ...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef pair<int, pair<int, int>> PP; typedef long long ll; ll inf = -1; ll mod = pow(10, 9) + 7; int main() { int n, m; ...
insert
40
40
40
45
0
p03038
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; constexpr ll MOD = 1000000007LL; bool cmp(const pair<int, ll> &a, const pair<int, ll> &b) { if (a.second > b.second) return...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; constexpr ll MOD = 1000000007LL; bool cmp(const pair<int, ll> &a, const pair<int, ll> &b) { if (a.second > b.second) return...
replace
54
58
54
57
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; ll n, m, l, ans; ll a[100005]; priority_queue<pll> pq; int main() { cin >> n >> m; for (ll i = 0; i < n; ++i) { cin >> a[i]; } sort(a, a + n); for (ll b, c, i = 0; i < m; ++i) { cin >> b >> c; pq.emplac...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; ll n, m, l, ans; ll a[100005]; priority_queue<pll> pq; int main() { cin >> n >> m; for (ll i = 0; i < n; ++i) { cin >> a[i]; } sort(a, a + n); for (ll b, c, i = 0; i < m; ++i) { cin >> b >> c; pq.emplac...
replace
22
23
22
23
0
p03038
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <vector> typedef long long ll; using namespace std; int main() { priority_queue<ll, vector<ll>, greater<ll>> q; ll n, m, x, ans = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> x; q.push(x); } vector<pair<ll...
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <vector> typedef long long ll; using namespace std; int main() { priority_queue<ll, vector<ll>, greater<ll>> q; ll n, m, x, ans = 0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> x; q.push(x); } vector<pair<ll...
replace
22
23
22
23
TLE
p03038
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <ios> #include <iostream> #include <limits> #include <map> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define revrep(i, N) for (int i = N - 1; i >= 0; i--) #...
#include <algorithm> #include <cmath> #include <iomanip> #include <ios> #include <iostream> #include <limits> #include <map> #include <queue> #include <stdio.h> #include <string> #include <vector> using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define revrep(i, N) for (int i = N - 1; i >= 0; i--) #...
replace
24
25
24
25
0
p03038
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <deque> #include <iostream> #include <string> using namespace std; using ulli = long long int; int main() { int n, m; cin >> n >> m; deque<ulli> cards; for (int i = 0; i < n; i++) { int temp; cin >> temp; cards.push_back(temp); } sort(cards.begin...
#include <algorithm> #include <cstdlib> #include <deque> #include <iostream> #include <string> using namespace std; using ulli = long long int; int main() { int n, m; cin >> n >> m; deque<ulli> cards; for (int i = 0; i < n; i++) { int temp; cin >> temp; cards.push_back(temp); } sort(cards.begin...
replace
31
32
31
32
0
p03038
C++
Runtime Error
#include <algorithm> #include <cstdint> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; struct BC { uint32_t B; uint32_t C; }; int main() { uint32_t N, M; cin >> N >> M; vector<uint32_t> A; uint64_t sum = 0; for (uint32_t i = 0; i < N; ++i) { uint32_t t; ...
#include <algorithm> #include <cstdint> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; struct BC { uint32_t B; uint32_t C; }; int main() { uint32_t N, M; cin >> N >> M; vector<uint32_t> A; uint64_t sum = 0; for (uint32_t i = 0; i < N; ++i) { uint32_t t; ...
replace
38
39
38
39
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, m, b, c; cin >> n >> m; vector<int> a(n); vector<vector<int>> op(m); for (int i = 0; i < n; i++) cin >> a.at(i); for (int i = 0; i < m; i++) { cin >> b >> c; op.at(i) = {c, b}; } sort(a.begin(), a.end()); sort(op.begin(), o...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, b, c; cin >> n >> m; vector<int> a(n); vector<vector<int>> op(m); for (int i = 0; i < n; i++) cin >> a.at(i); for (int i = 0; i < m; i++) { cin >> b >> c; op.at(i) = {c, b}; } sort(a.begin(), a.end()); sort(op.begin(), o...
replace
22
23
22
24
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { // input int n, m, a, b, c; cin >> n >> m; vector<pair<ll, int>> cb; rep(i, n) { cin >> a; cb.push_back(make_pair(a, 1)); } rep(i, m) { cin >> b >> c; cb[i] = mak...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { // input int n, m, a, b, c; cin >> n >> m; vector<pair<ll, int>> cb; rep(i, n) { cin >> a; cb.push_back(make_pair(a, 1)); } rep(i, m) { cin >> b >> c; cb.push_bac...
replace
16
17
16
17
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define all \ int i = 0; \ i < n; \ i++ #define pb push_back type...
#include <bits/stdc++.h> using namespace std; #define all \ int i = 0; \ i < n; \ i++ #define pb push_back type...
replace
28
29
28
29
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) long long mo = 1e9 + 7; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; template <class T, class S> void cmin(T &a, const S &b) { if (a > b) a = b; } template <class T, c...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) long long mo = 1e9 + 7; typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; template <class T, class S> void cmin(T &a, const S &b) { if (a > b) a = b; } template <class T, c...
insert
44
44
44
47
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair typedef long long ll; const int INT_INF = 1e9; const ll INF = 1LL << 30; const ll MOD = 1e9 + 7; int main() { ll n, m; cin >> n >> m; V<ll> a(n); for (int i = 0; i < n; i++) cin >> a[i]; V<P<...
#include <bits/stdc++.h> using namespace std; #define ALL(v) v.begin(), v.end() #define V vector #define P pair typedef long long ll; const int INT_INF = 1e9; const ll INF = 1LL << 30; const ll MOD = 1e9 + 7; int main() { ll n, m; cin >> n >> m; V<ll> a(n); for (int i = 0; i < n; i++) cin >> a[i]; V<P<...
replace
35
36
35
36
0
p03038
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long int64; int main(void) { int64 N, M; cin >> N >> M; vector<int64> A(N); vector<pair<int64, int64>> CB(M); int64 ans = 0; for (int64 i = 0; i < N; i++) { ...
#include <algorithm> #include <iostream> #include <map> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long int64; int main(void) { int64 N, M; cin >> N >> M; vector<int64> A(N); vector<pair<int64, int64>> CB(M); int64 ans = 0; for (int64 i = 0; i < N; i++) { ...
insert
42
42
42
44
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn], n, m; vector<pair<int, int>> v; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < m; i++) { int x, y; scanf("%d%d", &x, &y); v.push_back(make_pair(y, x)); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn], n, m; vector<pair<int, int>> v; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < m; i++) { int x, y; scanf("%d%d", &x, &y); v.push_back(make_pair(y, x)); ...
replace
21
30
21
33
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using st = string; using db = double; using vll = vector<long long>; using vdb = vector<db>; using vvll = vector<vll>; using vst = vector<st>; using vchar = vector<char>; using pll = pair<ll, ll>; using vpll = vector<pl...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using st = string; using db = double; using vll = vector<long long>; using vdb = vector<db>; using vvll = vector<vll>; using vst = vector<st>; using vchar = vector<char>; using pll = pair<ll, ll>; using vpll = vector<pl...
replace
56
57
56
57
0
p03038
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define MaxSize 100005 ll n, m, sum = 0; ll a[MaxSize]; P res[MaxSize]; void Solve() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> res[i].second >> res...
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define MaxSize 100005 ll n, m, sum = 0; ll a[MaxSize]; P res[MaxSize]; void Solve() { cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) cin >> res[i].second >> res...
replace
21
22
21
24
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using lli = long long int; template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i]; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, co...
#include <bits/stdc++.h> using namespace std; using lli = long long int; template <class T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i]; o << "}"; return o; } template <class T> ostream &operator<<(ostream &o, co...
insert
73
73
73
75
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using ll = long long; using P = pair<ll, ll>; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using ll = long long; using P = pair<ll, ll>; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) ...
insert
32
32
32
34
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v; int a; for (int i = 0; i < n; i++) { cin >> a; v.push_back(a); } sort(v.begin(), v.end()); int b, c; vector<vector<int>> sousa; for (int i = 0; i < m; i++) { cin >>...
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v; int a; for (int i = 0; i < n; i++) { cin >> a; v.push_back(a); } sort(v.begin(), v.end()); int b, c; vector<vector<int>> sousa; for (int i = 0; i < m; i++) { cin >>...
delete
44
45
44
44
TLE
p03038
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; struct Card { ll b; ll c; Card(ll b = 0, ll c = 0) { this->b = b; this->c = c; } bool ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; struct Card { ll b; ll c; Card(ll b = 0, ll c = 0) { this->b = b; this->c = c; } bool ...
replace
37
38
37
48
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i <= b; i++) #define out(x) cout << x << endl #define exout(x) printf("%.10f\n", x) #define chmax(x, y) x =...
#include <bits/stdc++.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define exrep(i, a, b) for (ll i = a; i <= b; i++) #define out(x) cout << x << endl #define exout(x) printf("%.10f\n", x) #define chmax(x, y) x =...
insert
133
133
133
135
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAX 5000 #define MOD 1000000007 int main() { int N, M; cin >> N >> M; vector<ll> A(N); vector<pair<ll, ll>> CB(M); for (int i = 0; i < N; i++) { cin >> A.at(i); } for (int i = 0; i < M; i++) { cin >> CB.at(i).second >> CB...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAX 5000 #define MOD 1000000007 int main() { int N, M; cin >> N >> M; vector<ll> A(N); vector<pair<ll, ll>> CB(M); for (int i = 0; i < N; i++) { cin >> A.at(i); } for (int i = 0; i < M; i++) { cin >> CB.at(i).second >> CB...
insert
28
28
28
32
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int INF = 1e9; int main() { int n, m; cin >> n >> m; vector<int> a(n); vector<pair<int, int>> p(n); rep(i, n) cin >> a[i]; sort(a.begin(), a.end()); // rep(i, m) cin >> p[i].secon...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int INF = 1e9; int main() { int n, m; cin >> n >> m; vector<int> a(n); vector<pair<int, int>> p(m); rep(i, n) cin >> a[i]; sort(a.begin(), a.end()); // rep(i, m) cin >> p[i].secon...
replace
11
12
11
12
0
p03038
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define INF 100000000000 #define MOD 1000000007 #define ll long long int using namespace std; /* int main(){ int a,b;ci...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define INF 100000000000 #define MOD 1000000007 #define ll long long int using namespace std; /* int main(){ int a,b;ci...
replace
25
27
25
27
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rrep(i, n) for (int(i) = ((n)-1); (i) >= 0; (i)--) #define itn int #define miele(v) min_element(v.begin(), v.end()) #define maele(v) max_element(v.begin(), v.end()) #define SUM(v) accumulate(...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rrep(i, n) for (int(i) = ((n)-1); (i) >= 0; (i)--) #define itn int #define miele(v) min_element(v.begin(), v.end()) #define maele(v) max_element(v.begin(), v.end()) #define SUM(v) accumulate(...
replace
153
154
153
154
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); vector<pair<int, int>> CB(M); for (int i = 0; i < N; i++) cin >> A.at(i); for (int i = 0; i < M; i++) { int B, C; cin >> B >> C; CB.at(i) = make_pair(C, B); } sort(A.begin(), A.end()); ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(N); vector<pair<int, int>> CB(M); for (int i = 0; i < N; i++) cin >> A.at(i); for (int i = 0; i < M; i++) { int B, C; cin >> B >> C; CB.at(i) = make_pair(C, B); } sort(A.begin(), A.end()); ...
insert
21
21
21
23
TLE
p03038
C++
Time Limit Exceeded
// todo 文字数を少なくする // mintより高速に計算したい時用に modmul() modadd (正の値限定) を作る // #pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned...
// todo 文字数を少なくする // mintより高速に計算したい時用に modmul() modadd (正の値限定) を作る // #pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned...
insert
3,552
3,552
3,552
3,554
TLE
p03038
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> typedef long long ll; using namespace std; int main() { ll i, j, k, n, m; cin >> n >> m; vector<ll> a(n); vector<pair<ll, ll>> q(n + 1); for (i = 0; i < n; i++) { cin >> a[i]; ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> typedef long long ll; using namespace std; int main() { ll i, j, k, n, m; cin >> n >> m; vector<ll> a(n); vector<pair<ll, ll>> q(m); for (i = 0; i < n; i++) { cin >> a[i]; } ...
replace
14
15
14
15
0
p03038
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define int long long #define mod (int)(1000000007) using namespace std; int test[213456]; signed main() { int n, k, b = 0, ans = 0; cin >> n >> k; in...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <vector> #define int long long #define mod (int)(1000000007) using namespace std; int test[213456]; signed main() { int n, k, b = 0, ans = 0; cin >> n >> k; in...
insert
41
41
41
44
0
p03038
C++
Runtime Error
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #inc...
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #inc...
replace
57
58
57
58
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define ll long long #d...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define ll long long #d...
insert
68
68
68
72
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, ans = 0; cin >> N >> M; vector<long long> A(N); vector<long long> B(N); map<long long, long long> mp; long long visit = -1; for (int i = 0; i < N; i++) { long long a; cin >> a; A.at(i) = a; } sort(A.begin(), A.end()...
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, ans = 0; cin >> N >> M; vector<long long> A(N); vector<long long> B(N); map<long long, long long> mp; long long visit = -1; for (int i = 0; i < N; i++) { long long a; cin >> a; A.at(i) = a; } sort(A.begin(), A.end()...
insert
48
48
48
52
0
p03038
C++
Time Limit Exceeded
// todo 文字数を少なくする // mintより高速に計算したい時用に modmul() modadd (正の値限定) を作る // #pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned...
// todo 文字数を少なくする // mintより高速に計算したい時用に modmul() modadd (正の値限定) を作る // #pragma GCC optimize ("-O3") #include <bits/stdc++.h> using namespace std; //@起動時 struct initon { initon() { cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); srand((unsigned)clock() + (unsigned...
replace
3,621
3,622
3,621
3,622
TLE
p03038
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iterator> #include <map> #include <queue> #include <vector> using namespace std; // 定义比较结构 struct cmp1 { bool operator()(int &a, int &b) { return a > b; // 最小值优先 } }; std::priority_queue<int, vector<int>, cm...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iterator> #include <map> #include <queue> #include <vector> using namespace std; // 定义比较结构 struct cmp1 { bool operator()(int &a, int &b) { return a > b; // 最小值优先 } }; std::priority_queue<int, vector<int>, cm...
insert
49
49
49
52
0
p03038
C++
Runtime Error
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <complex> #include <cstring> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define Rep(i, a, b) f...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <complex> #include <cstring> #include <iomanip> #include <iostream> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define Rep(i, a, b) f...
insert
66
66
66
68
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (long long)(x).size() #define sqr(x) (x) * (x) #define sof sizeof #define ins insert #define lowerB lower_bound #define upperB upper_bound #define mkp make_pair #define mod 10000000...
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (long long)(x).size() #define sqr(x) (x) * (x) #define sof sizeof #define ins insert #define lowerB lower_bound #define upperB upper_bound #define mkp make_pair #define mod 10000000...
insert
133
133
133
136
0
p03038
Python
Time Limit Exceeded
import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) change = [] for m in range(M): B, C = map(int, input().split()) change.append((B, C)) change.sort(key=lambda x: -x[1]) change2 = [] for c in change: change2.extend([c[1]] * c[0]) change2 = change2[:N] heapq.heapify(A) fo...
import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) change = [] for m in range(M): B, C = map(int, input().split()) change.append((B, C)) change.sort(key=lambda x: -x[1]) change2 = [] for c in change: change2.extend([c[1]] * c[0]) if len(change2) >= N: change2 = ...
replace
14
15
14
17
TLE
p03038
C++
Time Limit Exceeded
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0...
replace
0
1
0
1
TLE
p03038
C++
Time Limit Exceeded
// #define _GLIBCXX_DEBUG #include <algorithm> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(a) (a).begin(), (a).end() using namespace std; using Graph = vector<vector<int>>; typedef long long ll; const int mod = 1e+9 + 7; int main() { ll n, m; cin >> n >> m; priority_queue...
// #define _GLIBCXX_DEBUG #include <algorithm> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(a) (a).begin(), (a).end() using namespace std; using Graph = vector<vector<int>>; typedef long long ll; const int mod = 1e+9 + 7; int main() { ll n, m; cin >> n >> m; priority_queue...
insert
27
27
27
28
TLE
p03038
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define pii pair<int, int> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(c) (c).begin(), (c).end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MINF(a) memset(a, 0x3f, sizeof(a...
#include <bits/stdc++.h> #define int long long #define pii pair<int, int> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(c) (c).begin(), (c).end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, 0xff, sizeof(a)) #define MINF(a) memset(a, 0x3f, sizeof(a...
replace
64
65
64
70
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } sort(a.begin(), a.end()); vector<int> b(m), c(m); for (int j = 0; j < m; j++) { cin >> b.at(j) >> c.at(j); } int l = accumulate(b.begin(), b....
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } sort(a.begin(), a.end()); vector<int> b(m), c(m); for (int j = 0; j < m; j++) { cin >> b.at(j) >> c.at(j); } int l = accumulate(b.begin(), b....
insert
30
30
30
34
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, sum; cin >> n >> m; priority_queue<long long, vector<long long>, greater<long long>> a; vector<long long> b(m), c(m); vector<pair<long long, long long>> bc(m); for (i = 0; i < n; ++i) { long long z; cin >> z; a.pus...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, sum; cin >> n >> m; priority_queue<long long, vector<long long>, greater<long long>> a; vector<long long> b(m), c(m); vector<pair<long long, long long>> bc(m); for (i = 0; i < n; ++i) { long long z; cin >> z; a.pus...
replace
18
19
18
19
TLE
p03038
C++
Runtime Error
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <ve...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <ve...
replace
59
61
59
61
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define sz(a) int(a.size()) int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int &t : a) cin >> t; vector<pair<int, int>> cb(m); for (auto &t : cb) { int &c = t.first, &b = t.second; cin >> b >> c; } sort(rbegin(cb), rend(cb)); ...
#include <bits/stdc++.h> using namespace std; #define sz(a) int(a.size()) int main() { int n, m; cin >> n >> m; vector<int> a(n); for (int &t : a) cin >> t; vector<pair<int, int>> cb(m); for (auto &t : cb) { int &c = t.first, &b = t.second; cin >> b >> c; } sort(rbegin(cb), rend(cb)); ...
insert
26
26
26
28
0
p03038
C++
Runtime Error
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; const ll infll = 9223372036854775806; const int inf = 2147483646; int main() { // freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(20); ll ...
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; const ll infll = 9223372036854775806; const int inf = 2147483646; int main() { // freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(20); ll ...
replace
27
28
27
28
0
p03038
C++
Runtime Error
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <numeric> #include <set> #include <tuple> #include <vector> using namespace std; typedef long long ll; bool my_compare(pair<ll, ll> a, pair<ll, ll> b) { if (a.first != b.first) { return a.first > b.first; } if (a.second != b.s...
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <numeric> #include <set> #include <tuple> #include <vector> using namespace std; typedef long long ll; bool my_compare(pair<ll, ll> a, pair<ll, ll> b) { if (a.first != b.first) { return a.first > b.first; } if (a.second != b.s...
replace
19
20
19
20
0
p03038
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C) { vector<pair<ll, ll>> BC; for (ll i = 0; i < M; ++i) { BC.emplace_back(B[i], C[i]); } sort(begin(BC), end(BC), ...
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C) { vector<pair<ll, ll>> BC; for (ll i = 0; i < M; ++i) { BC.emplace_back(B[i], C[i]); } sort(begin(BC), end(BC), ...
replace
16
21
16
20
TLE
p03038
Python
Runtime Error
""" 解説を参考に作成 その3 """ def solve(): N, M = map(int, input().split()) A = [int(i) for i in input().split()] A.sort() CB = [list(reversed([int(i) for i in input().split()])) for _ in range(M)] CB = list(sorted(CB, reverse=True)) count = 0 flag = False for cb in CB: for b in range(...
""" 解説を参考に作成 その3 """ def solve(): N, M = map(int, input().split()) A = [int(i) for i in input().split()] A.sort() CB = [list(reversed([int(i) for i in input().split()])) for _ in range(M)] CB = list(sorted(CB, reverse=True)) count = 0 flag = False for cb in CB: for b in range(...
insert
22
22
22
26
0
p03038
Python
Runtime Error
n, m = map(int, input().split()) a_list = list(map(int, input().split())) bc_list = [list(map(int, input().split())) for _ in range(m)] a_list.sort() bc_list.sort(key=lambda i: -i[1]) a_idx = 0 bc_idx = 0 while bc_idx < len(bc_list): b, c = bc_list[bc_idx] finish = False for _ in range(b): if c > a...
n, m = map(int, input().split()) a_list = list(map(int, input().split())) bc_list = [list(map(int, input().split())) for _ in range(m)] a_list.sort() bc_list.sort(key=lambda i: -i[1]) a_idx = 0 bc_idx = 0 while bc_idx < len(bc_list): b, c = bc_list[bc_idx] finish = False for _ in range(b): if a_idx...
insert
12
12
12
15
0
p03038
Python
Time Limit Exceeded
N, M = [int(i) for i in input().strip().split()] A = [int(i) for i in input().strip().split()] A.sort() for i in range(M): B, C = [int(i) for i in input().strip().split()] is_changed = False for j in range(0, B): if A[j] < C: A[j] = C is_changed = True else: ...
N, M = [int(i) for i in input().strip().split()] A = [int(i) for i in input().strip().split()] A.sort() BC = [[0, 0] for _ in range(M)] for j in range(M): BC[j][0], BC[j][1] = [int(i) for i in input().strip().split()] BC.sort(key=lambda x: x[1]) res = 0 cnt = 0 i = N - 1 j = M - 1 while True: if cnt == N: ...
replace
3
15
3
32
TLE
p03038
Python
Runtime Error
#!/usr/bin/env python3 N, M = map(int, input().rstrip().split()) A = list(map(int, input().rstrip().split())) B = [] C = [] for _ in range(M): b, c = map(int, input().rstrip().split()) B.append(b) C.append(c) Index = sorted(range(M), key=lambda i: C[i], reverse=True) sum = 0 A.sort() for index in Index: ...
#!/usr/bin/env python3 N, M = map(int, input().rstrip().split()) A = list(map(int, input().rstrip().split())) B = [] C = [] for _ in range(M): b, c = map(int, input().rstrip().split()) B.append(b) C.append(c) Index = sorted(range(M), key=lambda i: C[i], reverse=True) sum = 0 A.sort() for index in Index: ...
replace
16
17
16
17
0
p03038
Python
Time Limit Exceeded
import heapq N, M = map(int, input().split()) A_LIST = list(map(int, input().split())) BC_LIST = [] heapq.heapify(A_LIST) for i in range(M): b, c = map(int, input().split()) BC_LIST.append([b, c]) BC_LIST.sort(reverse=True, key=lambda x: x[1]) # C降順にソート for b, c in BC_LIST: for _ in range(b): tmp ...
import heapq N, M = map(int, input().split()) A_LIST = list(map(int, input().split())) BC_LIST = [] heapq.heapify(A_LIST) for i in range(M): b, c = map(int, input().split()) BC_LIST.append([b, c]) BC_LIST.sort(reverse=True, key=lambda x: x[1]) # C降順にソート for b, c in BC_LIST: for _ in range(b): tmp ...
replace
13
14
13
18
TLE
p03038
Python
Runtime Error
n, m = map(int, input().split()) a = list(map(int, input().split())) bc = [0] * m ans = [] a.sort() for i in range(m): bc[i] = list(map(int, input().split())) bc.sort(key=lambda x: x[1], reverse=True) j = 0 for i in range(n): if bc[j][0] == 0: j += 1 if j >= m: ans.append(a[i]) elif a[...
n, m = map(int, input().split()) a = list(map(int, input().split())) bc = [0] * m ans = [] a.sort() for i in range(m): bc[i] = list(map(int, input().split())) bc.sort(key=lambda x: x[1], reverse=True) j = 0 for i in range(n): if j < m: if bc[j][0] == 0: j += 1 if j >= m: ans.ap...
replace
12
14
12
15
0
p03038
Python
Time Limit Exceeded
import sys input = sys.stdin.readline N, M = map(int, input().split()) A = list(map(int, input().split())) op = [list(map(int, input().split())) for _ in range(M)] cards = sorted(A) op.sort(key=lambda x: -x[1]) i = 0 for m in range(M): b, c = op[m] for _ in range(b): if cards[i] < c: ca...
import sys input = sys.stdin.readline N, M = map(int, input().split()) A = list(map(int, input().split())) op = [list(map(int, input().split())) for _ in range(M)] cards = sorted(A) op.sort(key=lambda x: -x[1]) i = 0 for m in range(M): b, c = op[m] for _ in range(b): if cards[i] < c: ca...
replace
19
20
19
22
TLE
p03038
Python
Runtime Error
import sys import operator n, m = map(int, input().split()) a = [int(x) for x in sys.stdin.readline().rstrip().split()] a.sort() cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)] cards.sort(key=operator.itemgetter(1), reverse=True) a_idx = 0 a_len = len(a) for b, c in cards: i...
import sys import operator n, m = map(int, input().split()) a = [int(x) for x in sys.stdin.readline().rstrip().split()] a.sort() cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)] cards.sort(key=operator.itemgetter(1), reverse=True) a_idx = 0 a_len = len(a) for b, c in cards: i...
replace
15
16
15
16
0
p03038
Python
Time Limit Exceeded
import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) heapq.heapify(A) B = [] C = [] CB = [] for _ in range(M): b, c = map(int, input().split()) B.append(b) C.append(c) CB.append((c, b)) CB.sort() for c, b in CB: for j in range(b): tmp = heapq.heappop(A) ...
import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) heapq.heapify(A) B = [] C = [] CB = [] for _ in range(M): b, c = map(int, input().split()) B.append(b) C.append(c) CB.append((c, b)) CB.sort(reverse=True) for c, b in CB: for j in range(b): tmp = heapq.heappop...
replace
13
14
13
14
TLE
p03038
Python
Time Limit Exceeded
N, M = map(int, input().split()) A = list(map(int, input().split())) BC = [list(map(int, input().split())) for _ in range(M)] A.sort() BC.sort(key=lambda bc: bc[1], reverse=True) update_bc = [0 for _ in range(N)] cnt = 0 for b, c in BC: for i in range(b): if cnt < N: update_bc[cnt] = c ...
N, M = map(int, input().split()) A = list(map(int, input().split())) BC = [list(map(int, input().split())) for _ in range(M)] A.sort() BC.sort(key=lambda bc: bc[1], reverse=True) update_bc = [0 for _ in range(N)] cnt = 0 for b, c in BC: for i in range(b): if cnt < N: update_bc[cnt] = c ...
insert
14
14
14
18
TLE
p03038
Python
Runtime Error
n, m = map(int, input().split()) a = list(map(int, input().split())) bc = [] for _ in range(m): b, c = map(int, input().split()) bc.append([b, c]) a.sort() bc.sort(reverse=True, key=lambda x: x[1]) cnt = 0 for i in range(m): for j in range(bc[i][0]): if bc[i][1] > a[cnt]: a[cnt] = bc[i][...
n, m = map(int, input().split()) a = list(map(int, input().split())) bc = [] for _ in range(m): b, c = map(int, input().split()) bc.append([b, c]) a.sort() bc.sort(reverse=True, key=lambda x: x[1]) cnt = 0 for i in range(m): for j in range(bc[i][0]): if bc[i][1] > a[cnt]: a[cnt] = bc[i][...
replace
13
14
13
14
0
p03038
Python
Time Limit Exceeded
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] A = [int(x) for x in stdin.readline().rstrip().split()] BC = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)] BC.sort(key=lambda x: x[1], reverse=True) for i in range(M): A = A + [BC[i][1]] * BC[i][0] if len...
from sys import stdin N, M = [int(x) for x in stdin.readline().rstrip().split()] A = [int(x) for x in stdin.readline().rstrip().split()] BC = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)] BC.sort(key=lambda x: x[1], reverse=True) for i in range(M): A.extend([BC[i][1]] * BC[i][0]) if l...
replace
7
8
7
8
TLE