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
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define ra return a; #define pb push_back #define sti stack<ll> #define spi stack<pair<ll, ll>> #define S second #define msi map<string, ll> #define msi map<string, ll> #define mii map<ll, ll> #define dbg(x) \ ...
#include <bits/stdc++.h> #define ll long long #define ra return a; #define pb push_back #define sti stack<ll> #define spi stack<pair<ll, ll>> #define S second #define msi map<string, ll> #define msi map<string, ll> #define mii map<ll, ll> #define dbg(x) \ ...
replace
56
78
56
69
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; re...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; re...
replace
32
50
32
46
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int N = S.size(); int ans = 0; for (int i = N - 3; i >= 0; i--) { if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') { ans++; S[i] = 'B'; S[i + 1] = 'C'; S[i + 2] = 'A'; int ii = i + 2; ...
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int N = S.size(); string s; for (int i = 0; i < N; i++) { if (i + 1 < N && S[i] == 'B' && S[i + 1] == 'C') { s += 'D'; i++; } else s += S[i]; } int n = s.size(); int a = 0; long long ans = 0; f...
replace
8
25
8
26
TLE
p03018
C++
Runtime Error
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <stack> #include <stdio.h> #include <vector> using namespace std; int main() { string s; getline(cin, s); vector<char> SS; for (auto i = 0; i < s.size() - 1; i++) { if (s[i] == 'A') { SS.push_back('A'); } else { ...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <stack> #include <stdio.h> #include <vector> using namespace std; int main() { string s; getline(cin, s); vector<char> SS; for (auto i = 0; i < s.size() - 1; i++) { if (s[i] == 'A') { SS.push_back('A'); } else { ...
replace
22
24
22
26
0
p03018
Python
Time Limit Exceeded
def li(): return list(map(int, input().split())) if __name__ == "__main__": s = input() ope_num = 0 index = 0 a_stock = 0 b_stock = 0 s = list(s) while index < len(s): # print(s) # print(index) # print(ope_num) # print() si = s[index] if ...
def li(): return list(map(int, input().split())) if __name__ == "__main__": s = input() ope_num = 0 index = 0 a_stock = 0 b_stock = 0 s = list(s) while index < len(s): # print(s) # print(index) # print(ope_num) # print() si = s[index] if ...
replace
34
38
34
37
TLE
p03018
Python
Time Limit Exceeded
s = input() ans = 0 cntA = 0 for i in range(0, len(s) - 1): if s[i] == "A": cntA += 1 elif s[i : i + 2] == "BC": cntANext = 0 for j in range(0, cntA): ans += 1 cntANext += 1 cntA = cntANext elif i > 0 and s[i - 1 : i + 1] == "BC": continue ...
s = input() ans = 0 cntA = 0 for i in range(0, len(s) - 1): if s[i] == "A": cntA += 1 elif s[i : i + 2] == "BC": ans += cntA elif i > 0 and s[i - 1 : i + 1] == "BC": continue else: cntA = 0 print(ans) # print(*data, sep='\n')
replace
7
12
7
8
TLE
p03018
C++
Runtime Error
///////////////////////////////////////////////// ///// Give me AC!!!! ///// ///////////////////////////////////////////////// // ↑これじゃ気合いが足りない! ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///// ///お願いしますACをくださいそうじゃないと僕泣きますお願いし...
///////////////////////////////////////////////// ///// Give me AC!!!! ///// ///////////////////////////////////////////////// // ↑これじゃ気合いが足りない! ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///// ///お願いしますACをくださいそうじゃないと僕泣きますお願いし...
insert
159
159
159
163
0
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sum = 0; while (true) { if (s.find("ABC") == std::string::npos) break; else { int a = s.find("ABC"); s.replace(a, 3, "BCA"); sum += 1; } } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long sum = 0; long litsum = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == 'A') litsum += 1; else if (s[i] == 'B') { if (i == s.length() - 1) break; else if (s[i + 1] == 'C') { sum ...
replace
6
14
6
27
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define str string #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define vc vector<char> #define vvc vector<vc> #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvll vector<vll> #define vvvll vector<vvll...
#include <bits/stdc++.h> #define ll long long #define str string #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define vc vector<char> #define vvc vector<vc> #define vi vector<int> #define vll vector<ll> #define vvi vector<vi> #define vvll vector<vll> #define vvvll vector<vvll...
replace
61
70
61
73
TLE
p03018
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 // #define MOD 998244353 #define INF 1145141919810893364 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i)...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 // #define MOD 998244353 #define INF 1145141919810893364 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i)...
replace
37
38
37
44
0
p03018
C++
Time Limit Exceeded
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
replace
58
70
58
66
TLE
p03018
C++
Time Limit Exceeded
// Doing Some Optimization #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") #include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #...
// Doing Some Optimization #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse2") #include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #...
replace
115
124
115
119
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef pair<ll, ll> Pll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repn(i, n) for (int i = 0; i <= (int)(n); i++) #define srep(i, l, n) for (int i = l; i < (int)(n); i++) #define sre...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef pair<ll, ll> Pll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repn(i, n) for (int i = 0; i <= (int)(n); i++) #define srep(i, l, n) for (int i = l; i < (int)(n); i++) #define sre...
replace
37
51
37
47
TLE
p03018
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #if DEBUG && !ONLINE_JUDGE #include "debug.h" #else #define debug(...) #endif using namespace std; /******* All Required define Pre-Pr...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #if DEBUG && !ONLINE_JUDGE #include "debug.h" #else #define debug(...) #endif using namespace std; /******* All Required define Pre-Pr...
replace
74
75
74
75
0
p03018
C++
Runtime Error
// RAY #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll MOD = 1000000007; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; ll count = 0, temp = 0; ...
// RAY #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll MOD = 1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; ll count = 0, temp = 0; ll n = s.size(), x = 0; ll acount = 0; for (ll i = 0; i < n - 1; i++) { if (s[i] == 'A') ...
delete
7
11
7
7
0
p03018
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep1(i, n) for (ll i = 1; i <= n; ++i) bool judge_bc(string s, int k, int len) { if (k == len) return false; return s[k] == 'B' && s[k + 1]...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep1(i, n) for (ll i = 1; i <= n; ++i) bool judge_bc(string s, int k, int len) { if (k == len) return false; return s[k] == 'B' && s[k + 1]...
replace
22
25
22
27
TLE
p03018
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using pint = pair<int, int>; using ll = long long; using pll = pair<ll, ll>; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) ...
#include <bits/stdc++.h> using namespace std; using pint = pair<int, int>; using ll = long long; using pll = pair<ll, ll>; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) ...
replace
23
24
23
24
0
p03018
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; if (s.size() < 3) { cout << 0 << endl; return 0; } long long ans = 0LL; for (int i = 0; i < s.size() - 2; i++) { if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') { ...
#include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; if (s.size() < 3) { cout << 0 << endl; return 0; } long long ans = 0LL; int A_num = 0; for (int i = 0; i < s.size() - 1; i++) { if (s[i] == 'B' && s[i + 1] == 'C' && A_nu...
replace
16
25
16
26
TLE
p03018
C++
Time Limit Exceeded
#include <algorithm> #include <assert.h> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using na...
#include <algorithm> #include <assert.h> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using na...
replace
72
84
72
90
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ull, ull> pullull; typedef pair<ll, int> plli; typedef pair<int, pii> pipii; typedef vector<vector<int>> mati; typedef vector<vector<double>> matd; type...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ull, ull> pullull; typedef pair<ll, int> plli; typedef pair<int, pii> pipii; typedef vector<vector<int>> mati; typedef vector<vector<double>> matd; type...
replace
130
138
130
138
TLE
p03018
C++
Time Limit Exceeded
/** * Author: "Robin Singh" !! * rob_in_1 **/ #include <bits/stdc++.h> using namespace std; #define dbg(args...) \ { \ vector<string> _v = split(#args, ','); ...
/** * Author: "Robin Singh" !! * rob_in_1 **/ #include <bits/stdc++.h> using namespace std; #define dbg(args...) \ { \ vector<string> _v = split(#args, ','); ...
replace
62
71
62
71
TLE
p03018
C++
Time Limit Exceeded
#pragma GCC optimize( \ "O3,Ofast,inline,fast-math,unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define IOS ...
#pragma GCC optimize( \ "O3,Ofast,inline,fast-math,unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define IOS ...
replace
537
548
537
547
TLE
p03018
C++
Time Limit Exceeded
#include <algorithm> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i =...
#include <algorithm> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i =...
replace
30
44
30
39
TLE
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef pair<ll, ll> P; typedef vector<P> vp; #define rep(i, a, b) for (ll i = (a); i < (b); ++i) #define drep(i, a, b) for (ll...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<int> vin; typedef pair<ll, ll> P; typedef vector<P> vp; #define rep(i, a, b) for (ll i = (a); i < (b); ++i) #define drep(i, a, b) for (ll...
replace
25
39
25
46
TLE
p03018
C++
Runtime Error
/* ****GT_18**** */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll ...
/* ****GT_18**** */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll ...
replace
26
34
26
36
0
p03018
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int countab = 0; ll tot = 0, c1; vector<int> cnt[205]; string s; cin >> s; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'A') { cnt[countab].push_back(1); } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int countab = 0; ll tot = 0, c1; vector<int> cnt[200005]; string s; cin >> s; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'A') { cnt[countab].push_back(1); ...
replace
11
12
11
12
0
p03018
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define fo(i, n) for (int i = 1; i <= n; ++i) typedef long long ll; #define pb push_back const int N = 250000; int n, a, b, c, d; int main() { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int ans = 0; for (int i = 0; i + 2 < s.length(); ++i) { ...
#include <bits/stdc++.h> using namespace std; #define fo(i, n) for (int i = 1; i <= n; ++i) typedef long long ll; #define pb push_back const int N = 250000; int n, a, b, c, d; int main() { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; ll ans = 0, cnta = 0; for (int i = 0; i + 1 < s.length(...
replace
18
27
18
28
TLE
p03018
C++
Runtime Error
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { string s; cin >> s; vector<string> a; int begin = 0; for (int i = 0; i < s.size(); i++) { if (s[i] ==...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { string s; cin >> s; vector<string> a; int begin = 0; for (int i = 0; i < s.size(); i++) { if (s[i] ==...
replace
29
30
29
30
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define int long long #define double long double #define mod 1000003 #define F first #define S second #define P pair<long long, long long> #define all(a) a.begin(), a.end() #define INF 10000000000000000 template <class T> inline bool chmax(T &a, T...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define int long long #define double long double #define mod 1000003 #define F first #define S second #define P pair<long long, long long> #define all(a) a.begin(), a.end() #define INF 10000000000000000 template <class T> inline bool chmax(T &a, T...
replace
42
43
42
81
0
p03019
C++
Runtime Error
#include <algorithm> #include <cassert> #include <chrono> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; const int MAXN = 100000; int x; struct Exam { int b; int ...
#include <algorithm> #include <cassert> #include <chrono> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; const int MAXN = 100000; int x; struct Exam { int b; int ...
replace
34
35
34
35
0
p03019
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; const ll INF = 1LL << 60; const ll MOD = 1000000007; template <class T> bool chmax(T &a, const T &b) { ...
#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vvl = vector<vl>; const ll INF = 1LL << 60; const ll MOD = 1000000007; template <class T> bool chmax(T &a, const T &b) { ...
replace
24
25
24
25
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define fornum(A, B, C) for (A = B; A < C; A++) #define mp make_pair #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; ///////////////////////////////////////////////////// #define INF 1e15 ll N, X, b[101010]; ll l[101010], u[101010]; vector<pll> m...
#include <bits/stdc++.h> #define ll long long #define fornum(A, B, C) for (A = B; A < C; A++) #define mp make_pair #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; ///////////////////////////////////////////////////// #define INF 1e15 ll N, X, b[101010]; ll l[101010], u[101010]; vector<pll> m...
insert
27
27
27
31
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #ifdef ENABLE_DEBUG #define dump(a) cerr << #a << "=" << a << endl #define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl #else #define dump(a) #define dumparr(a, n) #endif #define FOR(i, a, b) for (int i = a; i < b; i++) #define For(i, a) FOR(i, 0, a) #define...
#include <bits/stdc++.h> using namespace std; #ifdef ENABLE_DEBUG #define dump(a) cerr << #a << "=" << a << endl #define dumparr(a, n) cerr << #a << "[" << n << "]=" << a[n] << endl #else #define dump(a) #define dumparr(a, n) #endif #define FOR(i, a, b) for (int i = a; i < b; i++) #define For(i, a) FOR(i, 0, a) #define...
replace
38
39
38
39
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* REMEMBER: 1.Think TWICE, code ONCE! Are there any counterexamples to your algo? 2.Be careful about the BOUNDARIES in your algo! N=1? P=1? Is P a prime? Something about 0? 3.Never make STUPID MISTAKES! Integer overflow? Array size? Time complexity? Memory...
#include <bits/stdc++.h> using namespace std; /* REMEMBER: 1.Think TWICE, code ONCE! Are there any counterexamples to your algo? 2.Be careful about the BOUNDARIES in your algo! N=1? P=1? Is P a prime? Something about 0? 3.Never make STUPID MISTAKES! Integer overflow? Array size? Time complexity? Memory...
replace
44
45
44
45
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long int n, x; struct test { long long int b, l, u; bool operator<(const test &rhs) const { return l * b + u * (x - b) > rhs.l * rhs.b + rhs.u * (x - rhs.b); } } T[100000]; int now = 0; bool check(long long int s, long long int t) { long long int res = 0;...
#include <bits/stdc++.h> using namespace std; long long int n, x; struct test { long long int b, l, u; bool operator<(const test &rhs) const { return l * b + u * (x - b) > rhs.l * rhs.b + rhs.u * (x - rhs.b); } } T[100000]; int now = 0; bool check(long long int s, long long int t) { long long int res = 0;...
replace
52
53
52
54
-11
p03019
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include...
replace
77
78
77
78
0
p03019
C++
Runtime Error
/////////////////////////////////////////////////////////////////////////////// #include <bits/stdc++.h> #include <sys/time.h> #include <time.h> #include <unistd.h> using namespace std; /////////////////////////////////////////////////////////////////////////////// #define DEBUG 0 #define pb push_back #define V ve...
/////////////////////////////////////////////////////////////////////////////// #include <bits/stdc++.h> #include <sys/time.h> #include <time.h> #include <unistd.h> using namespace std; /////////////////////////////////////////////////////////////////////////////// #define DEBUG 0 #define pb push_back #define V ve...
replace
268
269
268
269
0
p03019
C++
Runtime Error
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <unordered_map> #in...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <unordered_map> #in...
replace
20
22
20
22
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int mx = 15; long long n, x, mid, l = -1, r, d, ac[mx]; struct Test { long long b, l, u; long long s(long long t = x) { return t < b ? t * l : b * l + (t - b) * u; } } t[mx]; int main() { scanf("%lld%lld", &n, &x); for (int i = 0; i < n; i++) { scanf("%lld...
#include <bits/stdc++.h> using namespace std; const int mx = 100005; long long n, x, mid, l = -1, r, d, ac[mx]; struct Test { long long b, l, u; long long s(long long t = x) { return t < b ? t * l : b * l + (t - b) * u; } } t[mx]; int main() { scanf("%lld%lld", &n, &x); for (int i = 0; i < n; i++) { scanf("...
replace
2
3
2
3
0
p03019
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; int N, X; long long l[300010], r[300010], b[300010]; bool good(long long need) { long long extra = need % X; need /= X; if (need >= N) return true; long long sum = 0; vector<pair<long long, int>> v; for (int i = 1; i <= N; i++) { sum -= l[i] * b[i]; ...
#include "bits/stdc++.h" using namespace std; int N, X; long long l[300010], r[300010], b[300010]; bool good(long long need) { long long extra = need % X; need /= X; if (need >= N) return true; long long sum = 0; vector<pair<long long, int>> v; for (int i = 1; i <= N; i++) { sum -= l[i] * b[i]; ...
replace
45
46
45
46
0
p03019
Python
Time Limit Exceeded
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") def bisect_right_callable(fn, x, lo, hi): """ lo から hi-1 のうち、fn の結果が x 以下となる、最も右の値 + 1 bisect.bisect_right と同じ https://docs.python.org/ja/3/librar...
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") def bisect_right_callable(fn, x, lo, hi): """ lo から hi-1 のうち、fn の結果が x 以下となる、最も右の値 + 1 bisect.bisect_right と同じ https://docs.python.org/ja/3/librar...
replace
61
72
61
83
TLE
p03019
C++
Runtime Error
#include <bits/stdc++.h> #define WHOLE(v) (v).begin(), (v).end() #define REV_WHOLE(v) (v).rbegin(), (v).rend() using i64 = int64_t; using namespace std; template <class F> auto recursive(F f) { return [f](auto... a) { return f(f, a...); }; } template <class T> using rev_priority_queue = priority_queue<T, vector<T>, g...
#include <bits/stdc++.h> #define WHOLE(v) (v).begin(), (v).end() #define REV_WHOLE(v) (v).rbegin(), (v).rend() using i64 = int64_t; using namespace std; template <class F> auto recursive(F f) { return [f](auto... a) { return f(f, a...); }; } template <class T> using rev_priority_queue = priority_queue<T, vector<T>, g...
replace
43
44
43
46
0
p03019
C++
Runtime Error
// High above the clouds there is a rainbow... #include <bits/stdc++.h> #define F first #define S second #define PB push_back #define sz(s) int((s).size()) #define bit(n, k) (((n) >> (k)) & 1) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int maxn = 2010, mo...
// High above the clouds there is a rainbow... #include <bits/stdc++.h> #define F first #define S second #define PB push_back #define sz(s) int((s).size()) #define bit(n, k) (((n) >> (k)) & 1) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int maxn = 1e5 + 10...
replace
16
17
16
17
0
p03019
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #...
replace
51
52
51
52
0
p03019
C++
Runtime Error
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> #define int long long #define inf 1000000007 #define pa pair<int, int> #define ll long long #define pal pair<double, double> #define ppap pair<pa, int> #define PI 3.14159265358979323846 #define paa pair<int, char> #define mp make_pair #define p...
#include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> #define int long long #define inf 1000000007 #define pa pair<int, int> #define ll long long #define pal pair<double, double> #define ppap pair<pa, int> #define PI 3.14159265358979323846 #define paa pair<int, char> #define mp make_pair #define p...
replace
177
178
177
178
0
p03019
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define LOCAL using std::to_string; auto to_string(std::string s) -> std::string { return '"' + s + '"'; } auto to_string(char c) -> std::string { return "'" + std::string{c} + "'"; } auto to_string(const char *s) -> std::string { return to_string((std::string)s); } auto to_string(bool b) -> ...
#include <bits/stdc++.h> #define LOCAL using std::to_string; auto to_string(std::string s) -> std::string { return '"' + s + '"'; } auto to_string(char c) -> std::string { return "'" + std::string{c} + "'"; } auto to_string(const char *s) -> std::string { return to_string((std::string)s); } auto to_string(bool b) -> ...
delete
96
97
96
96
TLE
p03019
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 #define N 100010 #define int long long char getc() { char c = getchar(); while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9')) c = getchar(); return c; } int gcd(int n, int m) { return m == 0 ? n :...
#include <bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 #define N 100010 #define int long long char getc() { char c = getchar(); while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9')) c = getchar(); return c; } int gcd(int n, int m) { return m == 0 ? n :...
delete
53
55
53
53
TLE
p03019
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long lli; typedef pair<int, int> pii; const int maxn = 1e5 + 5; int n, X; int b[maxn], l[maxn], u[maxn]; lli empt[maxn], full[ma...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; typedef long long lli; typedef pair<int, int> pii; const int maxn = 1e5 + 5; int n, X; int b[maxn], l[maxn], u[maxn]; lli empt[maxn], full[ma...
replace
65
66
65
66
TLE
p03019
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, x; int b[111111], l[111111], u[111111]; long long m; struct P { long long x, y; }; P o[111111]; bool as(P a, P b) { return a.x > b.x; } bool f(int a) { long long t = 0, t2 = 0; for (int t = 1; t <= n; t++) o[t] = {(long long)(x - b[t]) * u[t] + (long lon...
#include <bits/stdc++.h> using namespace std; int n, x; int b[111111], l[111111], u[111111]; long long m; struct P { long long x, y; }; P o[111111]; bool as(P a, P b) { return a.x > b.x; } bool f(long long a) { long long t = 0, t2 = 0; for (int t = 1; t <= n; t++) o[t] = {(long long)(x - b[t]) * u[t] + (lo...
replace
13
14
13
14
0
p03020
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #include <vector> using namespace std; int read() { int x = 0; bool f = 0; char c = getchar(); while (c < '0' || c > '9') f |= c == '-', c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar(); retur...
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #include <vector> using namespace std; int read() { int x = 0; bool f = 0; char c = getchar(); while (c < '0' || c > '9') f |= c == '-', c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar(); retur...
replace
19
20
19
20
0
p03020
C++
Runtime Error
#include <cassert> #include <iostream> #include <queue> #include <vector> #define SOURCE 0 #define SINK 1 #define INF 1000000000000000000LL using namespace std; long long n; long long type[] = {2, 3, 4, 5}; struct edge { long long cost, from, to, revid, flow, cap; edge(long long fr, long long to, long long flo, lon...
#include <cassert> #include <iostream> #include <queue> #include <vector> #define SOURCE 0 #define SINK 1 #define INF 1000000000000000000LL using namespace std; long long n; long long type[] = {2, 3, 4, 5}; struct edge { long long cost, from, to, revid, flow, cap; edge(long long fr, long long to, long long flo, lon...
replace
22
26
22
26
0
p03020
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1000; const int maxm = 8e3; const ll inf = 1e18; const ll mx = 3e9; struct edge { int to; ll c; ll f; ll w; int nxt; } e[maxm + 10]; int head[maxm + 10]; int tot; int n; int S, T; void addedge(int u, int v, ll w, ll c) { //...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1000; const int maxm = 8e3; const ll inf = 1e18; const ll mx = 3e9; struct edge { int to; ll c; ll f; ll w; int nxt; } e[31000]; int head[maxm + 10]; int tot; int n; int S, T; void addedge(int u, int v, ll w, ll c) { // cou...
replace
13
14
13
14
0
p03020
C++
Runtime Error
#include <bits/stdc++.h> #define fo(i, l, r) for (int i = l; i <= r; i++) #define of(i, l, r) for (int i = l; i >= r; i--) #define fe(i, u) for (int i = head[u]; i; i = e[i].next) using namespace std; typedef long long ll; typedef pair<int, int> pii; inline void open(const char *s) { #ifndef ONLINE_JUDGE char str[20]...
#include <bits/stdc++.h> #define fo(i, l, r) for (int i = l; i <= r; i++) #define of(i, l, r) for (int i = l; i >= r; i--) #define fe(i, u) for (int i = head[u]; i; i = e[i].next) using namespace std; typedef long long ll; typedef pair<int, int> pii; inline void open(const char *s) { #ifndef ONLINE_JUDGE char str[20]...
replace
33
34
33
34
0
p03020
C++
Time Limit Exceeded
#include <cstdio> #include <cstring> #define M 20002 #define N 2019 int A[N], B[N], C[N], S, T, a[N], b[M], c[M], d[M], e[M], g[N], i, l, n, q[N], r, t; long long f[N]; bool h[N]; inline void add(int u, int v, int x, int y) { b[++t] = a[u], c[a[u] = t] = v, d[t] = x, e[t] = y, b[++t] = a[v], c[a[v] = t] = u, e[...
#include <cstdio> #include <cstring> #define M 20002 #define N 2019 int A[N], B[N], C[N], S, T, a[N], b[M], c[M], d[M], e[M], g[N], i, l, n, q[N], r, t; long long f[N]; bool h[N]; inline void add(int u, int v, int x, int y) { b[++t] = a[u], c[a[u] = t] = v, d[t] = x, e[t] = y, b[++t] = a[v], c[a[v] = t] = u, e[...
replace
21
22
21
22
TLE
p03020
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define SZ(x) ((int)x.size()) #define L(i, u) for (register int i = head[u]; i; i = nxt[i]) #define rep(i, a, b) for (register int i = (a); i <= (b); i++) #define per(i, a, b) for (register int i = (a); i >= (b); i--) using namespace std; ...
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define SZ(x) ((int)x.size()) #define L(i, u) for (register int i = head[u]; i; i = nxt[i]) #define rep(i, a, b) for (register int i = (a); i <= (b); i++) #define per(i, a, b) for (register int i = (a); i >= (b); i--) using namespace std; ...
replace
72
76
72
73
TLE
p03020
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define LL long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<LL, LL> #define x first #define y second #define N 131072 #define pi acos(-1) #define sqr(x) ((x) * (x)) #define pdd pair<double, double> #define MEMS(x) memset(x, -1,...
#include <bits/stdc++.h> using namespace std; #define LL long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<LL, LL> #define x first #define y second #define N 131072 #define pi acos(-1) #define sqr(x) ((x) * (x)) #define pdd pair<double, double> #define MEMS(x) memset(x, -1,...
replace
15
17
15
16
0
p03020
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> using ll = long long; int lst[3005], to[10005], pre[10005], cap[10005], cost[10005], que[2000005], tot; ll dis[3005]; bool in[3005], vis[3005]; inline void add_edge(int u, int v, int _cap, int _cost) { auto _add = [&](int x, int y, int ca, int co) { to...
#include <algorithm> #include <cstdio> #include <cstring> using ll = long long; int lst[3005], to[20005], pre[20005], cap[20005], cost[20005], que[2000005], tot; ll dis[3005]; bool in[3005], vis[3005]; inline void add_edge(int u, int v, int _cap, int _cost) { auto _add = [&](int x, int y, int ca, int co) { to...
replace
4
5
4
5
0
p03020
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <time.h> #include <vector> using namespace std; #define REP(i, x, y) for (ll i = x; i <= y; i++) #define rep(i, n) REP(i, 1, n) #defi...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <time.h> #include <vector> using namespace std; #define REP(i, x, y) for (ll i = x; i <= y; i++) #define rep(i, n) REP(i, 1, n) #defi...
replace
19
20
19
20
0
p03020
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; typedef long long LL; const LL INF = 0x3f3f3f3f3f3f3f3f; const LL LMAX = 100; LL ec = 1, to[2000005], cap[2000005], w[2000005], nxt[2000005], hed[1000005] = {0}; void add_edge(LL f, LL t, LL c, LL d) ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; typedef long long LL; const LL INF = 0x3f3f3f3f3f3f3f3f; const LL LMAX = 100; LL ec = 1, to[2000005], cap[2000005], w[2000005], nxt[2000005], hed[1000005] = {0}; void add_edge(LL f, LL t, LL c, LL d) ...
replace
27
29
27
29
TLE
p03020
C++
Runtime Error
// Legends Never Die. #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned int UI; typedef pair<int, int> pii; #define DEBUG(...) fprintf(stderr, __VA_ARGS__) #define mp make_pair #define fst first #define snd second #define SZ(u) ((int)(u).size()) #define ALL(u) (u).begin(), (u).end...
// Legends Never Die. #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned int UI; typedef pair<int, int> pii; #define DEBUG(...) fprintf(stderr, __VA_ARGS__) #define mp make_pair #define fst first #define snd second #define SZ(u) ((int)(u).size()) #define ALL(u) (u).begin(), (u).end...
replace
106
107
106
107
0
p03020
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> using namespace std; typedef long long ll; const int Maxn = 2004; const int Maxm = 10000; const ll INFLL = 0x3f3f3f3f3f3f3f3f; const int INF = 0x7FFFFFFF; struct MinCostMaxFlow_Dinic { struct Edge { int to, cap; ll cos; Edge *nxt...
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> using namespace std; typedef long long ll; const int Maxn = 20004; const int Maxm = 100000; const ll INFLL = 0x3f3f3f3f3f3f3f3f; const int INF = 0x7FFFFFFF; struct MinCostMaxFlow_Dinic { struct Edge { int to, cap; ll cos; Edge *n...
replace
7
9
7
9
0
p03020
C++
Runtime Error
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a; i <= b; ++i) #define fod(i, a, b) for (int i = a; i >= b; --i) const int N = 2115; const int INF = 1e7; typedef long long LL; using namespace std; vector<int> ap[N]; int n, n1, st, ed, f[N][N]; LL ans, pr[N][N]; void link(int x, int y, int w, LL c) { ap[x]....
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a; i <= b; ++i) #define fod(i, a, b) for (int i = a; i >= b; --i) const int N = 2115; const int INF = 1e7; typedef long long LL; using namespace std; vector<int> ap[N]; int n, n1, st, ed, f[N][N]; LL ans, pr[N][N]; void link(int x, int y, int w, LL c) { ap[x]....
replace
21
22
21
22
0
p03020
C++
Time Limit Exceeded
#include <bits/stdc++.h> typedef long long ll; namespace CF { #define ad(x) ((x - 1 ^ 1) + 1) const int N = 2054, M = 8000054; const ll INF = 0x3f3f3f3f3f3f3f3fll; struct edge { int u, v, c, f; edge(int u0 = 0, int v0 = 0, int c0 = 0, int f0 = 0) : u(u0), v(v0), c(c0), f(f0) {} } e[M]; int V, E, si = 1, ...
#include <bits/stdc++.h> typedef long long ll; namespace CF { #define ad(x) ((x - 1 ^ 1) + 1) const int N = 2054, M = 8000054; const ll INF = 0x3f3f3f3f3f3f3f3fll; struct edge { int u, v, c, f; edge(int u0 = 0, int v0 = 0, int c0 = 0, int f0 = 0) : u(u0), v(v0), c(c0), f(f0) {} } e[M]; int V, E, si = 1, ...
replace
38
39
38
40
TLE
p03020
C++
Time Limit Exceeded
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> struct Edge { int to, pair, fl...
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> struct Edge { int to, pair, fl...
replace
110
111
110
111
TLE
p03020
C++
Runtime Error
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a, _e = b; i <= _e; ++i) #define fd(i, a, b) for (int i = b, _e = a; i >= _e; --i) #define ll long long using namespace std; const int N = 1005; int n, x, y, w, i, js, la[N], T; int d[N * N], fr[N]; ll ans, f[N]; bool vi[N]; struct edge { int ne, y, l, c; } e[...
#include <bits/stdc++.h> #define fo(i, a, b) for (int i = a, _e = b; i <= _e; ++i) #define fd(i, a, b) for (int i = b, _e = a; i >= _e; --i) #define ll long long using namespace std; const int N = 1005; int n, x, y, w, i, js, la[N * 2], T; int d[N * N * 2], fr[N * 2]; ll ans, f[N * 2]; bool vi[N * 2]; struct edge { i...
replace
6
10
6
10
0
p03020
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long LL; const LL MAX = 1e17; const LL N = 1100; struct qq { LL x, y, z, z1, last; } e[N * 10]; LL num, last[N]; void init(LL x, LL y, LL z, LL z1) { num++; e[num].x =...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long LL; const LL MAX = 1e17; const LL N = 2100; struct qq { LL x, y, z, z1, last; } e[N * 10]; LL num, last[N]; void init(LL x, LL y, LL z, LL z1) { num++; e[num].x =...
replace
9
10
9
10
0
p03020
C++
Time Limit Exceeded
#include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; typedef long long ll; const int maxn = 2000, maxm = 20005; const ll inf = 1e11; struct Edge { Edge() {} Edge(int a, int b, ll c, int d) { v = a; f = b; w = c; nxt = d; } int v, f, w, nxt; }; int n, l...
#include <cstdio> #include <cstring> #include <iostream> #include <queue> using namespace std; typedef long long ll; const int maxn = 2000, maxm = 20005; const ll inf = 1e11; struct Edge { Edge() {} Edge(int a, int b, ll c, int d) { v = a; f = b; w = c; nxt = d; } int v, f, w, nxt; }; int n, l...
replace
42
45
42
44
TLE
p03021
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 2000 + 5; int n; char s[N]; vector<int> v[N]; int sum; void dfs(int p, int x, int d) { if (s[x] == '1') { sum += d; } for (auto u : v[x]) { if (u != p) { dfs(x, u, d + 1); } } } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 2000 + 5; int n; char s[N]; vector<int> v[N]; int sum; void dfs(int p, int x, int d) { if (s[x] == '1') { sum += d; } for (auto u : v[x]) { if (u != p) { dfs(x, u, d + 1); } } } ...
insert
49
49
49
51
TLE
p03021
C++
Runtime Error
/* Date: 3/9/2020 Context: ZR3月省选集训 if (sum[x] >= 2 * max[x]) { f[x] = sum[x] / 2; } else { int u = mp[x]; sum[x] - max[x] + max(0 \leq k \leq f[u], 2 * k \leq 2 * max[u] - sum[u]); } */ #include <bits/stdc++.h> #define int long long using namespace std; const int N = 2000 + 10; char ch[N]; int ...
/* Date: 3/9/2020 Context: ZR3月省选集训 if (sum[x] >= 2 * max[x]) { f[x] = sum[x] / 2; } else { int u = mp[x]; sum[x] - max[x] + max(0 \leq k \leq f[u], 2 * k \leq 2 * max[u] - sum[u]); } */ #include <bits/stdc++.h> #define int long long using namespace std; const int N = 20000 + 10; char ch[N]; int...
replace
15
16
15
16
0
p03021
C++
Runtime Error
#include <bits/stdc++.h> #define mp make_pair #define X first #define Y second #define FOR(i, a, b) for (int i = a; i <= b; i++) #define FOD(i, a, b) for (int i = a; i >= b; i--) using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 2010; const int INF = 1e9 + 7; int n, low[N], high[N...
#include <bits/stdc++.h> #define mp make_pair #define X first #define Y second #define FOR(i, a, b) for (int i = a; i <= b; i++) #define FOD(i, a, b) for (int i = a; i >= b; i--) using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 2010; const int INF = 1e9 + 7; int n, low[N], high[N...
replace
51
53
51
53
0
p03021
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
delete
94
95
94
94
0
p03021
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = (a); i <= (b); ++i) using namespace std; const int N = 2005; int n, sum[N], dep[N], sz[N]; char s[N]; int pp, lnk[N], nxt[N * 2], to[N * 2]; void ae(int k1, int k2) { to[++pp] = k2, nxt[pp] = lnk[k1], lnk[k1] = pp; } void pre(int k1, int k2) { sz[k1] = s[k1],...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = (a); i <= (b); ++i) using namespace std; const int N = 2005; int n, sum[N], dep[N], sz[N]; char s[N]; int pp, lnk[N], nxt[N * 2], to[N * 2]; void ae(int k1, int k2) { to[++pp] = k2, nxt[pp] = lnk[k1], lnk[k1] = pp; } void pre(int k1, int k2) { sz[k1] = s[k1],...
delete
19
20
19
19
TLE
p03021
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct number { int siz, low, high; number() : siz(0), low(0), high(0) {} }; int main() { do { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } while (false); int n; cin >> n; string str; cin >> str; vec...
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct number { int siz, low, high; number() : siz(0), low(0), high(0) {} }; int main() { do { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } while (false); int n; cin >> n; string str; cin >> str; vec...
replace
58
59
58
59
0
p03021
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, x, y, hd[2010], cnt, dis[2010], q[2010], l, r, f[2010], fa[2010], ans, siz[2010], col[2010], g[2010], c[2]; struct node { int to, next; } e[4010]; char s[2010]; void addedge(int x, int y) { e[++cnt] = (node){y, hd[x]}, hd[x] = cnt; e[++cnt] = (node){x, hd...
#include <bits/stdc++.h> using namespace std; int n, x, y, hd[2010], cnt, dis[2010], q[2010], l, r, f[2010], fa[2010], ans, siz[2010], col[2010], g[2010], c[2]; struct node { int to, next; } e[4010]; char s[2010]; void addedge(int x, int y) { e[++cnt] = (node){y, hd[x]}, hd[x] = cnt; e[++cnt] = (node){x, hd...
replace
25
30
25
34
-11
p03022
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int p = 998244353, inv2 = (p + 1) / 2; int qpow(int a, int k) { int ans = 1; while (k) { if (k & 1) ans = 1LL * ans * a % p; a = 1LL * a * a % p; k >>= 1; } return ans; } int FWT_xor(int d[], int n0, int flg) { for (int i = 1; i < (1 << n...
#include <bits/stdc++.h> using namespace std; const int p = 998244353, inv2 = (p + 1) / 2; int qpow(int a, int k) { int ans = 1; while (k) { if (k & 1) ans = 1LL * ans * a % p; a = 1LL * a * a % p; k >>= 1; } return ans; } void FWT_xor(int d[], int n0, int flg) { for (int i = 1; i < (1 << ...
replace
15
16
15
16
0
p03022
C++
Runtime Error
#include <bits/stdc++.h> #define clr(x) memset(x, 0, sizeof x) #define For(i, a, b) for (int i = (a); i <= (b); i++) #define Fod(i, b, a) for (int i = (b); i >= (a); i--) #define fi first #define se second #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) #define outval(x) cerr << #x " = " << x << endl #defin...
#include <bits/stdc++.h> #define clr(x) memset(x, 0, sizeof x) #define For(i, a, b) for (int i = (a); i <= (b); i++) #define Fod(i, b, a) for (int i = (b); i >= (a); i--) #define fi first #define se second #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) #define outval(x) cerr << #x " = " << x << endl #defin...
replace
45
46
45
46
0
p03022
C++
Runtime Error
#include <bits/stdc++.h> const int N = 18, M = 998244353; using namespace std; int n, l, a[N], b[N], t0, t1, sum; inline int inv(int x) { int y = 1, t = M - 2; for (; t; t >>= 1) t & 1 ? y = 1ll * y * x % M : 0, x = 1ll * x * x % M; return y; } inline void fwt(int *c, int t) { for (int i = 1; i < l; i <<= 1...
#include <bits/stdc++.h> const int N = 18, M = 998244353; using namespace std; int n, l, a[1 << N], b[1 << N], t0, t1, sum; inline int inv(int x) { int y = 1, t = M - 2; for (; t; t >>= 1) t & 1 ? y = 1ll * y * x % M : 0, x = 1ll * x * x % M; return y; } inline void fwt(int *c, int t) { for (int i = 1; i < ...
replace
3
4
3
4
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; /* Template file for Online Algorithmic Competitions */ /* Typedefs */ /* Basic types */ typedef long long ll; typedef long double ld; typedef unsigned long long ull; /* STL containers */ typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef ...
#include <bits/stdc++.h> using namespace std; /* Template file for Online Algorithmic Competitions */ /* Typedefs */ /* Basic types */ typedef long long ll; typedef long double ld; typedef unsigned long long ull; /* STL containers */ typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef ...
delete
82
88
82
82
0
p03023
C++
Runtime Error
/*------------------------Original Copyright belongs to-------------------------/ ! ! ! ## ## ## ## ! ! # # # # ! ! ### #### ### ### ## # ! ! # # # # # # # # # ## ! ! # # # ### ###...
/*------------------------Original Copyright belongs to-------------------------/ ! ! ! ## ## ## ## ! ! # # # # ! ! ### #### ### ### ## # ! ! # # # # # # # # # ## ! ! # # # ### ###...
replace
67
69
67
69
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) #define present(c, x) ((c).find(x) != (c).end()) #define cpresent(c, x) (find(all(c), x) != (c).end()) #define LSOne(i) (i & (-i...
#include <bits/stdc++.h> #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define tr(c, i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) #define present(c, x) ((c).find(x) != (c).end()) #define cpresent(c, x) (find(all(c), x) != (c).end()) #define LSOne(i) (i & (-i...
replace
57
61
57
58
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long int #define fr(i, a, b) for (ll i = a; i < b; i++) #define pb(v, a) v.push_back(a) #define Sort(v) sort(v.begin(), v.end()) #define For(m) for (auto it = m.begin(); it != m.end(); it++) #define mp(p1, p2) make_pair(p1, p2) #define mod 1000000007 #define PI 3.141592653589793...
#include <bits/stdc++.h> #define ll long long int #define fr(i, a, b) for (ll i = a; i < b; i++) #define pb(v, a) v.push_back(a) #define Sort(v) sort(v.begin(), v.end()) #define For(m) for (auto it = m.begin(); it != m.end(); it++) #define mp(p1, p2) make_pair(p1, p2) #define mod 1000000007 #define PI 3.141592653589793...
replace
17
21
17
21
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define lli long long int #define ulli unsigned long long int #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define loop(i, a, b) for (lli i = a; i < b...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; #define lli long long int #define ulli unsigned long long int #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define loop(i, a, b) for (lli i = a; i < b...
delete
70
74
70
70
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int #define ull unsigned long long int #define ld long double #define mod ...
#include <bits/stdc++.h> using namespace std; #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long int #define ull unsigned long long int #define ld long double #define mod ...
replace
31
37
31
32
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cout << 180 * (N - 2) / N << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; cout << 180 * (N - 2) << endl; }
replace
5
6
5
7
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define int long long #define ld long double #define fi first #de...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define int long long #define ld long double #define fi first #de...
replace
33
36
33
34
0
p03023
C++
Runtime Error
#include <bits/stdc++.h> #include <math.h> using namespace std; int main(void) { int N; cin >> N; return (180 * (N) + 180); }
#include <bits/stdc++.h> #include <math.h> using namespace std; int main(void) { int N; cin >> N; cout << (180 + (N - 3) * 180); return 0; }
replace
6
7
6
8
208
p03025
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include...
replace
44
45
44
45
0
p03025
C++
Runtime Error
#include <bits/stdc++.h> namespace MMNMM { template <class SemiGroup, class size_type> constexpr SemiGroup pow(const SemiGroup &a, size_type n, const SemiGroup &b = SemiGroup::e()) { SemiGroup ret = b, p = a; while (n) { if (n & 1) ret *= p; p *= p; n >>= 1; } return r...
#include <bits/stdc++.h> namespace MMNMM { template <class SemiGroup, class size_type> constexpr SemiGroup pow(const SemiGroup &a, size_type n, const SemiGroup &b = SemiGroup::e()) { SemiGroup ret = b, p = a; while (n) { if (n & 1) ret *= p; p *= p; n >>= 1; } return r...
replace
204
206
204
207
-11
p03025
C++
Runtime Error
#include <stdio.h> #include <stdlib.h> #define MAX_N (100000L) #define MAX_FACT (MAX_N) #define NUM_MOD (1000000007L) long fs[MAX_FACT + 1], finvs[MAX_FACT + 1], invs[MAX_FACT + 1]; void combination_init() { fs[0] = fs[1] = 1; finvs[0] = finvs[1] = 1; invs[1] = 1; for (long i = 2; i <= MAX_FACT; i++) { f...
#include <stdio.h> #include <stdlib.h> #define MAX_N (300000L) #define MAX_FACT (MAX_N) #define NUM_MOD (1000000007L) long fs[MAX_FACT + 1], finvs[MAX_FACT + 1], invs[MAX_FACT + 1]; void combination_init() { fs[0] = fs[1] = 1; finvs[0] = finvs[1] = 1; invs[1] = 1; for (long i = 2; i <= MAX_FACT; i++) { f...
replace
3
4
3
4
0
p03025
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef tuple<int, int, int> T; const int MAX_N = (int)2e5 + 5; const lint MOD = (lint)1e9 + 7; lint E[MAX_N], inv_pow[MAX_N], ap[MAX_N], bp[MAX_N]; vector<lint> fact, fact_inv, inv; T ExtendedGcd(int a, int b) { if (b == 0) return T(1, 0, a)...
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef tuple<int, int, int> T; const int MAX_N = (int)2e5 + 5; const lint MOD = (lint)1e9 + 7; lint E[MAX_N], inv_pow[MAX_N], ap[MAX_N], bp[MAX_N]; vector<lint> fact, fact_inv, inv; T ExtendedGcd(int a, int b) { if (b == 0) return T(1, 0, a)...
replace
56
59
56
59
0
p03025
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include ...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include ...
replace
95
96
95
96
0
p03025
C++
Runtime Error
/** * author: otera **/ #include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <se...
/** * author: otera **/ #include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <se...
replace
179
180
179
180
0
p03025
C++
Runtime Error
// Optimise #include <bits/stdc++.h> using namespace std; #define Online 1 // #define multitest 1 #define Debug 1 void ControlIO(); void TimerStart(); void TimerStop(); #ifdef Debug #define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__); template <typename Arg1> void ZZ(const char *name, Arg1 &&arg1) { std::cerr << name << "...
// Optimise #include <bits/stdc++.h> using namespace std; #define Online 1 // #define multitest 1 #define Debug 1 void ControlIO(); void TimerStart(); void TimerStop(); #ifdef Debug #define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__); template <typename Arg1> void ZZ(const char *name, Arg1 &&arg1) { std::cerr << name << "...
replace
44
45
44
45
0
p03025
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define sd(x) scanf("%d", &(x)) #define pii pair<int, int> #define F first #define S second #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name...
#include <bits/stdc++.h> using namespace std; #define ll long long #define sd(x) scanf("%d", &(x)) #define pii pair<int, int> #define F first #define S second #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char *name, Arg1 &&arg1) { cerr << name...
replace
26
27
26
27
0
p03025
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define REP(i, b, e) for (ll i = (ll)b; i < (ll)e; i++) #define rep0(i, n) REP(i, 0ll, n) #define rep1(i, n) REP(i, 1ll, n + 1) const ll longinf = 1ll << 60; const int inf = (1 << 30) - 1; // II→factorialを計算するrange const ll MOD...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define REP(i, b, e) for (ll i = (ll)b; i < (ll)e; i++) #define rep0(i, n) REP(i, 0ll, n) #define rep1(i, n) REP(i, 1ll, n + 1) const ll longinf = 1ll << 60; const int inf = (1 << 30) - 1; // II→factorialを計算するrange const ll MOD...
replace
12
13
12
13
0
p03026
C++
Runtime Error
#include <bits/stdc++.h> #define For(i, a, b) for (int(i) = (a); (i) < (b); ++(i)) #define rFor(i, a, b) for (int(i) = (a)-1; (i) >= (b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef pair<int, int> ...
#include <bits/stdc++.h> #define For(i, a, b) for (int(i) = (a); (i) < (b); ++(i)) #define rFor(i, a, b) for (int(i) = (a)-1; (i) >= (b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef pair<int, int> ...
replace
12
14
12
14
0
p03026
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; void dfs(int node, vector<vector<int>> edge, vector<int> &val, priority_queue<int, vector<int>, greater<int>> &c) { if (val[node] != -1 || c.empty()) return; val[node] = 0; // 仮置き for (auto tar : edge[node]) { if (val[tar] == -1...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void dfs(int node, vector<vector<int>> &edge, vector<int> &val, priority_queue<int, vector<int>, greater<int>> &c) { if (val[node] != -1 || c.empty()) return; val[node] = 0; // 仮置き for (auto tar : edge[node]) { if (val[tar] == -...
replace
4
5
4
5
TLE
p03026
C++
Runtime Error
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; #de...
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; #de...
replace
63
64
63
64
0
p03026
C++
Time Limit Exceeded
#include <algorithm> #include <complex> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define REP(i, e) for (int i = 0; i < (int)(e...
#include <algorithm> #include <complex> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define REP(i, e) for (int i = 0; i < (int)(e...
insert
87
87
87
89
TLE
p03026
C++
Time Limit Exceeded
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; vector<vector<int>> to; vector<int> c; vector<bool> done; vector<int> nodes; vector<pair<int, int>> ab; int nodecount; queue<int> q; /* void bfs(int id) { done[id]=true; ...
#include <algorithm> #include <iomanip> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; vector<vector<int>> to; vector<int> c; vector<bool> done; vector<int> nodes; vector<pair<int, int>> ab; int nodecount; queue<int> q; /* void bfs(int id) { done[id]=true; ...
replace
87
88
87
88
TLE