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
p02921
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { string s, t; rep(i, 3) cin >> s.at(i); rep(i, 3) cin >> t.at(i); int count = 0; rep(i, 3) { if (s.at(i) == t.at(i)) count++; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { string s, t; cin >> s >> t; int count = 0; rep(i, 3) { if (s.at(i) == t.at(i)) count++; } cout << count << endl; }
replace
5
7
5
6
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::at: __n (which is 0) >= this->size() (which is 0)
p02921
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string S, T; int ans; cin >> S; cin >> T; for (int i = 0; i != 3; i++) { if (S[i] == T[i]) ans++; } return ans; }
#include <iostream> #include <string> using namespace std; int main() { string S, T; int ans; cin >> S; cin >> T; for (int i = 0; i != 3; i++) { if (S[i] == T[i]) ans++; } cout << ans << endl; return 0; }
replace
13
14
13
15
2
p02921
C++
Runtime Error
#include <stdio.h> int main(void) { char s[3], t[3]; int i, c; for (i = 0; i < 3; i++) { scanf("%c", s[i]); } for (i = 0; i < 3; i++) { scanf("%c", t[i]); } c = 0; for (i = 0; i < 3; i++) { if (s[i] == t[i]) c++; } printf("%d\n", c); return 0; }
#include <stdio.h> int main(void) { char s[3], t[3]; int i, c; scanf("%s", s); scanf("%s", t); c = 0; for (i = 0; i < 3; i++) { if (s[i] == t[i]) c++; } printf("%d\n", c); return 0; }
replace
4
10
4
6
0
p02921
C++
Runtime Error
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define freopen(N, M, Q) #endif #define ll long long #define fi first #define se second #define pb push_back #define eb emplace_back #define all(N) N.begin(), N.end() using namespace std; const ll INF = 1e9; int main() { ios_base::sync_with_stdio(false); freopen("input.txt", "r", stdin); string a, b; cin >> a >> b; int cnt = 0; for (int i = 0; i < a.size(); ++i) if (a[i] == b[i]) cnt++; cout << cnt << endl; return 0; }
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define freopen(N, M, Q) #endif #define ll long long #define fi first #define se second #define pb push_back #define eb emplace_back #define all(N) N.begin(), N.end() using namespace std; const ll INF = 1e9; int main() { ios_base::sync_with_stdio(false); // freopen("input.txt", "r", stdin); string a, b; cin >> a >> b; int cnt = 0; for (int i = 0; i < a.size(); ++i) if (a[i] == b[i]) cnt++; cout << cnt << endl; return 0; }
replace
19
20
19
20
0
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; return max(1, B / A + int(B % A != 0)); }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; A--; B--; cout << B / A + int(B % A != 0) << endl; return 0; }
replace
5
6
5
9
3
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int ans = 0; int cnt = 1; while (cnt < b) { cnt += a - 1; ans++; } cout << ans << endl; return 1; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int ans = 0; int cnt = 1; while (cnt < b) { cnt += a - 1; ans++; } cout << ans << endl; return 0; }
replace
13
14
13
14
1
p02922
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; typedef long long ll; ll deg(ll n) { ll count = 0; while (n != 0) { n /= 10; count++; } return count; } int main() { int a, b; cin >> a >> b; int ans = 0; int sum = 1; while (sum < b) { ans++; sum = a - 1; } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; typedef long long ll; ll deg(ll n) { ll count = 0; while (n != 0) { n /= 10; count++; } return count; } int main() { int a, b; cin >> a >> b; int ans = 0; int sum = 1; while (sum < b) { ans++; sum += a - 1; } cout << ans << endl; }
replace
21
22
21
22
TLE
p02922
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; int main() { int a, b; cin >> a >> b; int t = a - 1; int s = b - 1; int ans = (t + s - 1) / s; cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int a, b; cin >> a >> b; int s = a - 1; int t = b - 1; int ans = (t + s - 1) / s; cout << ans << endl; return 0; }
replace
8
10
8
10
0
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s >> t; int cnt = 0; for (int i = 0; i < 3; i++) { if (s.at(i) == t.at(i)) cnt++; } cout << cnt; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, cnt = 0, x = 1; cin >> a >> b; while (x < b) { x = x - 1 + a; cnt++; } cout << cnt; }
replace
4
10
4
9
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::at: __n (which is 1) >= this->size() (which is 1)
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> m >> n; m--; cout << (m + n - 2) / (n - 1) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; m--; cout << (m + n - 2) / (n - 1) << endl; return 0; }
replace
4
5
4
5
0
p02922
Python
Runtime Error
A, B = map(int, input().split()) if B == 1: print(0) else: C = A cnt = 1 while C < B: C += A - 1 cnt += 1 print(cnt)
A, B = map(int, input().split()) if B == 1: print(0) else: C = A cnt = 1 while C < B: C += A - 1 cnt += 1 print(cnt)
replace
10
12
10
11
0
p02922
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main(void) { int a, b; int i = 0; cin >> a >> b; int sum = 1; while (1) { sum = 1; if (sum >= b) break; i++; sum--; sum += a; } cout << i; }
#include <iostream> using namespace std; int main(void) { int a, b; int i = 0; cin >> a >> b; int sum = 1; while (1) { if (sum >= b) break; i++; sum--; sum += a; } cout << i; }
replace
9
10
9
10
TLE
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int a; cin >> a; int b; cin >> b; if (b == 1) { cout << 0 << '\n'; return 0; } float x = ceil(float(b - 1) / (a - 1)); cout << (int)x << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int a; cin >> a; int b; cin >> b; if (b == 1) { cout << 0 << '\n'; return 0; } float x = ceil(float(b - 1) / (a - 1)); cout << (int)x << '\n'; return 0; }
delete
6
10
6
6
0
p02922
C++
Time Limit Exceeded
/// Bismillahir Rahmanir Rahim /// ALLAH HU AKBAR #include <bits/stdc++.h> using namespace std; int main() { int A, B; int count = 1; cin >> A >> B; int y = A - 1; int x = A; while (A < B) { x--; x = x + A; count++; } if (B <= 1) count = 0; cout << count << endl; }
/// Bismillahir Rahmanir Rahim /// ALLAH HU AKBAR #include <bits/stdc++.h> using namespace std; int main() { int A, B; int count = 1; cin >> A >> B; int y = A - 1; int x = A; while (x < B) { x--; x = x + A; count++; } if (B <= 1) count = 0; cout << count << endl; }
replace
10
11
10
11
TLE
p02922
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define all(x) (x).begin(), (x).end() 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) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; a--; int res = 1; while (b > res) res += a; cout << (res - 1) / (a - 1) << endl; return 0; }
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define all(x) (x).begin(), (x).end() 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) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; a--; int res = 1; while (b > res) res += a; cout << (res - 1) / (a) << endl; return 0; }
replace
48
49
48
49
0
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; b--; a--; cout << (b - 1) / (a - 1) + 1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << (b + a - 3) / (a - 1) << endl; return 0; }
replace
5
8
5
6
0
p02922
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int ans = 0; int x = 1; while (x < b) { x--; ans += a; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int ans = 0; int x = 1; while (x < b) { x--; x += a; ans++; } cout << ans << endl; return 0; }
replace
11
12
11
13
TLE
p02922
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int A, B; cin >> A >> B; int c = 1, out = A; if (B == 1) { c = 0; } else { while (A < B) { out += A - 1; c++; } } cout << c << endl; return 0; }
#include <iostream> using namespace std; int main() { int A, B; cin >> A >> B; int c = 1, out = A; if (B == 1) { c = 0; } else { while (out < B) { out += A - 1; c++; } } cout << c << endl; return 0; }
replace
9
10
9
10
TLE
p02922
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; const long long MOD = 1000000007LL; const long long INF = 1e18; int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); } long long fast_exp(long long base, long long exp, long long mod = MOD) { long long tot = 1; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = tot * base % mod; base = base * base % mod; } return tot; } long long slow_mult(long long base, long long exp, long long mod = MOD) { long long tot = 0; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = (tot + base) % mod; base = base * 2 % mod; } return tot; } struct chash { static uint64_t splitmix64(uint64_t x) { x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } size_t operator()(pair<uint64_t, uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM) ^ (splitmix64(x.second + FIXED_RANDOM) >> 1); } }; int arr[502]; int main() { cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int a, b; cin >> a >> b; for (int i = 0; i <= a; ++i) { if (a * i - i + 1 >= b) { cout << i; return 0; } } assert(false); cout << a; return 0; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; const long long MOD = 1000000007LL; const long long INF = 1e18; int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); } long long fast_exp(long long base, long long exp, long long mod = MOD) { long long tot = 1; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = tot * base % mod; base = base * base % mod; } return tot; } long long slow_mult(long long base, long long exp, long long mod = MOD) { long long tot = 0; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = (tot + base) % mod; base = base * 2 % mod; } return tot; } struct chash { static uint64_t splitmix64(uint64_t x) { x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } size_t operator()(pair<uint64_t, uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM) ^ (splitmix64(x.second + FIXED_RANDOM) >> 1); } }; int arr[502]; int main() { cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int a, b; cin >> a >> b; for (int i = 0;; ++i) { if (a * i - i + 1 >= b) { cout << i; return 0; } } assert(false); cout << a; return 0; }
replace
62
63
62
63
0
p02922
C++
Runtime Error
#include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #define ull unsigned long long #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, j, n) for (int i = j; i < n; i++) #define RFOR(i, j, n) for (int i = j - 1; i >= n; i--) #define PREC(n) fixed << setprecision(n) #define print_array(v) \ REP(__k, v.size()) { \ cout << v[__k]; \ if (__k != v.size() - 1) \ cout << " "; \ else \ cout << endl; \ } \ value #define YesorNo(a) printf(a ? "Yes\n" : "No\n") using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b; cin >> a >> b; cout << ceil((a - 1) / (b - 1)) << endl; }
#include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #define ull unsigned long long #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, j, n) for (int i = j; i < n; i++) #define RFOR(i, j, n) for (int i = j - 1; i >= n; i--) #define PREC(n) fixed << setprecision(n) #define print_array(v) \ REP(__k, v.size()) { \ cout << v[__k]; \ if (__k != v.size() - 1) \ cout << " "; \ else \ cout << endl; \ } \ value #define YesorNo(a) printf(a ? "Yes\n" : "No\n") using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b; cin >> a >> b; int ans = 0, C = 1; while (C < b) { C += a - 1; ans++; } cout << ans << endl; return 0; }
replace
71
72
71
78
0
p02922
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, cnt = 0; cin >> a >> b; while (b > 1) { b - a + 1; cnt++; } cout << cnt; return 0; }
#include <iostream> using namespace std; int main() { int a, b, cnt = 0; cin >> a >> b; while (b > 1) { b -= a - 1; cnt++; } cout << cnt; return 0; }
replace
6
7
6
7
TLE
p02922
C++
Runtime Error
#include <iostream> int main() { int A, B; std::cin >> A >> B; int curr = 1; int cnt = 0; while (curr < B) { curr += (A - 1); cnt++; } return cnt; }
#include <iostream> int main() { int A, B; std::cin >> A >> B; int curr = 1; int cnt = 0; while (curr < B) { curr += (A - 1); cnt++; } std::cout << cnt; return 0; }
replace
13
14
13
15
3
p02922
C++
Runtime Error
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int tapNum = 0; int socket = 1; while (socket < b) { socket += a - 1; tapNum++; } return tapNum; }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int tapNum = 0; int socket = 1; while (socket < b) { socket += a - 1; tapNum++; } cout << tapNum << endl; return 0; }
replace
12
13
12
14
3
p02922
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b; cin >> b; int cur = 1, res = 0; while (cur < b) { ++res; cur += a - 1; } cout << res << endl; return 0; }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int cur = 1, res = 0; while (cur < b) { ++res; cur += a - 1; } cout << res << endl; return 0; }
replace
6
7
6
7
TLE
p02922
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a, b; cin >> a >> b; int origin = (b - 1 + a - 2) / (a - 1); int cur = 1; int cnt = 0; while (true) { if (cur * a >= b) { break; } cur *= a; } int has = (cur) / (a - 1); for (int i = 0; i <= 50; i++) { if (i * (a - 1) >= b - cur and i <= cur) { assert(has + i == origin); cout << has + i << '\n'; return 0; } } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a, b; cin >> a >> b; int origin = (b - 1 + a - 2) / (a - 1); int cur = 1; int cnt = 0; while (true) { if (cur * a >= b) { break; } cur *= a; } int has = (cur - 1) / (a - 1); for (int i = 0; i <= 50; i++) { if (i * (a - 1) >= b - cur and i <= cur) { assert(has + i == origin); cout << has + i << '\n'; return 0; } } }
replace
18
19
18
19
0
p02922
C++
Time Limit Exceeded
/* author : s@if */ #include <bits/stdc++.h> using namespace std; #define NIL -1 #define fi first #define sec second #define MAX INT_MAX #define INF 99999999 #define ll long long #define PI acos(-1.0) #define MOD 1000000007 #define PLL pair<ll, ll> #define PII pair<int, int> #define ull unsigned long long #define For(i, a, b) for (int i = a; i <= (int)b; i++) inline int in() { int x; scanf("%d", &x); return x; } bool Check(int N, int pos) { return (bool)(N & (1 << pos)); } int Set(int N, int pos) { return N = N | (1 << pos); } int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1}; int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; int hr[] = {-2, -2, -1, +1, +2, +2, -1, +1}; int hc[] = {+1, -1, +2, +2, -1, +1, -2, -2}; int dx[] = {+1, -1, +0, +0}; int dy[] = {+0, +0, +1, -1}; const int MAXN = (int)1e5 + 9; int main() { /* freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); */ int i, j, k, l, m, n, p, q, x, y, u, v, r, tc, t; cin >> m >> n; if (n == 1) { cout << 0 << endl; return 0; } vector<int> vv; p = m; for (i = 1; i <= 100; i++) { vv.push_back(m); m += p - 1; } for (i = 0; i < vv.size(); i++) { if (vv[i] >= n) break; } cout << i + 1 << endl; main(); return 0; } // read the question correctly (is y a vowel? what are the exact constraints?) // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
/* author : s@if */ #include <bits/stdc++.h> using namespace std; #define NIL -1 #define fi first #define sec second #define MAX INT_MAX #define INF 99999999 #define ll long long #define PI acos(-1.0) #define MOD 1000000007 #define PLL pair<ll, ll> #define PII pair<int, int> #define ull unsigned long long #define For(i, a, b) for (int i = a; i <= (int)b; i++) inline int in() { int x; scanf("%d", &x); return x; } bool Check(int N, int pos) { return (bool)(N & (1 << pos)); } int Set(int N, int pos) { return N = N | (1 << pos); } int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1}; int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; int hr[] = {-2, -2, -1, +1, +2, +2, -1, +1}; int hc[] = {+1, -1, +2, +2, -1, +1, -2, -2}; int dx[] = {+1, -1, +0, +0}; int dy[] = {+0, +0, +1, -1}; const int MAXN = (int)1e5 + 9; int main() { /* freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); */ int i, j, k, l, m, n, p, q, x, y, u, v, r, tc, t; cin >> m >> n; if (n == 1) { cout << 0 << endl; return 0; } vector<int> vv; p = m; for (i = 1; i <= 100; i++) { vv.push_back(m); m += p - 1; } for (i = 0; i < vv.size(); i++) { if (vv[i] >= n) break; } cout << i + 1 << endl; // main(); return 0; } // read the question correctly (is y a vowel? what are the exact constraints?) // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
replace
71
72
71
72
TLE
p02922
C++
Time Limit Exceeded
// #pragma GCC optimize("O3", "unroll-loops") // #pragma GCC target("avx2") #include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define FIXED cout << fixed << setprecision(12) #define RANDOM srand(94385) #define all(a) a.begin(), a.end() #define shuffle(a) \ for (int i = 0; i < sz(a); ++i) \ swap(a[i], a[rand() % sz(a)]); #define enter putchar('\n') #define space putchar(' ') #define Mem(a, x) memset(a, x, sizeof(a)) using namespace std; typedef long long ll; typedef pair<int, int> pii; void debug_out() { cerr << '\n'; } template <typename T, typename... R> void debug_out(const T &f, const R &...r) { cerr << f << " "; debug_out(r...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__); inline ll read() { ll x = 0; int f = 0; char ch = getchar(); while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar(); while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); return x = f ? -x : x; } inline void write(ll x) { if (x == 0) { putchar('0'); return; } if (x < 0) { putchar('-'); x = -x; } static char s[23]; int l = 0; while (x != 0) s[l++] = x % 10 + 48, x /= 10; while (l) putchar(s[--l]); } int lowbit(int x) { return x & (-x); } template <class T> T big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; } template <typename T, typename... R> T big(const T &f, const R &...r) { return big(f, big(r...)); } template <class T> T sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; } template <typename T, typename... R> T sml(const T &f, const R &...r) { return sml(f, sml(r...)); } template <class T, class U> inline void checkMin(T &x, U y) { if (y < x) x = y; } template <class T, class U> inline void checkMax(T &x, U y) { if (y > x) x = y; } template <class T, class U> inline bool ifMax(T &x, U y) { if (y > x) return x = y, true; return false; } template <class T, class U> inline bool ifMin(T &x, U y) { if (y < x) return x = y, true; return false; } const int M = 212345; // 2e5+5 const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1000000007; // 1e9+7 // HAVE FREE OPEN IN MAIN FUNCTION void init() { int a = read(), b = read(); b--; int t = b / (a - 1); if (t * (a - 1) < b) t++; write(t); enter; } void solve() {} int main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif init(); solve(); return 0; }
// #pragma GCC optimize("O3", "unroll-loops") // #pragma GCC target("avx2") #include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define FIXED cout << fixed << setprecision(12) #define RANDOM srand(94385) #define all(a) a.begin(), a.end() #define shuffle(a) \ for (int i = 0; i < sz(a); ++i) \ swap(a[i], a[rand() % sz(a)]); #define enter putchar('\n') #define space putchar(' ') #define Mem(a, x) memset(a, x, sizeof(a)) using namespace std; typedef long long ll; typedef pair<int, int> pii; void debug_out() { cerr << '\n'; } template <typename T, typename... R> void debug_out(const T &f, const R &...r) { cerr << f << " "; debug_out(r...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__); inline ll read() { ll x = 0; int f = 0; char ch = getchar(); while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar(); while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); return x = f ? -x : x; } inline void write(ll x) { if (x == 0) { putchar('0'); return; } if (x < 0) { putchar('-'); x = -x; } static char s[23]; int l = 0; while (x != 0) s[l++] = x % 10 + 48, x /= 10; while (l) putchar(s[--l]); } int lowbit(int x) { return x & (-x); } template <class T> T big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; } template <typename T, typename... R> T big(const T &f, const R &...r) { return big(f, big(r...)); } template <class T> T sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; } template <typename T, typename... R> T sml(const T &f, const R &...r) { return sml(f, sml(r...)); } template <class T, class U> inline void checkMin(T &x, U y) { if (y < x) x = y; } template <class T, class U> inline void checkMax(T &x, U y) { if (y > x) x = y; } template <class T, class U> inline bool ifMax(T &x, U y) { if (y > x) return x = y, true; return false; } template <class T, class U> inline bool ifMin(T &x, U y) { if (y < x) return x = y, true; return false; } const int M = 212345; // 2e5+5 const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1000000007; // 1e9+7 // HAVE FREE OPEN IN MAIN FUNCTION void init() { int a = read(), b = read(); b--; int t = b / (a - 1); if (t * (a - 1) < b) t++; write(t); enter; } void solve() {} int main() { init(); solve(); return 0; }
delete
115
119
115
115
TLE
p02923
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1000000007; int main() { long long n; long long h[10100]; cin >> n; for (size_t i = 0; i < n; i++) { cin >> h[i]; } int tempCount = 0; int maxCount = 0; for (size_t i = 1; i < n; i++) { if (h[i] <= h[i - 1]) { tempCount++; if (maxCount <= tempCount) { maxCount = tempCount; } } else { tempCount = 0; } } std::cout << maxCount << std::endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1000000007; int main() { long long n; long long h[100100]; cin >> n; for (size_t i = 0; i < n; i++) { cin >> h[i]; } int tempCount = 0; int maxCount = 0; for (size_t i = 1; i < n; i++) { if (h[i] <= h[i - 1]) { tempCount++; if (maxCount <= tempCount) { maxCount = tempCount; } } else { tempCount = 0; } } std::cout << maxCount << std::endl; return 0; }
replace
13
14
13
14
0
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int A = 0, N, Z, a; cin >> N; int B[N]; for (int i = 0; i < N; i++) { cin >> B[i]; } N -= 1; for (int s = 0; s < N; s++) { Z = 0; a = s + 1; for (int x = s; B[x] >= B[a] && x < N; x++) { Z++; a++; } if (A < Z) { A = Z; } } cout << A; return 0; }
#include <iostream> using namespace std; int main() { int A = 0, N, Z, a; cin >> N; int B[N]; for (int i = 0; i < N; i++) { cin >> B[i]; } N -= 1; for (int s = 0; s < N; s++) { Z = 0; a = s + 1; if (A < N - s) { for (int x = s; B[x] >= B[a] && x < N; x++) { Z++; a++; } if (A < Z) { A = Z; } } } cout << A; return 0; }
replace
14
20
14
22
TLE
p02923
Python
Time Limit Exceeded
n = int(input()) height = list(map(int, input().split())) max_count = 0 for i in range(n): count = 0 for j in range(i, n): if j == n - 1 or height[j] < height[j + 1]: break count += 1 max_count = max(max_count, count) print(max_count)
n = int(input()) height = list(map(int, input().split())) max_count = 0 count = 0 for i in range(n - 1): if height[i] < height[i + 1]: max_count = max(count, max_count) count = 0 continue count += 1 max_count = max(count, max_count) print(max_count)
replace
3
10
3
11
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> #include <vector> int main() { int N; std::cin >> N; std::vector<int> H(N); for (int i = 0; i < N; i++) { std::cin >> H[i]; } int max = -1; for (int i = 0; i < N; i++) { int cnt = 0; for (int j = i; j < N - 1; j++) { if (H[j + 1] <= H[j]) cnt++; else break; } if (cnt > max) max = cnt; } std::cout << max << std::endl; return 0; }
#include <iostream> #include <vector> int main() { int N; std::cin >> N; std::vector<int> H(N); for (int i = 0; i < N; i++) { std::cin >> H[i]; } int max = -1; for (int i = 0; i < N; i++) { int cnt = 0; for (int j = i; j < N - 1; j++) { if (H[j + 1] <= H[j]) cnt++; else break; } if (cnt > 0) i += cnt - 1; if (cnt > max) max = cnt; } std::cout << max << std::endl; return 0; }
insert
18
18
18
20
TLE
p02923
Python
Time Limit Exceeded
n = int(input()) h = list(map(int, input().split())) max_step = 0 for i in range(n): current_step = 0 for j in range(i + 1, n): if h[j - 1] >= h[j]: current_step += 1 if current_step > max_step: max_step = current_step else: i = j break print(max_step)
n = int(input()) h = list(map(int, input().split())) max_step = 0 current_step = 0 for i in range(n - 1): if h[i] >= h[i + 1]: current_step += 1 if current_step > max_step: max_step = current_step else: current_step = 0 print(max_step)
replace
4
14
4
12
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int A; cin >> A; vector<int> B(A); for (int i = 0; i < A; i++) { cin >> B.at(i); } int ans = 0; int tmp = 0; for (int i = 0; i < A; i++) { if (B.at(i) >= B.at(i + 1)) { tmp++; } else { tmp = 0; } ans = max(ans, tmp); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A; cin >> A; vector<int> B(A); for (int i = 0; i < A; i++) { cin >> B.at(i); } int ans = 0; int tmp = 0; for (int i = 0; i < A - 1; i++) { if (B.at(i) >= B.at(i + 1)) { tmp++; } else { tmp = 0; } ans = max(ans, tmp); } cout << ans << endl; }
replace
12
13
12
13
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { long long n; long long h[110000]; cin >> n; for (long long i = 0; i < n; i++) cin >> h[i]; long long storedCount = 0; long long eachCount = 0; for (long long i = 0; i < n; i++) { // cout << storedCount << eachCount << endl; if (storedCount < eachCount) storedCount = eachCount; eachCount = 0; for (long long j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) eachCount++; else break; } } cout << storedCount << endl; }
#include <iostream> using namespace std; int main() { long long n; long long h[110000]; cin >> n; for (long long i = 0; i < n; i++) cin >> h[i]; long long storedCount = 0; long long eachCount = 0; for (long long i = 0; i < n; i++) { // cout << storedCount << eachCount << endl; if (storedCount < eachCount) storedCount = eachCount; if (storedCount >= n - 1) break; eachCount = 0; for (long long j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) eachCount++; else break; } } cout << storedCount << endl; }
insert
16
16
16
18
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } int count = 0; vector<int> vec2; int a = vec.at(0); for (int i = 1; i < N; i++) { if (i == N - 1) { if (a >= vec.at(i)) { count++; vec2.push_back(count); break; } else { vec2.push_back(count); break; } } if (a >= vec.at(i)) { count++; a = vec.at(i); } else { vec2.push_back(count); count = 0; a = vec.at(i); } } sort(vec2.begin(), vec2.end()); reverse(vec2.begin(), vec2.end()); cout << vec2.at(0) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N == 1) { cout << 0 << endl; return 0; } vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } int count = 0; vector<int> vec2; int a = vec.at(0); for (int i = 1; i < N; i++) { if (i == N - 1) { if (a >= vec.at(i)) { count++; vec2.push_back(count); break; } else { vec2.push_back(count); break; } } if (a >= vec.at(i)) { count++; a = vec.at(i); } else { vec2.push_back(count); count = 0; a = vec.at(i); } } sort(vec2.begin(), vec2.end()); reverse(vec2.begin(), vec2.end()); cout << vec2.at(0) << endl; }
insert
6
6
6
10
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using namespace std; const long long INF = 1LL << 60; int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; int max = 0; for (int i = 0; i < n - 1; i++) { int cnt = 0; for (int j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) { cnt += 1; } else { break; } } if (cnt > max) { max = cnt; } } cout << max << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using namespace std; const long long INF = 1LL << 60; int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; int max = 0; for (int i = 0; i < n - 1; i++) { if (h[i] <= h[i - 1]) continue; int cnt = 0; for (int j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) { cnt += 1; } else { break; } } if (cnt > max) { max = cnt; } } cout << max << endl; return 0; }
insert
13
13
13
15
TLE
p02923
C++
Runtime Error
#include <iostream> using namespace std; int main() { int a, h[10005]; cin >> a; int i; int Max, ans; Max = 0; ans = 0; for (i = 0; i < a; i++) { cin >> h[i]; } for (i = 0; i < a - 1; i++) { if (h[i] >= h[i + 1]) { Max++; if (ans < Max) { ans = Max; } } else { Max = 0; } } cout << ans; return (0); }
#include <iostream> using namespace std; int main() { int a, h[100005]; cin >> a; int i; int Max, ans; Max = 0; ans = 0; for (i = 0; i < a; i++) { cin >> h[i]; } for (i = 0; i < a - 1; i++) { if (h[i] >= h[i + 1]) { Max++; if (ans < Max) { ans = Max; } } else { Max = 0; } } cout << ans; return (0); }
replace
3
4
3
4
0
p02923
Python
Time Limit Exceeded
#!/usr/bin/env python3 n = int(input()) h = list(map(int, input().split())) ans = 0 for i in range(n): tmp = 0 for j in range(i, n - 1): if h[j] < h[j + 1]: tmp = 0 else: tmp += 1 ans = max(ans, tmp) print(ans)
#!/usr/bin/env python3 n = int(input()) h = list(map(int, input().split())) ans = 0 tmp = 0 for i in range(n - 1): if h[i] < h[i + 1]: tmp = 0 else: tmp += 1 ans = max(ans, tmp) print(ans)
replace
4
12
4
11
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> #include <math.h> // #include <numeric> #include <algorithm> #include <map> #include <vector> using namespace std; #define n_max 100000 #define rep(i, a, n) for (int i = a; i < n; i++) #define rep2(i, a, n) for (int i = a; i <= n; i++) #define rrep(i, a, n) for (int i = a; i > n; i--) #define rrep2(i, a, n) for (int i = a; i >= n; i--) #define lrep(i, a, n) for (long int i = a; i < n; i++) #define in(a) cin >> a #define out(a) cout << a << endl int main() { int ans = 0; int N; cin >> N; int H[N]; rep(i, 0, N) { cin >> H[i]; } rep(i, 0, N - 1) { int tmp = 0; // cout << i << endl; rep(j, 0, N - i - 1) { if (H[i + j] < H[i + j + 1]) { break; } else { tmp++; } } ans = max(tmp, ans); } cout << ans << endl; return 0; }
#include <iostream> #include <math.h> // #include <numeric> #include <algorithm> #include <map> #include <vector> using namespace std; #define n_max 100000 #define rep(i, a, n) for (int i = a; i < n; i++) #define rep2(i, a, n) for (int i = a; i <= n; i++) #define rrep(i, a, n) for (int i = a; i > n; i--) #define rrep2(i, a, n) for (int i = a; i >= n; i--) #define lrep(i, a, n) for (long int i = a; i < n; i++) #define in(a) cin >> a #define out(a) cout << a << endl int main() { int ans = 0; int N; cin >> N; int H[N]; rep(i, 0, N) { cin >> H[i]; } rep(i, 0, N - 1) { if (ans > (N - (i + 1) - 1)) break; int tmp = 0; // cout << i << endl; rep(j, 0, N - i - 1) { if (H[i + j] < H[i + j + 1]) { break; } else { tmp++; } } ans = max(tmp, ans); } cout << ans << endl; return 0; }
insert
28
28
28
31
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) { cin >> H.at(i); } int i = 0; int c = 0; int M = 0; while (i < N) { if (H.at(i - 1) >= H.at(i)) { c++; if (i == N - 1) { M = max(M, c); } } else { M = max(M, c); c = 0; } i++; } cout << M << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) { cin >> H.at(i); } int i = 1; int c = 0; int M = 0; while (i < N) { if (H.at(i - 1) >= H.at(i)) { c++; if (i == N - 1) { M = max(M, c); } } else { M = max(M, c); c = 0; } i++; } cout << M << endl; }
replace
11
12
11
12
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 5)
p02923
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; int h[n]; for (int i(0); i < n; i++) { cin >> h[i]; } int ans(0); for (int i(0); i < n - 1; i++) { int j(0); while (h[i + j] >= h[i + j + 1]) { // printf("%d, h[%d] >= h[%d]\n",j,i+j,i+j+1); j++; if (i + j + 1 > n - 1) break; } if (j > ans) ans = j; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; int h[n]; for (int i(0); i < n; i++) { cin >> h[i]; } int ans(0); for (int i(0); i < n - ans - 1; i++) { int j(0); while (h[i + j] >= h[i + j + 1]) { // printf("%d, h[%d] >= h[%d]\n",j,i+j,i+j+1); j++; if (i + j + 1 > n - 1) break; } if (j > ans) ans = j; } cout << ans << endl; return 0; }
replace
19
20
19
20
TLE
p02923
C++
Runtime Error
#include <iostream> using namespace std; int main(void) { int n, h[1000], i, max = 0, cnt = 0; cin >> n; for (i = 0; i < n; i++) cin >> h[i]; for (i = n - 2; i >= 0; i--) { if (h[i] >= h[i + 1]) cnt++; else cnt = 0; if (max < cnt) max = cnt; } cout << max << endl; return 0; }
#include <iostream> using namespace std; int main(void) { int n, h[100000], i, max = 0, cnt = 0; cin >> n; for (i = 0; i < n; i++) cin >> h[i]; for (i = n - 2; i >= 0; i--) { if (h[i] >= h[i + 1]) cnt++; else cnt = 0; if (max < cnt) max = cnt; } cout << max << endl; return 0; }
replace
3
4
3
4
0
p02923
Python
Time Limit Exceeded
N = int(input()) H = list(map(int, input().split())) ans = [] count = 0 for i in range(N): for j in range(i + count, N): if j == N - 1: ans.append(count) count = 0 break if H[j] < H[j + 1]: ans.append(count) count = 0 break else: count += 1 print(max(ans))
N = int(input()) H = list(map(int, input().split())) ans = [] count = 0 for j in range(N): if j == N - 1: ans.append(count) count = 0 break if H[j] < H[j + 1]: ans.append(count) count = 0 continue elif H[j] >= H[j + 1]: count += 1 print(max(ans))
replace
5
17
5
16
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h.at(i); } int ans = 0; int count = 0; for (int i = 0; i < n; i++) { if (h.at(i) >= h.at(i + 1)) { count++; } else { ans = max(ans, count); count = 0; } } ans = max(ans, count); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h.at(i); } int ans = 0; int count = 0; for (int i = 0; i < n - 1; i++) { if (h.at(i) >= h.at(i + 1)) { count++; } else { ans = max(ans, count); count = 0; } } ans = max(ans, count); cout << ans << endl; }
replace
13
14
13
14
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int a[10010]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; int record = a[0]; int temp_ans = 0; for (int i = 1; i < n; i++) { if (a[i] <= record) { temp_ans += 1; record = a[i]; } else { ans = max(temp_ans, ans); temp_ans = 0; record = a[i]; } } ans = max(temp_ans, ans); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int a[100010]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; int record = a[0]; int temp_ans = 0; for (int i = 1; i < n; i++) { if (a[i] <= record) { temp_ans += 1; record = a[i]; } else { ans = max(temp_ans, ans); temp_ans = 0; record = a[i]; } } ans = max(temp_ans, ans); cout << ans << endl; return 0; }
replace
4
5
4
5
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long int i, k = 0; long long int n, a[5000], b[5000]; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; } long long int count1 = 0; for (i = 0; i < n - 1; i++) { if (a[i + 1] <= a[i]) { count1++; } else { b[k] = count1; k++; count1 = 0; } } b[k] = count1; k++; long long int max1 = -1; for (i = 0; i < k; i++) { if (b[i] > max1) { max1 = b[i]; } } cout << max1; }
#include <bits/stdc++.h> using namespace std; int main() { long long int i, k = 0; long long int n, a[500000], b[500000]; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; } long long int count1 = 0; for (i = 0; i < n - 1; i++) { if (a[i + 1] <= a[i]) { count1++; } else { b[k] = count1; k++; count1 = 0; } } b[k] = count1; k++; long long int max1 = -1; for (i = 0; i < k; i++) { if (b[i] > max1) { max1 = b[i]; } } cout << max1; }
replace
8
9
8
9
0
p02923
Python
Runtime Error
# -*- coding: utf-8 -*- # 整数の入力 def main(): n = int(input()) h = list(map(int, input().split())) result = [] count = 0 for i in range(n - 1): if h[i] < h[i + 1]: result.append(count) count = 0 continue count += 1 if i == n - 2: result.append(count) print(max(result)) if __name__ == "__main__": main()
# -*- coding: utf-8 -*- # 整数の入力 def main(): n = int(input()) h = list(map(int, input().split())) if n == 1: print(0) return result = [] count = 0 for i in range(n - 1): if h[i] < h[i + 1]: result.append(count) count = 0 continue count += 1 if i == n - 2: result.append(count) print(max(result)) if __name__ == "__main__": main()
insert
7
7
7
11
0
p02923
Python
Runtime Error
# coding: utf-8 n = int(input()) lst = list(map(int, input().split())) cnt = 0 data = [] for i in range(n - 1): if lst[i] >= lst[i + 1]: cnt += 1 else: data.append(cnt) cnt = 0 print(max(cnt))
# coding: utf-8 n = int(input()) lst = list(map(int, input().split())) cnt = 0 data = [] for i in range(n - 1): if lst[i] >= lst[i + 1]: cnt += 1 else: data.append(cnt) cnt = 0 data.append(cnt) print(max(data))
replace
11
12
11
13
TypeError: 'int' object is not iterable
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02923/Python/s153309090.py", line 12, in <module> print(max(cnt)) TypeError: 'int' object is not iterable
p02923
Python
Runtime Error
n = input() h_string = input() h_list = h_string.split(" ") for item in h_list: item = int(item) longest = 0 now_value = -1 now_length = 0 for value in h_list: if value <= now_value: now_length += 1 now_value = value if now_length > longest: longest = now_length else: if now_length > longest: longest = now_length now_value = value now_length = 0 print(longest)
n = input() h_string = input() h_list = h_string.split(" ") for i in range(len(h_list)): h_list[i] = int(h_list[i]) longest = 0 now_value = -1 now_length = 0 for value in h_list: if value <= now_value: now_length += 1 now_value = value if now_length > longest: longest = now_length else: if now_length > longest: longest = now_length now_value = value now_length = 0 print(longest)
replace
3
5
3
5
TypeError: '<=' not supported between instances of 'str' and 'int'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02923/Python/s196465841.py", line 14, in <module> if value <= now_value: TypeError: '<=' not supported between instances of 'str' and 'int'
p02923
Python
Runtime Error
from sys import stdin n = int(stdin.readline().rstrip()) h = [int(x) for x in stdin.readline().rstrip().split()] m = 0 count = 0 for i in range(n): if (i == n - 1) and (m < count): m = count else: if h[i] >= h[i + 1]: count += 1 else: if m < count: m = count count = 0 print(m)
from sys import stdin n = int(stdin.readline().rstrip()) h = [int(x) for x in stdin.readline().rstrip().split()] m = 0 count = 0 for i in range(n): if i == n - 1: if m < count: m = count else: if h[i] >= h[i + 1]: count += 1 else: if m < count: m = count count = 0 print(m)
replace
8
10
8
11
0
p02923
Python
Runtime Error
N = int(input()) H = [int, input().split(" ")] counter = -1 last_h = float("inf") _max = 0 for h in H: if h <= last_h: counter += 1 else: if _max < counter: _max = counter counter = 0 last_h = h if _max < counter: _max = counter print(_max)
N = int(input()) H = map(int, input().split()) counter = -1 last_h = float("inf") _max = 0 for h in H: if h <= last_h: counter += 1 else: if _max < counter: _max = counter counter = 0 last_h = h if _max < counter: _max = counter print(_max)
replace
1
2
1
2
TypeError: '<=' not supported between instances of 'type' and 'float'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02923/Python/s934114167.py", line 8, in <module> if h <= last_h: TypeError: '<=' not supported between instances of 'type' and 'float'
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; vector<int> h(n); for (size_t i = 0; i < n; i++) { cin >> h[i]; } int max = 0, ct = 0; for (size_t i = n - 1; i >= 0; i--) { if (i == n - 1 || h[i] < h[i + 1]) ct = 0; ct++; if (max < ct) max = ct; } cout << max - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; vector<int> h(n); for (size_t i = 0; i < n; i++) { cin >> h[i]; } int max = 0, ct = 0; for (int i = n - 1; i >= 0; i--) { if (i == n - 1 || h[i] < h[i + 1]) ct = 0; ct++; if (max < ct) max = ct; } cout << max - 1 << endl; }
replace
13
14
13
14
TLE
p02923
Python
Runtime Error
import sys from itertools import accumulate from collections import Counter input = sys.stdin.readline def main(): n = int(input()) H = list(map(int, input().split())) print( Counter(accumulate([H[i] < H[i + 1] for i in range(n - 1)])).most_common(1)[0][ 1 ] - 1 ) if __name__ == "__main__": main()
import sys from itertools import accumulate from collections import Counter input = sys.stdin.readline def main(): n = int(input()) H = list(map(int, input().split())) if n == 1: print(0) return # 連続した場合、同値 acc = list(accumulate([H[i] < H[i + 1] for i in range(n - 1)])) x, y = Counter(acc).most_common(1)[0] print(y if x == 0 else y - 1) if __name__ == "__main__": main()
replace
10
16
10
17
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; void solve(long long N, std::vector<float> H) { vector<float> dH(N - 1, 0); for (int i = 0; i < N - 1; ++i) { if (H[i + 1] - H[i] <= 0) dH[i] += 1; } // for(int i = 0; i < N; ++i) cout << dH[i] << endl; // cout << endl; vector<float> ans(N, 0); for (int i = 0; i < N; ++i) { if (dH[i] > 0) ans[i + 1] = ans[i] + dH[i]; else ans[i + 1] = 0; } // for(int i = 0; i < N; ++i) cout << ans[i] << endl; sort(ans.begin(), ans.end(), greater<float>()); cout << ans[0] << endl; } int main() { long long N; scanf("%lld", &N); std::vector<float> H(N); for (int i = 0; i < N; i++) { scanf("%fd", &H[i]); } solve(N, std::move(H)); return 0; }
#include <bits/stdc++.h> using namespace std; void solve(long long N, std::vector<float> H) { vector<float> dH(N - 1, 0); for (int i = 0; i < N - 1; ++i) { if (H[i + 1] - H[i] <= 0) dH[i] += 1; } // for(int i = 0; i < N; ++i) cout << dH[i] << endl; // cout << endl; vector<float> ans(N, 0); for (int i = 0; i < N - 1; ++i) { if (dH[i] > 0) ans[i + 1] = ans[i] + dH[i]; else ans[i + 1] = 0; } // for(int i = 0; i < N; ++i) cout << ans[i] << endl; sort(ans.begin(), ans.end(), greater<float>()); cout << ans[0] << endl; } int main() { long long N; scanf("%lld", &N); std::vector<float> H(N); for (int i = 0; i < N; i++) { scanf("%fd", &H[i]); } solve(N, std::move(H)); return 0; }
replace
12
13
12
13
0
p02923
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; const int maxn = 10005; int n, ans, h[maxn], f[maxn]; int main(void) { scanf("%d", &n); for (register int i = 1; i <= n; ++i) scanf("%d", &h[i]); for (register int i = 2; i <= n; ++i) { if (h[i] <= h[i - 1]) f[i] = f[i - 1] + 1; else f[i] = 0; ans = max(ans, f[i]); } printf("%d\n", ans); return 0; }
#include <algorithm> #include <cstdio> using namespace std; const int maxn = 100005; int n, ans, h[maxn], f[maxn]; int main(void) { scanf("%d", &n); for (register int i = 1; i <= n; ++i) scanf("%d", &h[i]); for (register int i = 2; i <= n; ++i) { if (h[i] <= h[i - 1]) f[i] = f[i - 1] + 1; else f[i] = 0; ans = max(ans, f[i]); } printf("%d\n", ans); return 0; }
replace
5
6
5
6
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> #include <cstring> #include <iostream> #include <math.h> using namespace std; class Mass { public: int N; long H[100]; }; int main() { Mass m; cin >> m.N; int i; int j = 0; int k = 0; for (i = 0; i < m.N; i++) { cin >> m.H[i]; if (i != 0 && m.H[i] <= m.H[i - 1]) { j++; } else { k = max(k, j); j = 0; } } cout << max(k, j); return 0; }
#include <bits/stdc++.h> #include <cstring> #include <iostream> #include <math.h> using namespace std; class Mass { public: int N; long H[100000]; }; int main() { Mass m; cin >> m.N; int i; int j = 0; int k = 0; for (i = 0; i < m.N; i++) { cin >> m.H[i]; if (i != 0 && m.H[i] <= m.H[i - 1]) { j++; } else { k = max(k, j); j = 0; } } cout << max(k, j); return 0; }
replace
9
10
9
10
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int cell[10000] = {0}; int N, input; cin >> N; for (int i = 0; i < N; i++) { cin >> input; cell[i] = input; } int curr = 0, _max = 0; for (int i = 0; i < N - 1; i++) { // cout << "i, i+1 => " << cell[i] << " " << cell[i + 1] << endl; if (cell[i] >= cell[i + 1]) { curr++; } else { curr = 0; } // cout << "max, curr => " << _max << " " << curr << endl; if (curr > _max) { _max = curr; } } cout << _max << endl; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int cell[100000] = {0}; int N, input; cin >> N; for (int i = 0; i < N; i++) { cin >> input; cell[i] = input; } int curr = 0, _max = 0; for (int i = 0; i < N - 1; i++) { // cout << "i, i+1 => " << cell[i] << " " << cell[i + 1] << endl; if (cell[i] >= cell[i + 1]) { curr++; } else { curr = 0; } // cout << "max, curr => " << _max << " " << curr << endl; if (curr > _max) { _max = curr; } } cout << _max << endl; }
replace
6
7
6
7
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define IFOR(i, a, b) for (int i = (b - 1); i >= (a); --i) #define RPT(i, a, b) for (int i = (a); i < ((a) + (b)); ++i) #define IRPT(i, a, b) for (int i = ((a) + (b)-1); i >= (a); --i) #define ALL(x) x.begin(), x.end() void solve() { int n; cin >> n; vector<ll> h(n); RPT(i, 0, n) cin >> h[i]; vector<int> ds; int d = 0; for (; d < n - 1;) { int cnt = 0; while (d < n - 1) { ++d; if (h[d - 1] < h[d]) break; cnt++; } ds.push_back(cnt); cnt = 0; } cout << *max_element(ALL(ds)) << endl; } int main() { solve(); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define IFOR(i, a, b) for (int i = (b - 1); i >= (a); --i) #define RPT(i, a, b) for (int i = (a); i < ((a) + (b)); ++i) #define IRPT(i, a, b) for (int i = ((a) + (b)-1); i >= (a); --i) #define ALL(x) x.begin(), x.end() void solve() { int n; cin >> n; vector<ll> h(n); RPT(i, 0, n) cin >> h[i]; vector<int> ds(1, 0); int d = 0; for (; d < n - 1;) { int cnt = 0; while (d < n - 1) { ++d; if (h[d - 1] < h[d]) break; cnt++; } ds.push_back(cnt); cnt = 0; } cout << *max_element(ALL(ds)) << endl; } int main() { solve(); return 0; }
replace
15
16
15
16
0
p02923
C++
Runtime Error
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef uint64_t ull; ll n, h[10000], ans, tmp; int main(void) { ll i; cin >> n; for (i = 0; i < n; i++) { cin >> h[i]; } for (i = 0; i < n - 1; i++) { if (h[i + 1] <= h[i]) tmp++; else { ans = max(ans, tmp); tmp = 0; } } ans = max(ans, tmp); cout << ans << endl; return 0; }
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef uint64_t ull; ll n, h[100000], ans, tmp; int main(void) { ll i; cin >> n; for (i = 0; i < n; i++) { cin >> h[i]; } for (i = 0; i < n - 1; i++) { if (h[i + 1] <= h[i]) tmp++; else { ans = max(ans, tmp); tmp = 0; } } ans = max(ans, tmp); cout << ans << endl; return 0; }
replace
8
9
8
9
0
p02923
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int main(int argc, char *argv[]) { int N; int count = 0; int count_max = 0; cin >> N; vector<int> v; int m; for (int i = 0; i < N; i++) { cin >> m; v.push_back(m); } for (int i = 0; i < N - 1; i++) { count = 0; for (int j = i; j < N - 1; j++) { if (v[j] < v[j + 1]) break; else { count++; // continue; } } if (count > count_max) count_max = count; } cout << count_max << endl; }
#include <iostream> #include <vector> using namespace std; int main(int argc, char *argv[]) { int N; int count = 0; int count_max = 0; cin >> N; vector<int> v; int m; for (int i = 0; i < N; i++) { cin >> m; v.push_back(m); } for (int i = 0; i < N - 1; i++) { count = 0; if (N - i < count_max) break; for (int j = i; j < N - 1; j++) { if (v[j] < v[j + 1]) break; else { count++; // continue; } } if (count > count_max) count_max = count; } cout << count_max << endl; }
insert
17
17
17
19
TLE
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <math.h> #include <numeric> #include <stdlib.h> using namespace std; int main() { int N, i, max = 0, j = 0; cin >> N; int H[N]; for (i = 0; i < N; i++) { cin >> H[i]; } for (i = 0; i < N - 1; i++) { for (j = 0; H[i + j] >= H[i + j + 1] && i + j + 1 < N;) { j++; } if (max < j) { max = j; } } cout << max << endl; }
#include <bits/stdc++.h> #include <math.h> #include <numeric> #include <stdlib.h> using namespace std; int main() { int N, i, max = 0, j = 0; cin >> N; int H[N]; for (i = 0; i < N; i++) { cin >> H[i]; } for (i = 0; i < N - 1; i++) { for (j = 0; H[i + j] >= H[i + j + 1] && i + j + 1 < N;) { j++; } if (max < j) { max = j; i = i + max; } } cout << max << endl; }
insert
19
19
19
20
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int N, *H, max = 0, c = 0, co = 0, s = 0; cin >> N; H = (int *)malloc(sizeof(int) * N); for (int i = 0; i < N; i++) { cin >> H[i]; } while (c < N) { co = c; s = 0; while (H[co] >= H[co + 1] && co < N - 1) { s++; co++; } if (max < s) { max = s; } c++; } cout << max; return 0; }
#include <iostream> using namespace std; int main() { int N, *H, max = 0, c = 0, co = 0, s = 0; cin >> N; H = (int *)malloc(sizeof(int) * N); for (int i = 0; i < N; i++) { cin >> H[i]; } while (c < N) { co = c; s = 0; while (H[co] >= H[co + 1] && co < N - 1) { s++; co++; } if (max < s) { max = s; } if (max >= N - c) break; c++; } cout << max; return 0; }
insert
23
23
23
25
TLE
p02923
C++
Time Limit Exceeded
/* * Project: AtCoder Beginners Contest 139 C - Lower * Author: toms74209200 <https://github.com/toms74209200> * * Created on 2020/08/26 * Copyright (c) 2020 toms74209200 * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ #include <cstdint> #include <cstdio> #include <vector> using namespace std; uint32_t n; vector<uint64_t> h; void solve() { uint32_t max_cnt = 0; for (auto i = h.begin(); i < h.end(); i++) { uint32_t cnt = 0; auto iter = i; while (*iter >= *next(iter) && iter < h.end() - 1) { cnt++; iter++; } max_cnt = max(max_cnt, cnt); } printf("%d\n", max_cnt); } int main() { scanf("%d", &n); h.resize(n); for (int i = 0; i < n; i++) { scanf("%lld", &h[i]); } solve(); }
/* * Project: AtCoder Beginners Contest 139 C - Lower * Author: toms74209200 <https://github.com/toms74209200> * * Created on 2020/08/26 * Copyright (c) 2020 toms74209200 * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ #include <cstdint> #include <cstdio> #include <vector> using namespace std; uint32_t n; vector<uint64_t> h; void solve() { uint32_t max_cnt = 0; for (auto i = h.begin(); i < h.end(); i++) { uint32_t cnt = 0; auto iter = i; while (*iter >= *next(iter) && iter < h.end() - 1) { cnt++; iter++; } max_cnt = max(max_cnt, cnt); if (iter == h.end() - 1) { break; } } printf("%d\n", max_cnt); } int main() { scanf("%d", &n); h.resize(n); for (int i = 0; i < n; i++) { scanf("%lld", &h[i]); } solve(); }
insert
29
29
29
32
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace ::std; int main() { int s; cin >> s; int array[s], score, max = 0, i, j; for (i = 0; i < s; i++) { cin >> array[i]; } for (i = 0; i < s - 1; i++) { j = i; // cout<<j<<endl; while (array[j] >= array[j + 1] && j < s - 1) { score++; // cout<<j; j++; } // cout<<endl; // cout<<score<<endl; if (score > max) max = score; score = 0; } cout << max; }
#include <iostream> using namespace ::std; int main() { int s; cin >> s; int array[s], score, max = 0, i, j; for (i = 0; i < s; i++) { cin >> array[i]; } for (i = 0; i < s - 1; i++) { j = i; // cout<<j<<endl; while (array[j] >= array[j + 1] && j < s - 1) { score++; // cout<<j; j++; } // cout<<endl; // cout<<score<<endl; if (score > max) max = score; if (max >= s - j) break; score = 0; } cout << max; }
insert
22
22
22
24
TLE
p02923
C++
Time Limit Exceeded
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N; int H[100000]; int ans = 0, count = 0; scanf("%d", &N); for (int i = 0; i < N; i++) scanf("%d", &H[i]); for (int i = 0; i < N; i++) { count = 0; for (int j = i; j < N - 1; j++) { if (H[j] < H[j + 1]) break; count++; } if (count > ans) ans = count; } printf("%d", ans); }
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N; int H[100000]; int ans = 0, count = 0; scanf("%d", &N); for (int i = 0; i < N; i++) scanf("%d", &H[i]); for (int i = 0; i < N; i++) { count = 0; for (int j = i; j < N - 1; j++) { if (H[j] < H[j + 1]) break; count++; } if (count > 0) i += count - 1; if (count > ans) ans = count; } printf("%d", ans); }
insert
22
22
22
24
TLE
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) { cin >> H[i]; } // i番目のマスに降り立ったときに移動可能な回数を格納 vector<int> can(N, 0); for (int i = 0; i < N - 1; i++) { if (i >= 1) { if (H[i] == H[i - 1]) continue; } int j = 0; while (H[i + j] >= H[i + j + 1]) { can[i] += 1; j++; if (i + j == N - 1) break; } } sort(can.begin(), can.end(), greater<int>()); cout << can[0] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) { cin >> H[i]; } // i番目のマスに降り立ったときに移動可能な回数を格納 vector<int> can(N, 0); for (int i = 0; i < N - 1; i++) { if (i >= 1) { if (H[i] <= H[i - 1]) continue; } int j = 0; while (H[i + j] >= H[i + j + 1]) { can[i] += 1; j++; if (i + j == N - 1) break; } } sort(can.begin(), can.end(), greater<int>()); cout << can[0] << endl; }
replace
18
19
18
19
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n; cin >> n; ll h[n], i, j, c = 0, d; for (i = 0; i < n; i++) { cin >> h[i]; } vector<ll> a; for (i = 1; i < n; i++) { if (i == n - 1) { if (h[i] <= h[i - 1]) { a.push_back(c + 1); } else a.push_back(c); } else if (h[i] <= h[i - 1]) { c++; } else { a.push_back(c); c = 0; } } ll mx = 0; mx = a[0]; for (i = 1; i < a.size(); i++) { if (a[i] > mx) { mx = a[i]; } } cout << mx; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n; cin >> n; ll h[n], i, j, c = 0, d; for (i = 0; i < n; i++) { cin >> h[i]; } vector<ll> a; if (n == 1) { cout << "0"; return 0; } for (i = 1; i < n; i++) { if (i == n - 1) { if (h[i] <= h[i - 1]) { a.push_back(c + 1); } else a.push_back(c); } else if (h[i] <= h[i - 1]) { c++; } else { a.push_back(c); c = 0; } } ll mx = 0; mx = a[0]; for (i = 1; i < a.size(); i++) { if (a[i] > mx) { mx = a[i]; } } cout << mx; }
insert
12
12
12
16
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<int> h(N); int ans = 0; rep(i, N) cin >> h[i]; rep(i, N - 1) { int temp = 0; rep(j, N - i - 1) { if (h[i + j] >= h[i + j + 1]) temp++; else break; } // cout << temp << endl; ans = max(ans, temp); } cout << ans; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<int> h(N); int ans = 0; rep(i, N) cin >> h[i]; rep(i, N - 1) { int temp = 0; rep(j, N - i - 1) { if (h[i + j] >= h[i + j + 1]) temp++; else break; } // cout << temp << endl; ans = max(ans, temp); if (ans >= N - i - 1) break; } cout << ans; return 0; }
insert
22
22
22
24
TLE
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int H[N]; for (int i = 0; i < N; i++) { cin >> H[i]; } int biggest = 0; for (int i = 0; i < N - 1; i++) { int counter = 0; int t = i; while (t < N - 1) { if (H[t] >= H[t + 1]) { counter++; t++; } else { break; } } biggest = max(counter, biggest); // cout << i << ' ' << biggest << endl; } cout << biggest; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int H[N]; for (int i = 0; i < N; i++) { cin >> H[i]; } int biggest = 0; for (int i = 0; i < N - 1; i++) { int counter = 0; int t = i; if (biggest >= N - 1) { break; } while (t < N - 1) { if (H[t] >= H[t + 1]) { counter++; t++; } else { break; } } biggest = max(counter, biggest); // cout << i << ' ' << biggest << endl; } cout << biggest; }
insert
18
18
18
21
TLE
p02923
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> typedef long long ll; using namespace std; #define mod 10007 #define rep(i, n) for (ll i = 0; i < n; i++) int main(void) { ll n; cin >> n; vector<ll> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } int max_cnt = 0; for (int i = 0; i < n - 1; i++) { int cnt = 0; for (int j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) { cnt++; } else { break; } } if (cnt > max_cnt) { max_cnt = cnt; } } cout << max_cnt << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> typedef long long ll; using namespace std; #define mod 10007 #define rep(i, n) for (ll i = 0; i < n; i++) int main(void) { ll n; cin >> n; vector<ll> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } int max_cnt = 0; for (int i = 0; i < n - 1; i++) { int cnt = 0; for (int j = i; j < n - 1; j++) { if (h[j] >= h[j + 1]) { cnt++; } else { break; } } if (cnt > max_cnt) { max_cnt = cnt; } if (n - max_cnt < n / 2) break; } cout << max_cnt << endl; return 0; }
insert
35
35
35
37
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int n, max_cnt = 0; cin >> n; int h[n]; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n - 1; i++) { int cnt = 0; for (int j = i + 1; j < n; j++) { if (h[j - 1] >= h[j]) { cnt++; max_cnt = max(max_cnt, cnt); } else { break; } } } cout << max_cnt << endl; return 0; }
#include <iostream> using namespace std; int main() { int n, max_cnt = 0; cin >> n; int h[n]; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < n - 1; i++) { int cnt = 0; if (n - i - 1 <= max_cnt) break; for (int j = i + 1; j < n; j++) { if (h[j - 1] >= h[j]) { cnt++; max_cnt = max(max_cnt, cnt); } else { break; } } } cout << max_cnt << endl; return 0; }
insert
11
11
11
13
TLE
p02923
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int num; cin >> num; vector<int> array(num, 0); for (int i = 0; i < num; i++) { int n; scanf("%d", &n); array[i] = n; } int ans = 0; for (int i = 0; i < num; i++) { int tmpCounter = 0; for (int j = i; j < num - 1; j++) { if (array[j] >= array[j + 1]) { tmpCounter++; } else { i = j; break; } } ans = max(ans, tmpCounter); } cout << ans << endl; }
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int num; cin >> num; vector<int> array(num, 0); for (int i = 0; i < num; i++) { int n; scanf("%d", &n); array[i] = n; } int ans = 0; for (int i = 0; i < num; i++) { int tmpCounter = 0; if (i + ans >= num) { break; } for (int j = i; j < num - 1; j++) { if (array[j] >= array[j + 1]) { tmpCounter++; } else { i = j; break; } } ans = max(ans, tmpCounter); } cout << ans << endl; }
insert
19
19
19
22
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int N; int ans = 0; int ans0 = 0; cin >> N; int H[N]; for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < N; i++) { ans0 = 0; for (int j = i; j < N - 1; j++) { if (H[j] >= H[j + 1]) { ans0++; } else { break; } } if (ans0 > ans) { ans = ans0; } } cout << ans << endl; }
#include <iostream> using namespace std; int main() { int N; int ans = 0; int ans0 = 0; cin >> N; int H[N]; for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < N; i++) { ans0 = 0; if (ans >= N - i) { break; } for (int j = i; j < N - 1; j++) { if (H[j] >= H[j + 1]) { ans0++; } else { break; } } if (ans0 > ans) { ans = ans0; } } cout << ans << endl; }
insert
16
16
16
19
TLE
p02923
C++
Runtime Error
#include <iostream> #include <string> using namespace std; const int MAX_N = 10005; int H[MAX_N]; bool check[MAX_N]; void init() { for (int i = 0; i < MAX_N; ++i) { check[i] = true; } check[0] = false; } int main() { int N; cin >> N; init(); for (int i = 0; i < N; ++i) { cin >> H[i]; if (i != 0 && H[i - 1] < H[i]) { check[i] = false; } } check[N] = false; /* for (int i = 0; i <= N; ++i) { cout << check[i] << " "; } cout << endl; */ int ans = 0; int cnt = 0; for (int i = 0; i <= N; ++i) { if (check[i]) { cnt++; } else { ans = max(ans, cnt); cnt = 0; } } cout << ans << endl; }
#include <iostream> #include <string> using namespace std; const int MAX_N = 100005; int H[MAX_N]; bool check[MAX_N]; void init() { for (int i = 0; i < MAX_N; ++i) { check[i] = true; } check[0] = false; } int main() { int N; cin >> N; init(); for (int i = 0; i < N; ++i) { cin >> H[i]; if (i != 0 && H[i - 1] < H[i]) { check[i] = false; } } check[N] = false; /* for (int i = 0; i <= N; ++i) { cout << check[i] << " "; } cout << endl; */ int ans = 0; int cnt = 0; for (int i = 0; i <= N; ++i) { if (check[i]) { cnt++; } else { ans = max(ans, cnt); cnt = 0; } } cout << ans << endl; }
replace
3
4
3
4
0
p02923
C++
Time Limit Exceeded
#include <algorithm> #include <cstdlib> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; int max = 0; for (int i = 0; i < n; i++) { // start point int count = 0; for (int k = i; k < n - 1; k++) { if (h[k] >= h[k + 1]) { count++; if (count > max) max = count; } else { break; } } } cout << max << endl; return 0; }
#include <algorithm> #include <cstdlib> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; int max = 0; int count = 0; for (int i = 0; i < n - 1; i++) { if (h[i] >= h[i + 1]) { count++; if (count > max) max = count; } else { count = 0; } } cout << max << endl; return 0; }
replace
16
27
16
24
TLE
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <cassert> #include <numeric> // #include <boost/multiprecision/cpp_int.hpp> #define ll long long int #define CON 100010 const long long mod = 1e9 + 7; const int INF = 1001001001; const int inf = 100000; // const ll inf=1e9+7; // const ll ful=1e18; using namespace std; // namespace mp = boost::multiprecision; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; ++i) { cin >> h[i]; } int ans = 0; int now = 0; for (int i = 0; i < n - 1; ++i) { now = 0; for (int j = i; j < n - 1; ++j) { if (h[j] >= h[j + 1]) { now++; if (now > ans) { ans = now; } continue; } break; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <cassert> #include <numeric> // #include <boost/multiprecision/cpp_int.hpp> #define ll long long int #define CON 100010 const long long mod = 1e9 + 7; const int INF = 1001001001; const int inf = 100000; // const ll inf=1e9+7; // const ll ful=1e18; using namespace std; // namespace mp = boost::multiprecision; int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; ++i) { cin >> h[i]; } int ans = 0; int now = 0; for (int i = 0; i < n - 1; ++i) { now = 0; for (int j = i; j < n - 1; ++j) { if (h[j] >= h[j + 1]) { now++; if (now > ans) { ans = now; } continue; } break; } if (ans >= n - i) break; } cout << ans << endl; return 0; }
insert
34
34
34
36
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep_ll(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; typedef long long ll; typedef unsigned long long u_ll; typedef pair<int, int> pair_; const long double PI = (acos(-1)); const int INF = 1001001001; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; int ans = 0; int cnt = 0; rep(i, n - 1) { if (h[i] >= h[i + i]) cnt++; else { ans = max(ans, cnt); cnt = 0; } } ans = max(ans, cnt); cout << ans; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep_ll(i, n) for (ll i = 0; i < (ll)(n); i++) using namespace std; typedef long long ll; typedef unsigned long long u_ll; typedef pair<int, int> pair_; const long double PI = (acos(-1)); const int INF = 1001001001; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; int ans = 0; int cnt = 0; rep(i, n - 1) { if (h[i] >= h[i + 1]) cnt++; else { ans = max(ans, cnt); cnt = 0; } } ans = max(ans, cnt); cout << ans; return 0; }
replace
34
35
34
35
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int m, n, c = 0; cin >> m >> n; int x = m - n; int y = x / (m - 1); cout << 1 + y; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int c = 0, m = 0; for (int i = n - 2; i >= 0; i--) { if (a[i] >= a[i + 1]) { c++; m = max(m, c); } else c = 0; } cout << m; }
replace
5
10
5
20
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n; cin >> n; vector<long long> h(n); rep(i, n) cin >> h[i]; int ans = 0; rep(i, n) { int cnt = 0; int j = i; while ((j < n - 1) && (h[j] >= h[j + 1])) { cnt++; j++; } ans = max(ans, cnt); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n; cin >> n; vector<long long> h(n); rep(i, n) cin >> h[i]; int ans = 0; rep(i, n) { int cnt = 0; int j = i; while ((j < n - 1) && (h[j] >= h[j + 1])) { cnt++; j++; } i = j; ans = max(ans, cnt); } cout << ans << endl; return 0; }
insert
19
19
19
20
TLE
p02923
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int main() { size_t N; cin >> N; vector<int> H(N, 0); for (auto &h : H) { cin >> h; } int move = 0; int moveMax = 0; size_t p = 0; while (p <= (N - 2)) { if (H[p] >= H[p + 1]) { ++move; } else { if (move > moveMax) { moveMax = move; } move = 0; } ++p; } moveMax = max(move, moveMax); cout << moveMax << endl; }
#include <iostream> #include <vector> using namespace std; int main() { size_t N; cin >> N; if (N == 1) { cout << 0 << endl; return 0; } vector<int> H(N, 0); for (auto &h : H) { cin >> h; } int move = 0; int moveMax = 0; size_t p = 0; while (p <= (N - 2)) { if (H[p] >= H[p + 1]) { ++move; } else { if (move > moveMax) { moveMax = move; } move = 0; } ++p; } moveMax = max(move, moveMax); cout << moveMax << endl; }
insert
7
7
7
12
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e12; const int inf = 1e9; const int mod = 1e9 + 7; typedef long long ll; typedef pair<ll, int> P; typedef set<int> S; int main() { cout << fixed << setprecision(10); int n; cin >> n; vector<ll> v(n); rep(i, n) cin >> v[i]; ll ans = 0; ll now = 0; for (int i = 0; i < n - 1; i++) { int j = i; now = 0; while (j + 1 < n) { if (v[j + 1] <= v[j]) now++; else break; j++; } ans = max(now, ans); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); i++) #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e12; const int inf = 1e9; const int mod = 1e9 + 7; typedef long long ll; typedef pair<ll, int> P; typedef set<int> S; int main() { cout << fixed << setprecision(10); int n; cin >> n; vector<ll> v(n); rep(i, n) cin >> v[i]; ll ans = 0; ll now = 0; for (int i = 0; i < n - 1; i++) { int j = i; now = 0; while (j + 1 < n) { if (v[j + 1] <= v[j]) now++; else break; j++; } ans = max(now, ans); i = j; } cout << ans << endl; return 0; }
insert
30
30
30
31
TLE
p02923
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<string, int>; const double PI = acos(-1); int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h.at(i); vector<int> a(n - 1); rep(i, n - 1) { a.at(i) = h.at(i) - h.at(i + 1); } vector<int> b; int x = 0; rep(i, n - 1) { if (a.at(i) >= 0) { x++; if (i == n - 2) b.push_back(x); } else { b.push_back(x); x = 0; } } sort(b.begin(), b.end()); cout << b.back() << endl; }
#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<string, int>; const double PI = acos(-1); int main() { int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h.at(i); if (n == 1) { cout << 0 << endl; return 0; } vector<int> a(n - 1); rep(i, n - 1) { a.at(i) = h.at(i) - h.at(i + 1); } vector<int> b; int x = 0; rep(i, n - 1) { if (a.at(i) >= 0) { x++; if (i == n - 2) b.push_back(x); } else { b.push_back(x); x = 0; } } sort(b.begin(), b.end()); cout << b.back() << endl; }
insert
12
12
12
16
0
p02923
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> H(N); vector<int> cnt(N); for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < N; i++) { for (int j = i; j < N - 1; j++) { if (H[j] >= H[j + 1]) { cnt[i]++; } else { break; } } } sort(cnt.begin(), cnt.end()); cout << cnt[N - 1] << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> H(N); vector<int> cnt(N); for (int i = 0; i < N; i++) { cin >> H[i]; } for (int i = 0; i < N; i++) { for (int j = i; j < N - 1; j++) { if (H[j] >= H[j + 1]) { cnt[i]++; } else { break; } } if (cnt[i] * 2 >= N) { break; } } sort(cnt.begin(), cnt.end()); cout << cnt[N - 1] << endl; }
insert
23
23
23
26
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int n, a[100000], c = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { int x = 0; for (int j = i; j < n - 1; j++) { if (a[j + 1] > a[j]) { break; } else { x++; } } if (x > c) c = x; } cout << c; }
#include <iostream> using namespace std; int main() { int n, a[100000], c = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { int x = 0; for (; i < n - 1; i++) { if (a[i + 1] > a[i]) { break; } else { x++; } } if (x > c) c = x; } cout << c; }
replace
15
17
15
17
TLE
p02923
C++
Runtime Error
/************************************************************************ * -> Bismillahir Rahmanir Rahim <- * * * * * * * * * * __________ .___ .__ ____ ________ * * \______ \_____ __| _/ ______| |__ _____ /_ |\_____ \ * * | | _/\__ \ / __ | / ___/| | \ \__ \ | | / ____/ * * | | \ / __ \_/ /_/ | \___ \ | Y \ / __ \_ | |/ \ * * |______ /(____ /\____ | /____ >|___| /(____ / |___|\_______ \ * * \/ \/ \/ \/ \/ \/ \/ * * * * * * * * .=., * * ;c =\ * * __| _/ * * .'-'-._/-'-._ * * /.. ____ \ * * /' _ [<BF>] ) \ * * ( / \--\_>/-/'._ ) * * \-;_/\__;__/ _/ _/ * * '._}|==o==\{_\/ * * / /-._.--\ \_ * * // / /| \ \ \ * * / | | | \; | \ \ * * / / | :/ \: \ \_\ * * / | /.'| /: | \ \ * * | | |--| |--| \_\ * * / _/ \ | | /___--._) \ * * |_(---'-| > | | '-' * * /_/ \_\ * * * ***********************************************************************/ #include <bits/stdc++.h> using namespace std; #define pi acos(-1) typedef long long ll; typedef unsigned long long ull; typedef unsigned un; // defined taking input; #define sf scanf #define si(a) sf("%d", &a) #define sc(a) sf("%c", &a) #define sii(a, b) sf("%d %d", &a, &b) #define siii(a, b, c) sf("%d %d %d", &a, &b, &c) #define sl(a) sf("%lld", &a) #define sll(a, b) sf("%lld %lld", &a, &b); #define slll(a, b, c) sf("%lld %lld %lld", &a, &b, &c); #define pf printf #define pfi(a) pf("%d\n", a) #define pfl(a) pf("%ld\n", a) #define pfn pf("\n") #define pfyes pf("YES\n") #define pfno pf("NO\n") #define pfYes pf("Yes\n") #define pfNo pf("No\n") #define wh while #define wht(t) while (t--) int ar[10006]; int sum = 0; int m = 0; int main() { // freopen("input","r",stdin); int n; cin >> n; // int ar[n]; for (int i = 0; i < n; i++) { cin >> ar[i]; } for (int i = 0; i < n - 1; i++) { if (ar[i] >= ar[i + 1]) { sum++; if (m < sum) { m = sum; } } else { if (m < sum) { m = sum; } sum = 0; } } cout << m << endl; return 0; }
/************************************************************************ * -> Bismillahir Rahmanir Rahim <- * * * * * * * * * * __________ .___ .__ ____ ________ * * \______ \_____ __| _/ ______| |__ _____ /_ |\_____ \ * * | | _/\__ \ / __ | / ___/| | \ \__ \ | | / ____/ * * | | \ / __ \_/ /_/ | \___ \ | Y \ / __ \_ | |/ \ * * |______ /(____ /\____ | /____ >|___| /(____ / |___|\_______ \ * * \/ \/ \/ \/ \/ \/ \/ * * * * * * * * .=., * * ;c =\ * * __| _/ * * .'-'-._/-'-._ * * /.. ____ \ * * /' _ [<BF>] ) \ * * ( / \--\_>/-/'._ ) * * \-;_/\__;__/ _/ _/ * * '._}|==o==\{_\/ * * / /-._.--\ \_ * * // / /| \ \ \ * * / | | | \; | \ \ * * / / | :/ \: \ \_\ * * / | /.'| /: | \ \ * * | | |--| |--| \_\ * * / _/ \ | | /___--._) \ * * |_(---'-| > | | '-' * * /_/ \_\ * * * ***********************************************************************/ #include <bits/stdc++.h> using namespace std; #define pi acos(-1) typedef long long ll; typedef unsigned long long ull; typedef unsigned un; // defined taking input; #define sf scanf #define si(a) sf("%d", &a) #define sc(a) sf("%c", &a) #define sii(a, b) sf("%d %d", &a, &b) #define siii(a, b, c) sf("%d %d %d", &a, &b, &c) #define sl(a) sf("%lld", &a) #define sll(a, b) sf("%lld %lld", &a, &b); #define slll(a, b, c) sf("%lld %lld %lld", &a, &b, &c); #define pf printf #define pfi(a) pf("%d\n", a) #define pfl(a) pf("%ld\n", a) #define pfn pf("\n") #define pfyes pf("YES\n") #define pfno pf("NO\n") #define pfYes pf("Yes\n") #define pfNo pf("No\n") #define wh while #define wht(t) while (t--) int ar[100005]; int sum = 0; int m = 0; int main() { // freopen("input","r",stdin); int n; cin >> n; // int ar[n]; for (int i = 0; i < n; i++) { cin >> ar[i]; } for (int i = 0; i < n - 1; i++) { if (ar[i] >= ar[i + 1]) { sum++; if (m < sum) { m = sum; } } else { if (m < sum) { m = sum; } sum = 0; } } cout << m << endl; return 0; }
replace
65
66
65
66
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) cin >> H.at(i); priority_queue<int> A; int count = 0; for (int i = 0; i < N - 1; i++) { if (H.at(i) >= H.at(i + 1)) count++; else { A.push(count); count = 0; } } int ans = A.top(); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> H(N); for (int i = 0; i < N; i++) cin >> H.at(i); priority_queue<int> A; int count = 0; for (int i = 0; i < N - 1; i++) { if (H.at(i) >= H.at(i + 1)) count++; else { A.push(count); count = 0; } } A.push(count); int ans = A.top(); cout << ans << endl; }
insert
19
19
19
20
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n; cin >> n; int h[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; int max_count = 0; for (int i = 1; i < n; i++) { int j = i; int count = 0; while (j < n) { if (h[j] >= h[j + 1]) { j++; count++; max_count = max(max_count, count); } else { break; } } } cout << max_count; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n; cin >> n; int h[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; int max_count = 0; int count = 0; for (int i = n; i > 1; i--) { if (h[i] <= h[i - 1]) { count++; max_count = max(max_count, count); } else { count = 0; } } cout << max_count; return 0; }
replace
14
25
14
21
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> #include <iostream> #include <string> #include <time.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define fi first #define se second #define mod 1000000007 void solve() { ll n; cin >> n; vector<ll> h(n); ll i, j, k; for (i = 0; i < n; i++) cin >> h[i]; ll dp[n]; dp[n - 1] = 1; for (i = n - 2; i >= 0; i--) { if (h[i] >= h[i + 1]) dp[i] = dp[i + 1] + 1; else dp[i] = 1; } ll ans = INT_MIN; for (i = 0; i < n; i++) ans = max(ans, dp[i]); cout << ans - 1; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif clock_t tStart = clock(); ll t; // cin>>t; // while(t--) solve(); // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC); return 0; }
#include <bits/stdc++.h> #include <iostream> #include <string> #include <time.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define fi first #define se second #define mod 1000000007 void solve() { ll n; cin >> n; vector<ll> h(n); ll i, j, k; for (i = 0; i < n; i++) cin >> h[i]; ll dp[n]; dp[n - 1] = 1; for (i = n - 2; i >= 0; i--) { if (h[i] >= h[i + 1]) dp[i] = dp[i + 1] + 1; else dp[i] = 1; } ll ans = INT_MIN; for (i = 0; i < n; i++) ans = max(ans, dp[i]); cout << ans - 1; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif clock_t tStart = clock(); ll t; // cin>>t; // while(t--) solve(); // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC); return 0; }
replace
34
38
34
38
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, sum, saidai; cin >> N; sum = 0; saidai = 0; vector<int> vec(N); vector<int> wow(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } for (int i = 0; i < N; i++) { wow.at(i) = 0; } for (int i = 0; i < N - 1; i++) { for (int j = 0; j < N - 1; j++) { if (vec.at(j) >= vec.at(j + 1)) { wow.at(i)++; } else { break; } } } if (vec.at(N - 2) > vec.at(N - 1)) { wow.at(N - 1) = 1; } else { wow.at(N - 1) = 0; } for (int i = 0; i < N; i++) { if (saidai < wow.at(i)) { saidai = wow.at(i); } } cout << saidai << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, sum, saidai; cin >> N; sum = 0; saidai = 0; vector<int> vec(N); vector<int> wow(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } reverse(vec.begin(), vec.end()); for (int i = 1; i < N; i++) { if (vec.at(i - 1) <= vec.at(i)) sum++; else sum = 0; saidai = max(saidai, sum); } cout << saidai << endl; }
replace
13
34
13
20
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int N; int nowmax = 0; cin >> N; vector<int> data(N + 1); data.at(N) = 1000000001; for (int i = 0; i < N; i++) { cin >> data.at(i); } for (int i = 0; i < N; i++) // 落下地点 { int Now = i; int count = 0; while (data.at(Now) >= data.at(Now + 1)) { Now++; count++; } if (count > nowmax) { nowmax = count; } } cout << nowmax << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; int nowmax = 0; cin >> N; vector<int> data(N + 1); data.at(N) = 1000000001; for (int i = 0; i < N; i++) { cin >> data.at(i); } for (int i = 0; i < N; i++) // 落下地点 { int Now = i; int count = 0; while (data.at(Now) >= data.at(Now + 1)) { Now++; count++; } if (count > nowmax) { nowmax = count; } if (nowmax >= N - i) break; } cout << nowmax << endl; }
insert
24
24
24
26
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> int main() { int n; std::cin >> n; std::vector<long long> h(n); std::priority_queue<long long> q; for (int i = 0; i < n; i++) { std::cin >> h[i]; } int c = 0; for (int i = n - 1; i >= 1; i--) { if (h[i] <= h[i - 1]) { c++; continue; } q.push(c); c = 0; } std::cout << q.top() << std::endl; return 0; }
#include <bits/stdc++.h> int main() { int n; std::cin >> n; std::vector<long long> h(n); std::priority_queue<long long> q; for (int i = 0; i < n; i++) { std::cin >> h[i]; } int c = 0; for (int i = n - 1; i >= 1; i--) { if (h[i] <= h[i - 1]) { c++; continue; } q.push(c); c = 0; } q.push(c); std::cout << q.top() << std::endl; return 0; }
insert
20
20
20
21
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int N; int main() { cin >> N; int C[N]; for (int i = 0; i < N; i++) cin >> C[i]; int ans = 0, keep; for (int i = 0; i < N; i++) { keep = 0; for (int j = i; j < N - 1; j++) { if (C[j] < C[j + 1]) break; keep++; } ans = max(ans, keep); } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int N; int main() { cin >> N; int C[N]; for (int i = 0; i < N; i++) cin >> C[i]; int ans = 0, keep; for (int i = 0; i < N; i++) { if ((C[i - 1] >= C[i]) && i) continue; keep = 0; for (int j = i; j < N - 1; j++) { if (C[j] < C[j + 1]) break; keep++; } ans = max(ans, keep); } cout << ans << endl; }
insert
13
13
13
15
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main(void) { // Your code here! int n; int h[100000]; int i, j, k; int cnt = 0; int max = cnt; cin >> n; for (i = 0; i < n; i++) { cin >> h[i]; } for (i = 0; i < n; i++) { if (i == n - 1) { break; } k = i; j = i; while (h[k] >= h[++j]) { k = j; if (j == n) { break; } } cnt = j - i - 1; if (max < cnt) { max = cnt; } } cout << max; }
#include <iostream> #include <string> using namespace std; int main(void) { // Your code here! int n; int h[100000]; int i, j, k; int cnt = 0; int max = cnt; cin >> n; for (i = 0; i < n; i++) { cin >> h[i]; } for (i = 0; i < n; i++) { if (i == n - 1 || max > n / 2) { break; } k = i; j = i; while (h[k] >= h[++j]) { k = j; if (j == n) { break; } } cnt = j - i - 1; if (max < cnt) { max = cnt; } } cout << max; }
replace
16
17
16
17
TLE
p02923
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int main(int argc, char **argv) { int N; vector<int> H; int i, max = 0, count; cin >> N; H.resize(N); for (int c = 0; c < N; c++) { cin >> H.at(c); } for (i = 0; i < (H.size() - 2); i++) { count = 0; while ((i + count + 1) <= (H.size() - 1)) { if (H.at(i + count) < H.at(i + count + 1)) { break; } count++; } if (max < count) { max = count; } } cout << max << endl; return 0; }
#include <iostream> #include <vector> using namespace std; int main(int argc, char **argv) { int N; vector<int> H; int i, max = 0, count; cin >> N; H.resize(N); for (int c = 0; c < N; c++) { cin >> H.at(c); } for (i = 0; i < (H.size() - 1 - max); i++) { count = 0; while ((i + count + 1) <= (H.size() - 1)) { if (H.at(i + count) < H.at(i + count + 1)) { break; } count++; } if (max < count) { max = count; } } cout << max << endl; return 0; }
replace
15
16
15
16
TLE
p02923
C++
Runtime Error
#include <cmath> #include <iostream> using namespace std; int main() { int n; int h[10100]; int count = 0; int max = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < (n - 1); i++) { if (h[i] < h[i + 1]) { max = ((max < count) ? count : max); count = 0; } else { count++; } } max = ((max < count) ? count : max); cout << max << endl; return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { int n; int h[101000]; int count = 0; int max = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < (n - 1); i++) { if (h[i] < h[i + 1]) { max = ((max < count) ? count : max); count = 0; } else { count++; } } max = ((max < count) ? count : max); cout << max << endl; return 0; }
replace
6
7
6
7
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long #define lli long long int #define loop(i, x, n) for (lli i = x; i <= n; i++) #define rloop(i, n, x) for (lli i = n; i >= x; i--) typedef vector<ll> v64; typedef vector<pair<ll, ll>> vp64; typedef vector<bool> vbo; typedef set<ll> s64; typedef set<bool> sbo; typedef unordered_set<ll> us64; typedef map<ll, ll> m64; typedef unordered_map<ll, ll> um64; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; for (int i = 0; i < n; i++) { int x = 0; for (int j = i + 1; j < n; j++) { if (a[j] > a[j - 1]) break; x++; } ans = max(ans, x); } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define lli long long int #define loop(i, x, n) for (lli i = x; i <= n; i++) #define rloop(i, n, x) for (lli i = n; i >= x; i--) typedef vector<ll> v64; typedef vector<pair<ll, ll>> vp64; typedef vector<bool> vbo; typedef set<ll> s64; typedef set<bool> sbo; typedef unordered_set<ll> us64; typedef map<ll, ll> m64; typedef unordered_map<ll, ll> um64; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; int check[n]; check[n - 1] = 0; for (int i = n - 2; i >= 0; i--) { if (a[i] >= a[i + 1]) check[i] = check[i + 1] + 1; else check[i] = 0; ans = max(ans, check[i]); } cout << ans; return 0; }
replace
24
32
24
32
TLE
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> #include <queue> using namespace std; int main() { int long long n, cou = 0; cin >> n; vector<int> A(n); std::priority_queue<int> ans; for (int i = 0; i < n; i++) { cin >> A.at(i); } for (int a = 0; a < n; a++) { cou = 0; for (int b = a; b < n; b++) { if (b + 1 == n || A.at(b) < A.at(b + 1)) { ans.push(cou); if (ans.top() == n - 1) { cout << n - 1; exit(0); } break; } cou++; } } cout << ans.top(); }
#include <bits/stdc++.h> #include <iostream> #include <queue> using namespace std; int main() { int long long n, cou = 0; cin >> n; vector<int> A(n); std::priority_queue<int> ans; for (int i = 0; i < n; i++) { cin >> A.at(i); } for (int a = 0; a < n; a++) { cou = 0; for (int b = a; b < n; b++) { if (b + 1 == n || A.at(b) < A.at(b + 1)) { ans.push(cou); if (ans.top() == n - 1 || ans.top() >= n - a) { cout << ans.top(); exit(0); } break; } cou++; } } cout << ans.top(); }
replace
18
20
18
20
TLE
p02923
C++
Runtime Error
#include <bits/stdc++.h> // #include<ext/pb_ds/assoc_container.hpp> // #include<ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair typedef long long ll; #define fi first #define se second #define all(x) (x).begin(), (x).end() using namespace std; // using namespace __gnu_pbds; typedef vector<int> vi; // template<typename T> using ordered_set = tree<T, null_type, less<T>, // rb_tree_tag, tree_order_statistics_node_update>; const int INF = (int)1e10; int n, a[55]; void solve() { cin >> n; int mx = 0, cnt = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { if (a[i] >= a[i + 1]) { cnt++; } else { mx = max(mx, cnt); cnt = 0; } } cout << max(mx, cnt); } int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int tt = 1; while (tt--) { solve(); } return 0; }
#include <bits/stdc++.h> // #include<ext/pb_ds/assoc_container.hpp> // #include<ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair typedef long long ll; #define fi first #define se second #define all(x) (x).begin(), (x).end() using namespace std; // using namespace __gnu_pbds; typedef vector<int> vi; // template<typename T> using ordered_set = tree<T, null_type, less<T>, // rb_tree_tag, tree_order_statistics_node_update>; const int INF = (int)1e10; ll n, a[100500]; void solve() { cin >> n; int mx = 0, cnt = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { if (a[i] >= a[i + 1]) { cnt++; } else { mx = max(mx, cnt); cnt = 0; } } cout << max(mx, cnt); } int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int tt = 1; while (tt--) { solve(); } return 0; }
replace
23
24
23
24
0
p02923
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; vector<int> r(n); r[n - 1] = 0; for (int i = n - 2; i != 0; i--) { if (h[i] >= h[i + 1]) r[i] = r[i + 1] + 1; else r[i] = 0; } int M = 0; rep(i, n) M = max(M, r[i]); cout << M << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> h(n); rep(i, n) cin >> h[i]; vector<int> r(n); r[n - 1] = 0; for (int i = n - 2; i >= 0; i--) { if (h[i] >= h[i + 1]) r[i] = r[i + 1] + 1; else r[i] = 0; } int M = 0; rep(i, n) M = max(M, r[i]); cout << M << endl; return 0; }
replace
16
17
16
17
0
p02923
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<int> b(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } for (int i = 0; i < n; i++) { int c = 0; for (int j = 1; j < n - i; j++) { if (a.at(i + j - 1) >= a.at(i + j)) { c++; } else { break; } } b.at(i) = c; } sort(b.begin(), b.end()); reverse(b.begin(), b.end()); cout << b.at(0) << endl; }
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<int> b(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } for (int i = 0; i < n; i++) { int c = 0; for (int j = 1; j < n - i; j++) { if (a.at(i + j - 1) >= a.at(i + j)) { c++; } else { break; } } b.at(i) = c; if (c > n / 2) { break; } } sort(b.begin(), b.end()); reverse(b.begin(), b.end()); cout << b.at(0) << endl; }
insert
25
25
25
28
TLE