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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02923 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int N;
int H[10000];
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int max_step = 0;
int step = 0;
for (int i = 0; i < N - 1; ++i) {
if (H[i] >= H[i + 1]) {
step += 1;
} else {
max_step = max(step, max_step);
step = 0;
}
}
cout << max(max_step, step) << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int N;
int H[100000];
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int max_step = 0;
int step = 0;
for (int i = 0; i < N - 1; ++i) {
if (H[i] >= H[i + 1]) {
step += 1;
} else {
max_step = max(step, max_step);
step = 0;
}
}
cout << max(max_step, step) << endl;
return 0;
}
| replace | 5 | 6 | 5 | 6 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
vector<int> nvec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
for (int j = i; j < N - 1; j++) {
if (vec.at(j) >= vec.at(j + 1)) {
nvec.at(i)++;
}
// cout << nvec.at(i) << i << endl;}
else {
break;
}
}
}
sort(nvec.begin(), nvec.end());
cout << nvec.at(N - 1) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
vector<int> nvec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N; i++) {
for (int j = i; j < N - 1; j++) {
if (vec.at(j) >= vec.at(j + 1)) {
nvec.at(i)++;
}
// cout << nvec.at(i) << i << endl;}
else {
break;
}
}
if (nvec.at(i) + 1 >= N - nvec.at(i) - 1) {
break;
}
}
sort(nvec.begin(), nvec.end());
cout << nvec.at(N - 1) << endl;
} | insert | 23 | 23 | 23 | 26 | TLE | |
p02923 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#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 left, right;
left = right = 0;
priority_queue<int> que;
while (right < n - 1) {
if (h[right] >= h[right + 1]) {
right++;
if (right == n - 1)
que.push(right - left);
} else {
que.push(right - left);
right++;
left = right;
}
}
cout << que.top() << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#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 left, right;
left = right = 0;
priority_queue<int> que;
que.push(0);
while (right < n - 1) {
if (h[right] >= h[right + 1]) {
right++;
if (right == n - 1)
que.push(right - left);
} else {
que.push(right - left);
right++;
left = right;
}
}
cout << que.top() << endl;
return 0;
} | insert | 25 | 25 | 25 | 26 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int ans = 0;
for (int i = 0; i < n; i++) {
int cur = arr[i];
int tmp = 0;
for (int j = i + 1; j < n; j++) {
if (arr[j] > cur) {
break;
}
tmp++;
cur = arr[j];
}
ans = max(ans, tmp);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int ans = 0;
for (int i = 0; i < n; i++) {
int rem = n - (i + 1);
if (rem < ans) {
break;
}
int cur = arr[i];
int tmp = 0;
for (int j = i + 1; j < n; j++) {
if (arr[j] > cur) {
break;
}
tmp++;
cur = arr[j];
}
ans = max(ans, tmp);
}
cout << ans << endl;
return 0;
} | insert | 13 | 13 | 13 | 17 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, max = 0;
cin >> n;
vector<int> h;
int x;
for (int i = 0; i < n; i++) {
cin >> x;
h.push_back(x);
}
for (int i = 0; i < n; i++) {
int count = 0;
for (int j = i; j < n - 1; j++) {
if (h.at(j) >= h.at(j + 1)) {
count++;
} else {
break;
}
}
if (count > max) {
max = count;
}
}
cout << max;
return 0;
} | #include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, max = 0;
cin >> n;
vector<int> h;
int x;
for (int i = 0; i < n; i++) {
cin >> x;
h.push_back(x);
}
int count = 0;
for (int i = 0; i < n - 1; i++) {
if (h.at(i) >= h.at(i + 1)) {
count++;
} else {
count = 0;
}
if (count > max) {
max = count;
}
}
cout << max;
return 0;
} | replace | 15 | 23 | 15 | 21 | TLE | |
p02923 | C++ | Runtime Error | // include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VLL;
typedef vector<long long> vll;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define MULTIPLE(i, n, k) for (int i = (k); i < (n); i += k + 1) // 倍数ループ
// constant
//------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x) / sizeof(x[0])
//----------------search for specific figure--------------------
//--------------------------------------------------------------
pair<LL, LL> maxP(vll a, ll size) {
pair<ll, ll> p;
ll Max = a[0];
ll place = 0;
REP(i, size) {
if (a[i] > Max) {
Max = a[i];
place = i;
}
}
p.first = Max;
p.second = place;
return p;
}
pair<LL, LL> minP(vll a, ll size) {
pair<ll, ll> p;
ll min = a[0];
ll place = 0;
REP(i, size) {
if (a[i] < min) {
min = a[i];
place = i;
}
}
p.first = min;
p.second = place;
return p;
}
ll sumL(vll a, ll size) {
ll sum = 0;
REP(i, size) { sum += a[i]; }
return sum;
}
// aのなかにtがいくつあるか
ll counT(VLL a, ll t) {
sort(a.begin(), a.end());
return upper_bound(a.begin(), a.end(), t) -
lower_bound(a.begin(), a.end(), t);
}
#define COUNT(a, b) counT((a), (b))
#define MAX(x) maxP(x, x.size())
#define MIN(x) minP(x, x.size())
#define SUM(x) sumL(x, x.size())
//-------------------DIVIDE----------------------
// DIV[i][j] は i の j分割数 j == 0 && i != 0 なら 0
// 並び順を区別しない
ll DIV[1000 + 1][1000 + 1];
void divide(ll n, ll m) {
DIV[0][0] = 1;
FOR(i, 1, n + 1) { DIV[i][0] = 0; }
REP(i, n + 1) { DIV[i][1] = 1; }
FOR(i, 1, m + 1) {
FOR(t, 0, n + 1) {
if (DIV[t][i] > 0)
continue;
if (t >= i) {
DIV[t][i] = DIV[t - i][i] + DIV[t][i - 1];
} else {
DIV[t][i] = DIV[t][i - 1];
}
}
}
}
#define DIVIDE(a, b) (DIV[a][b] - DIV[a][(b)-1])
//------------素数判定-----------------
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
//----UnionFind-----
class UnionFind {
public:
vll par;
vll rank; // rankが高いほど上の親である
UnionFind(LL N) : par(N), rank(N) {
REP(i, N) par[i] = i;
REP(i, N) rank[i] = 0;
}
~UnionFind() {}
LL root(LL x) {
if (par[x] == x)
return x;
else {
par[x] = root(par[x]);
return par[x];
}
}
void unite(LL x, LL y) {
LL rx = root(x);
LL ry = root(y);
if (rx == ry)
return;
if (rank[rx] < rank[ry]) {
par[rx] = ry; // rankの高い方を親にする
} else {
par[ry] = rx;
if (rank[rx] == rank[ry]) {
// rankがどちらも同じ時、どちらか好きな方を親にしてそのrankを1上げる
rank[rx]++;
}
}
}
bool same(LL x, LL y) {
LL rx = root(x);
LL ry = root(y);
return rx == ry;
}
};
//--------BFS---------
class BFS_shortestDistance {
public:
BFS_shortestDistance(vector<vector<char>> p_, ll h_, ll w_) {
p = p_;
h = h_;
w = w_;
initial_number = h * w * 2;
REP(i, h) {
vector<LL> k(w);
REP(t, w) k[t] = initial_number;
field.push_back(k);
}
}
vector<vector<char>> p;
ll h;
ll w;
ll initial_number; // 初期化用数値
vector<vector<LL>> field; // この変数に書き込む
pair<LL, LL> plus(pair<LL, LL> &a, pair<LL, LL> &b) {
pair<LL, LL> p;
p.first = a.first + b.first;
p.second = a.second + b.second;
return p;
}
bool equal(pair<LL, LL> &a, pair<LL, LL> &b) {
return (a.first == b.first && a.second == b.second);
}
bool is_in_field(int h, int w, const pair<LL, LL> &point) {
const int c = point.second;
const int r = point.first;
return (0 <= c && c < w) && (0 <= r && r < h);
}
// fieldの中身を初期化
// 最短距離がh*w*2になることはないのでこれで初期化する
void init() {
REP(i, field.size()) {
REP(t, field[i].size()) { field[i][t] = initial_number; }
}
}
// sy , sx はスタート位置の 『INDEX』!!
// syが縦 sx が横
void shortest(ll sy, ll sx) {
// 初期化
init();
pair<LL, LL> c[4];
c[0].first = 0;
c[0].second = 1;
c[1].first = 0;
c[1].second = -1;
c[2].first = 1;
c[2].second = 0;
c[3].first = -1;
c[3].second = 0;
queue<pair<LL, LL>> Q;
pair<LL, LL> s;
s.first = sy;
s.second = sx;
field[sy][sx] = 0; // スタート位置のみ0で初期化
Q.push(s);
while (Q.empty() == false) {
pair<LL, LL> now = Q.front();
Q.pop();
for (int u = 0; u < 4; u++) {
pair<LL, LL> x = c[u];
pair<LL, LL> next = plus(now, x);
if (is_in_field(h, w, next)) {
if (p[next.first][next.second] == '.') {
// まだ到達してない == field の値が initial_number
if (field[next.first][next.second] == initial_number) {
field[next.first][next.second] = field[now.first][now.second] + 1;
Q.push(next);
} else {
// すでに到達済みである==これ以前にQueueから出てきたpairがすでに
// 到達している==すでにfieldの値が最小値であることは明らか;
}
}
}
}
}
}
};
//-----------MAIN------------//
int main() {
LL n;
cin >> n;
vll a(n);
REP(i, n) { cin >> a[i]; }
ll count = 0;
vll p;
REP(i, n - 1) {
if (a[i] >= a[i + 1])
count++;
else {
p.push_back(count);
count = 0;
}
if (i == n - 2) {
p.push_back(count);
count = 0;
}
}
cout << MAX(p).first << endl;
return 0;
}
| // include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VLL;
typedef vector<long long> vll;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define MULTIPLE(i, n, k) for (int i = (k); i < (n); i += k + 1) // 倍数ループ
// constant
//------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x) / sizeof(x[0])
//----------------search for specific figure--------------------
//--------------------------------------------------------------
pair<LL, LL> maxP(vll a, ll size) {
pair<ll, ll> p;
ll Max = a[0];
ll place = 0;
REP(i, size) {
if (a[i] > Max) {
Max = a[i];
place = i;
}
}
p.first = Max;
p.second = place;
return p;
}
pair<LL, LL> minP(vll a, ll size) {
pair<ll, ll> p;
ll min = a[0];
ll place = 0;
REP(i, size) {
if (a[i] < min) {
min = a[i];
place = i;
}
}
p.first = min;
p.second = place;
return p;
}
ll sumL(vll a, ll size) {
ll sum = 0;
REP(i, size) { sum += a[i]; }
return sum;
}
// aのなかにtがいくつあるか
ll counT(VLL a, ll t) {
sort(a.begin(), a.end());
return upper_bound(a.begin(), a.end(), t) -
lower_bound(a.begin(), a.end(), t);
}
#define COUNT(a, b) counT((a), (b))
#define MAX(x) maxP(x, x.size())
#define MIN(x) minP(x, x.size())
#define SUM(x) sumL(x, x.size())
//-------------------DIVIDE----------------------
// DIV[i][j] は i の j分割数 j == 0 && i != 0 なら 0
// 並び順を区別しない
ll DIV[1000 + 1][1000 + 1];
void divide(ll n, ll m) {
DIV[0][0] = 1;
FOR(i, 1, n + 1) { DIV[i][0] = 0; }
REP(i, n + 1) { DIV[i][1] = 1; }
FOR(i, 1, m + 1) {
FOR(t, 0, n + 1) {
if (DIV[t][i] > 0)
continue;
if (t >= i) {
DIV[t][i] = DIV[t - i][i] + DIV[t][i - 1];
} else {
DIV[t][i] = DIV[t][i - 1];
}
}
}
}
#define DIVIDE(a, b) (DIV[a][b] - DIV[a][(b)-1])
//------------素数判定-----------------
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // 偶数はあらかじめ除く
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// 素数ではない
return false;
}
}
// 素数である
return true;
}
//----UnionFind-----
class UnionFind {
public:
vll par;
vll rank; // rankが高いほど上の親である
UnionFind(LL N) : par(N), rank(N) {
REP(i, N) par[i] = i;
REP(i, N) rank[i] = 0;
}
~UnionFind() {}
LL root(LL x) {
if (par[x] == x)
return x;
else {
par[x] = root(par[x]);
return par[x];
}
}
void unite(LL x, LL y) {
LL rx = root(x);
LL ry = root(y);
if (rx == ry)
return;
if (rank[rx] < rank[ry]) {
par[rx] = ry; // rankの高い方を親にする
} else {
par[ry] = rx;
if (rank[rx] == rank[ry]) {
// rankがどちらも同じ時、どちらか好きな方を親にしてそのrankを1上げる
rank[rx]++;
}
}
}
bool same(LL x, LL y) {
LL rx = root(x);
LL ry = root(y);
return rx == ry;
}
};
//--------BFS---------
class BFS_shortestDistance {
public:
BFS_shortestDistance(vector<vector<char>> p_, ll h_, ll w_) {
p = p_;
h = h_;
w = w_;
initial_number = h * w * 2;
REP(i, h) {
vector<LL> k(w);
REP(t, w) k[t] = initial_number;
field.push_back(k);
}
}
vector<vector<char>> p;
ll h;
ll w;
ll initial_number; // 初期化用数値
vector<vector<LL>> field; // この変数に書き込む
pair<LL, LL> plus(pair<LL, LL> &a, pair<LL, LL> &b) {
pair<LL, LL> p;
p.first = a.first + b.first;
p.second = a.second + b.second;
return p;
}
bool equal(pair<LL, LL> &a, pair<LL, LL> &b) {
return (a.first == b.first && a.second == b.second);
}
bool is_in_field(int h, int w, const pair<LL, LL> &point) {
const int c = point.second;
const int r = point.first;
return (0 <= c && c < w) && (0 <= r && r < h);
}
// fieldの中身を初期化
// 最短距離がh*w*2になることはないのでこれで初期化する
void init() {
REP(i, field.size()) {
REP(t, field[i].size()) { field[i][t] = initial_number; }
}
}
// sy , sx はスタート位置の 『INDEX』!!
// syが縦 sx が横
void shortest(ll sy, ll sx) {
// 初期化
init();
pair<LL, LL> c[4];
c[0].first = 0;
c[0].second = 1;
c[1].first = 0;
c[1].second = -1;
c[2].first = 1;
c[2].second = 0;
c[3].first = -1;
c[3].second = 0;
queue<pair<LL, LL>> Q;
pair<LL, LL> s;
s.first = sy;
s.second = sx;
field[sy][sx] = 0; // スタート位置のみ0で初期化
Q.push(s);
while (Q.empty() == false) {
pair<LL, LL> now = Q.front();
Q.pop();
for (int u = 0; u < 4; u++) {
pair<LL, LL> x = c[u];
pair<LL, LL> next = plus(now, x);
if (is_in_field(h, w, next)) {
if (p[next.first][next.second] == '.') {
// まだ到達してない == field の値が initial_number
if (field[next.first][next.second] == initial_number) {
field[next.first][next.second] = field[now.first][now.second] + 1;
Q.push(next);
} else {
// すでに到達済みである==これ以前にQueueから出てきたpairがすでに
// 到達している==すでにfieldの値が最小値であることは明らか;
}
}
}
}
}
}
};
//-----------MAIN------------//
int main() {
LL n;
cin >> n;
vll a(n);
REP(i, n) { cin >> a[i]; }
ll count = 0;
vll p;
REP(i, n - 1) {
if (a[i] >= a[i + 1])
count++;
else {
p.push_back(count);
count = 0;
}
if (i == n - 2) {
p.push_back(count);
count = 0;
}
}
ll ma = 0;
REP(i, p.size()) {
if (ma < p[i])
ma = p[i];
}
cout << ma << endl;
return 0;
}
| replace | 330 | 332 | 330 | 337 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))
#define rep(i, a, b) for (int(i) = int(a); (i) < int(b); (i)++)
#define rrep(i, a, b) for (int(i) = int(a); (i) >= int(b); (i)--)
#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "
#define llint long long int
#define INF (long long)1e9 + 1
#define MOD (long long)1e9 + 7
#define INF64 (long long)1e18 + 1
#define F first
#define S second
#define Pii pair<int, int>
#define Pll pair<long long, long long>
#define Piii pair<int, pair<int, int>>
#define Plll pair<long long, pair<long long, long long>>
#define Vll(a, b, c) vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a, b, c, d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))
#define MAX_N 1000000
int main(void) {
// INPUT
llint N;
cin >> N;
vector<llint> H(N);
rep(i, 0, N) {
llint bufh;
cin >> H[i];
}
// SOLVE
llint ans = 0;
llint now;
llint bufa;
for (now = 0; now < N; now++) {
// auto itl = upper_bound(H.begin()+now,H.end(), H[now]);
// bufa = H.end() - (H.begin()+now);
// ans = max(ans,bufa);
// now = now + bufa -1;
bufa = 0;
for (int i = now; i < N - 1; i++) {
if (H[i] >= H[i + 1]) {
bufa++;
} else {
break;
}
}
ans = max(ans, bufa);
}
// OUTPUT
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))
#define rep(i, a, b) for (int(i) = int(a); (i) < int(b); (i)++)
#define rrep(i, a, b) for (int(i) = int(a); (i) >= int(b); (i)--)
#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "
#define llint long long int
#define INF (long long)1e9 + 1
#define MOD (long long)1e9 + 7
#define INF64 (long long)1e18 + 1
#define F first
#define S second
#define Pii pair<int, int>
#define Pll pair<long long, long long>
#define Piii pair<int, pair<int, int>>
#define Plll pair<long long, pair<long long, long long>>
#define Vll(a, b, c) vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a, b, c, d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))
#define MAX_N 1000000
int main(void) {
// INPUT
llint N;
cin >> N;
vector<llint> H(N);
rep(i, 0, N) {
llint bufh;
cin >> H[i];
}
// SOLVE
llint ans = 0;
llint now;
llint bufa;
for (now = 0; now < N; now++) {
// auto itl = upper_bound(H.begin()+now,H.end(), H[now]);
// bufa = H.end() - (H.begin()+now);
// ans = max(ans,bufa);
// now = now + bufa -1;
bufa = 0;
for (int i = now; i < N - 1; i++) {
if (H[i] >= H[i + 1]) {
bufa++;
} else {
break;
}
}
now += bufa;
ans = max(ans, bufa);
}
// OUTPUT
cout << ans << endl;
return 0;
}
| insert | 68 | 68 | 68 | 70 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N;
cin >> N;
vector<ll> H(N);
vector<ll> can_move(N - 1);
cin >> H[0];
for (int i = 1; i < N; i++) {
cin >> H[i];
if (H[i - 1] >= H[i]) {
can_move[i - 1] = 1;
} else {
can_move[i - 1] = 0;
}
}
int cnt = 0;
int i = 0;
int ans = 0;
while (true) {
if (can_move[i] == 1) {
cnt += 1;
ans = max(ans, cnt);
} else {
cnt = 0;
}
i += 1;
if (i == N - 1)
break;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N;
cin >> N;
if (N == 1) {
cout << 0 << endl;
return 0;
}
vector<ll> H(N);
vector<ll> can_move(N - 1);
cin >> H[0];
for (int i = 1; i < N; i++) {
cin >> H[i];
if (H[i - 1] >= H[i]) {
can_move[i - 1] = 1;
} else {
can_move[i - 1] = 0;
}
}
int cnt = 0;
int i = 0;
int ans = 0;
while (true) {
if (can_move[i] == 1) {
cnt += 1;
ans = max(ans, cnt);
} else {
cnt = 0;
}
i += 1;
if (i == N - 1)
break;
}
cout << ans << endl;
return 0;
} | insert | 8 | 8 | 8 | 14 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)
typedef long long ll;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// const int dy[] = { 0, 0, 1, -1 };
// const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);
vector<ll> h;
map<ll, ll> m;
int main() {
ll n;
ll ans = 0;
ll tmp = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
h.push_back(tmp);
}
for (int i = 0; i < n; i++) {
tmp = 0;
for (int j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1]) {
tmp++;
} else {
break;
}
}
if (tmp > ans) {
ans = tmp;
}
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)
typedef long long ll;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// const int dy[] = { 0, 0, 1, -1 };
// const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);
vector<ll> h;
map<ll, ll> m;
int main() {
ll n;
ll ans = 0;
ll tmp = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
h.push_back(tmp);
}
for (int i = 0; i < n; i++) {
tmp = 0;
if ((n - i) <= ans) {
break;
}
for (int j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1]) {
tmp++;
} else {
break;
}
}
if (tmp > ans) {
ans = tmp;
}
}
cout << ans << endl;
return 0;
}
| insert | 64 | 64 | 64 | 67 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n, i, max = 0, memo = 0;
long long h[10005];
cin >> n;
for (i = 1; i <= n; i++) {
cin >> h[i];
if (i > 1) {
if (h[i - 1] >= h[i])
memo++;
else
memo = 0;
if (memo > max)
max = memo;
}
}
cout << max << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n, i, max = 0, memo = 0;
long long h[100005];
cin >> n;
for (i = 1; i <= n; i++) {
cin >> h[i];
if (i > 1) {
if (h[i - 1] >= h[i])
memo++;
else
memo = 0;
if (memo > max)
max = memo;
}
}
cout << max << endl;
return 0;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
int count;
int ans = 0;
for (int i = 0; i < n - 1; i++) {
count = 0;
for (int h = i; h < n - 1; h++) {
if (a.at(h + 1) <= a.at(h))
count += 1;
else
break;
}
ans = max(count, ans);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
int count;
int ans = 0;
for (int i = 0; i < n - 1; i++) {
count = 0;
for (int h = i; h < n - 1; h++) {
if (a.at(h + 1) <= a.at(h))
count += 1;
else
break;
}
ans = max(count, ans);
if (ans > n - i)
break;
}
cout << ans << endl;
} | insert | 22 | 22 | 22 | 24 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int N;
int max_move(vector<int> &H, int i) {
int a = 0;
int j = i;
while (j <= N - 1) {
if (H[j] >= H[j + 1]) {
j++;
a++;
} else {
break;
}
}
return a;
}
int main() {
cin >> N;
vector<int> H(N + 1);
for (int i = 1; i <= N; i++) {
cin >> H[i];
}
int ans = 0;
for (int i = 1; i <= N; i++) {
ans = max(ans, max_move(H, i));
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int N;
int max_move(vector<int> &H, int i) {
int a = 0;
int j = i;
while (j <= N - 1) {
if (H[j] >= H[j + 1]) {
j++;
a++;
} else {
break;
}
}
return a;
}
int main() {
cin >> N;
vector<int> H(N + 1);
for (int i = 1; i <= N; i++) {
cin >> H[i];
}
int ans = 0;
int i = 1;
while (i <= N) {
int mov = max_move(H, i);
ans = max(ans, mov);
i = i + mov + 1;
}
cout << ans << endl;
} | replace | 27 | 29 | 27 | 32 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
int t;
vector<int> b(n);
for (int i = 0; i < n; i++) {
t = 0;
for (int j = i; j < n - 1; j++) {
if (a.at(j) >= a.at(j + 1))
t++;
else
break;
}
b.at(i) = t;
}
int M = *max_element(b.begin(), b.end());
cout << M << endl;
} | #include <algorithm>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
int t;
vector<int> b(n);
for (int i = 0; i < n; i += t + 1) {
t = 0;
for (int j = i; j < n - 1; j++) {
if (a.at(j) >= a.at(j + 1))
t++;
else
break;
}
b.at(i) = t;
}
int M = *max_element(b.begin(), b.end());
cout << M << endl;
} | replace | 17 | 18 | 17 | 18 | TLE | |
p02923 | C++ | Runtime Error | #include <iostream>
using namespace std;
#define ll long long
#define rep(i, end) for (ll i = 0; i < (ll)(end); i++)
int main() {
ll n, count = 0, maxi = 0, last;
cin >> n;
ll h[10001];
rep(i, n) { cin >> h[i]; }
rep(i, n) {
if (i != 0) {
if (h[i] <= last)
count++;
else {
maxi = max(maxi, count);
count = 0;
}
}
last = h[i];
}
maxi = max(maxi, count);
cout << maxi << endl;
return 0;
} | #include <iostream>
using namespace std;
#define ll long long
#define rep(i, end) for (ll i = 0; i < (ll)(end); i++)
int main() {
ll n, count = 0, maxi = 0, last;
cin >> n;
ll h[100001] = {};
rep(i, n) { cin >> h[i]; }
rep(i, n) {
if (i != 0) {
if (h[i] <= last)
count++;
else {
maxi = max(maxi, count);
count = 0;
}
}
last = h[i];
}
maxi = max(maxi, count);
cout << maxi << endl;
return 0;
} | replace | 8 | 9 | 8 | 9 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
using namespace std;
int main() {
int N;
veci H;
int cnt = 0;
cin >> N;
rep(i, N) {
int x;
cin >> x;
H.push_back(x);
}
rep(i, N) {
int amax = 0;
for (int j = i; j < N - 1; j++) {
if (H[j] >= H[j + 1]) {
amax++;
continue;
} else
break;
}
cnt = max(cnt, amax);
}
cout << cnt << endl;
return 0;
} | #include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#define vec2c vector<vector<char>>
#define vec2i vector<vector<int>>
#define vecc vector<char>
#define vecs vector<string>
#define veci vector<int>
#define vecd vector<double>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
using namespace std;
int main() {
int N;
veci H;
int cnt = 0;
cin >> N;
rep(i, N) {
int x;
cin >> x;
H.push_back(x);
}
rep(i, N) {
int amax = 0;
if (cnt > N - i)
break;
for (int j = i; j < N - 1; j++) {
if (H[j] >= H[j + 1]) {
amax++;
continue;
} else
break;
}
cnt = max(cnt, amax);
}
cout << cnt << endl;
return 0;
}
| insert | 34 | 34 | 34 | 36 | 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.at(i);
}
int maxi = 0;
for (int i = 0; i < N - 1; i++) {
int count = 0;
int checking = i;
bool canLoop = true;
while (canLoop) {
if (H.at(checking) >= H.at((checking) + 1)) {
count++;
checking++;
if (checking == N - 1) {
canLoop = false;
}
} else {
canLoop = false;
}
maxi = max(maxi, count);
}
}
cout << maxi << 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 maxi = 0;
for (int i = 0; i < N - 1; i++) {
int count = 0;
int checking = i;
bool canLoop = true;
while (canLoop) {
if (H.at(checking) >= H.at((checking) + 1)) {
count++;
checking++;
if (checking == N - 1) {
canLoop = false;
}
} else {
canLoop = false;
}
maxi = max(maxi, count);
}
if (maxi >= (N - i)) {
break;
}
}
cout << maxi << endl;
} | insert | 27 | 27 | 27 | 30 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int now = INT_MAX, maxx = 0, thisone = 0;
for (int j = 0; j < n - 1; j++) {
thisone = 0;
int under = j;
while (h[under] >= h[under + 1] && under < n - 1) {
thisone++;
under++;
}
maxx = max(thisone, maxx);
}
cout << maxx;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int now = INT_MAX, maxx = 0, thisone = 0;
for (int j = 0; j < n - 1; j++) {
thisone = 0;
int under = j;
while (h[under] >= h[under + 1] && under < n - 1) {
thisone++;
under++;
}
j = under;
maxx = max(thisone, maxx);
}
cout << maxx;
return 0;
} | insert | 16 | 16 | 16 | 17 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int n, h[100005], x, o;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n; i++) {
x = 0;
if ((i + 1) != n) {
for (int j = i + 1; j < n; j++) {
int b = j - 1;
if (h[b] >= h[j]) {
x++;
} else {
break;
}
}
}
if (x > o) {
o = x;
}
}
cout << o;
} | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int n, h[100005], x, o;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n; i++) {
x = 0;
if ((i + 1) != n && (n - (i + 1) > o)) {
for (int j = i + 1; j < n; j++) {
int b = j - 1;
if (h[b] >= h[j]) {
x++;
} else {
break;
}
}
}
if (x > o) {
o = x;
}
}
cout << o;
} | replace | 25 | 26 | 25 | 26 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i)
cin >> a[i];
int res = 0;
for (int i = 0; i < N;) {
int j = i + 1;
while (j < N && a[j] <= a[j - 1])
++j;
res = max(res, j - i - 1);
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; ++i)
cin >> a[i];
int res = 0;
for (int i = 0; i < N;) {
int j = i + 1;
while (j < N && a[j] <= a[j - 1])
++j;
res = max(res, j - i - 1);
i = j;
}
cout << res << endl;
} | insert | 15 | 15 | 15 | 16 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long;
#define _CRT_SECURE_NO_WARNINGS
const double pai = acos(-1.0);
const int max1 = 5e5 + 5;
int a[max1], maxlen[max1];
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int i, k, sum = 1, n, j, sum1 = 1;
cin >> n;
for (i = 1; i <= n; i++)
cin >> a[i];
for (i = 1; i <= n; i++) {
sum = 1;
for (j = i; j < n; j++)
if (a[j] >= a[j + 1])
sum++;
else
break;
sum1 = max(sum, sum1);
}
cout << sum1 - 1 << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long;
#define _CRT_SECURE_NO_WARNINGS
const double pai = acos(-1.0);
const int max1 = 5e5 + 5;
int a[max1], maxlen[max1];
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int i, k, sum = 1, n, j, sum1 = 1;
cin >> n;
for (i = 1; i <= n; i++)
cin >> a[i];
sum = 1;
for (i = 1; i < n; i++) {
if (a[i] >= a[i + 1])
sum++;
else
sum = 1;
sum1 = max(sum, sum1);
}
cout << sum1 - 1 << endl;
return 0;
} | replace | 14 | 21 | 14 | 20 | TLE | |
p02923 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H.at(i);
vector<int> score;
int cnt = 0;
while (1) {
int num = 0;
for (int j = cnt; j < N - 1; j++) {
if (H.at(j) >= H.at(j + 1)) {
cnt++;
num++;
if ((j + 1) >= (N - 1)) {
score.push_back(num);
}
} else if (H.at(j) < H.at(j + 1)) {
cnt++;
score.push_back(num);
break;
}
}
if (cnt == (N - 1))
break;
}
sort(score.begin(), score.end());
reverse(score.begin(), score.end());
cout << score.front() << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H.at(i);
vector<int> score(1, 0);
int cnt = 0;
while (1) {
int num = 0;
for (int j = cnt; j < N - 1; j++) {
if (H.at(j) >= H.at(j + 1)) {
cnt++;
num++;
if ((j + 1) >= (N - 1)) {
score.push_back(num);
}
} else if (H.at(j) < H.at(j + 1)) {
cnt++;
score.push_back(num);
break;
}
}
if (cnt == (N - 1))
break;
}
sort(score.begin(), score.end());
reverse(score.begin(), score.end());
cout << score.front() << endl;
return 0;
} | replace | 19 | 20 | 19 | 20 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low, high, i) for (i = low; i < high; i++)
#define forrev(high, low, i) for (i = high; i >= low; i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) \
for (auto x : a) \
cout << x << ' '; \
cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a, b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';
typedef unordered_map<int, int> umi;
typedef unordered_map<ll, ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
inline ll modexpo(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = mul(res, a);
}
a = mul(a, a);
b /= 2;
}
return res;
}
inline ll divide(ll a, ll b) { return mul(a, modexpo(b, mod - 2)); }
clock_t time_p = clock();
void ktj() {
time_p = clock() - time_p;
cerr << "Time elapsed : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
int main() {
fastio
ll n,
i, j, k, ans = 0;
cin >> n;
ll a[n];
forn(0, n, i) { cin >> a[i]; }
forn(0, n, i) {
ll now = 0;
forn(i + 1, n, j) {
if (a[j] > a[j - 1])
break;
}
ll len = j - i;
ans = max(ans, len);
}
cout << ans - 1 << '\n';
ktj();
} | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low, high, i) for (i = low; i < high; i++)
#define forrev(high, low, i) for (i = high; i >= low; i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) \
for (auto x : a) \
cout << x << ' '; \
cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a, b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';
typedef unordered_map<int, int> umi;
typedef unordered_map<ll, ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
inline ll modexpo(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = mul(res, a);
}
a = mul(a, a);
b /= 2;
}
return res;
}
inline ll divide(ll a, ll b) { return mul(a, modexpo(b, mod - 2)); }
clock_t time_p = clock();
void ktj() {
time_p = clock() - time_p;
cerr << "Time elapsed : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
int main() {
fastio
ll n,
i, j, k, ans = 0;
cin >> n;
ll a[n];
forn(0, n, i) { cin >> a[i]; }
forn(0, n, i) {
ll now = 0;
forn(i + 1, n, j) {
if (a[j] > a[j - 1])
break;
}
ll len = j - i;
ans = max(ans, len);
i = j - 1;
}
cout << ans - 1 << '\n';
ktj();
} | insert | 91 | 91 | 91 | 92 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> data(N);
for (int i = 0; i < N; i++) {
cin >> data.at(i);
}
int count = 0;
int c = 0;
for (int i = 0; i < N; i++) {
if (data.at(i) >= data.at(i + 1)) {
count++;
c = max(count, c);
} else if (data.at(i) < data.at(i + 1)) {
count = 0;
}
}
cout << c << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> data(N + 10, 1e10);
for (int i = 0; i < N; i++) {
cin >> data.at(i);
}
int count = 0;
int c = 0;
for (int i = 0; i < N; i++) {
if (data.at(i) >= data.at(i + 1)) {
count++;
c = max(count, c);
} else if (data.at(i) < data.at(i + 1)) {
count = 0;
}
}
cout << c << endl;
return 0;
}
| replace | 5 | 6 | 5 | 6 | -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 "bits/stdc++.h"
using namespace std;
int n;
int h[100010];
vector<int> result(100010, 0);
int move(int x) {
if (h[x + 1] > h[x] || x == n - 1) {
return 0;
}
return move(x + 1) + 1;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n; i++) {
// cout << move(i) << endl;
result.at(i) = move(i);
}
sort(result.begin(), result.end());
cout << result.at(100009) << endl;
} | #include "bits/stdc++.h"
using namespace std;
int n;
int h[100010];
vector<int> result(100010, 0);
int move(int x) {
if (h[x + 1] > h[x] || x == n - 1) {
return 0;
}
return move(x + 1) + 1;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n; i++) {
// cout << move(i) << endl;
if (i != 0) {
if (h[i - 1] < h[i]) {
result.at(i) = move(i);
}
} else {
result.at(i) = move(i);
}
}
sort(result.begin(), result.end());
cout << result.at(100009) << endl;
} | replace | 21 | 22 | 21 | 28 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
vector<int> A(N - 1, 0);
vector<int> B(N - 1, 0);
for (int i = 0; i < N - 1; i++) {
if (H.at(i) >= H.at(i + 1)) {
A.at(i) = 1;
}
}
int count = 0;
for (int i = 0; i < N - 1; i++) {
if (A.at(i) == 1 && i != N - 2) {
count++;
} else if (A.at(i) == 1 && i == N - 2) {
count++;
B.at(i) = count;
} else {
B.at(i) = count;
count = 0;
}
}
sort(B.begin(), B.end());
reverse(B.begin(), B.end());
cout << B.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<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
vector<int> A(N - 1, 0);
vector<int> B(N - 1, 0);
for (int i = 0; i < N - 1; i++) {
if (H.at(i) >= H.at(i + 1)) {
A.at(i) = 1;
}
}
int count = 0;
for (int i = 0; i < N - 1; i++) {
if (A.at(i) == 1 && i != N - 2) {
count++;
} else if (A.at(i) == 1 && i == N - 2) {
count++;
B.at(i) = count;
} else {
B.at(i) = count;
count = 0;
}
}
sort(B.begin(), B.end());
reverse(B.begin(), B.end());
cout << B.at(0) << endl;
} | insert | 6 | 6 | 6 | 11 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
long long int n, i = 0, j, cnt = 0, max = 0;
cin >> n;
vector<int> h(n);
for (i = 0; i < n; i++) {
cin >> h[i];
}
for (i = 0; i < n - 1; i++) {
cnt = 0;
for (j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1]) {
cnt++;
} else {
break;
}
}
if (max < cnt)
max = cnt;
}
cout << max;
}
| #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
long long int n, i = 0, j, cnt = 0, max = 0;
cin >> n;
vector<int> h(n);
for (i = 0; i < n; i++) {
cin >> h[i];
}
for (i = 0; i < n - 1; i++) {
cnt = 0;
for (j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1]) {
cnt++;
} else {
break;
}
}
if (max < cnt)
max = cnt;
if (max > n - i)
break;
}
cout << max;
}
| insert | 24 | 24 | 24 | 26 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H(N);
for (auto &&h : H) {
cin >> h;
}
int point = 0;
int move = 0;
for (int i = 0; i < N - 1; i++) {
int m = 0;
int j = 0;
int dh = 0;
dh = H[i + j] - H[i + j + 1];
while (dh >= 0) {
m++;
j++;
if (i + j + 1 >= N)
break;
dh = H[i + j] - H[i + j + 1];
}
move = max(move, m);
}
cout << move << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H(N);
for (auto &&h : H) {
cin >> h;
}
int point = 0;
int move = 0;
for (int i = 0; i < N - 1; i++) {
int m = 0;
int j = 0;
int dh = 0;
dh = H[i + j] - H[i + j + 1];
while (dh >= 0) {
m++;
j++;
if (i + j + 1 >= N)
break;
dh = H[i + j] - H[i + j + 1];
}
i += j;
move = max(move, m);
}
cout << move << endl;
}
| insert | 25 | 25 | 25 | 26 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
int curr = 0, max = INT_MIN;
for (int i = 0; i < n; i++) {
curr = 0;
for (int j = i + 1; j < n; j++) {
if (h[j] > h[j - 1]) {
break;
} else
curr++;
if (curr > max)
max = curr;
}
}
if (max == INT_MIN)
max = 0;
cout << max << endl;
} | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
int curr = 0, max = INT_MIN;
for (int i = 1; i < n; i++) {
if (h[i] > h[i - 1])
curr = 0;
else
curr++;
if (curr > max)
max = curr;
}
if (max == INT_MIN)
max = 0;
cout << max << endl;
} | replace | 11 | 21 | 11 | 18 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define Maxn 10005
int n, s, ans;
int h[Maxn];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> h[i];
for (int i = 2; i <= n; i++)
if (h[i] <= h[i - 1]) {
s++;
ans = max(ans, s);
} else
s = 0;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define Maxn 100005
int n, s, ans;
int h[Maxn];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> h[i];
for (int i = 2; i <= n; i++)
if (h[i] <= h[i - 1]) {
s++;
ans = max(ans, s);
} else
s = 0;
cout << ans << endl;
return 0;
} | replace | 2 | 3 | 2 | 3 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> v(N);
for (int i = 0; i < N; i++) {
cin >> v.at(i);
}
int max = -1;
for (int i = 0; i < N; i++) {
int j = i;
int cnt = 0;
while ((j != N - 1) && (v.at(j) >= v.at(j + 1))) {
j++;
cnt++;
}
if (max < cnt) {
max = cnt;
}
}
cout << max << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> v(N);
for (int i = 0; i < N; i++) {
cin >> v.at(i);
}
int max = -1;
for (int i = 0; i < N; i++) {
int j = i;
int cnt = 0;
if (max < N - i) {
while ((j != N - 1) && (v.at(j) >= v.at(j + 1))) {
j++;
cnt++;
}
}
if (max < cnt) {
max = cnt;
}
}
cout << max << endl;
} | replace | 14 | 17 | 14 | 19 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define ALL(v) ((v).begin(), (v).end())
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
REP(i, n) cin >> h[i];
int sum[100010] = {0};
for (int i = 0; i < n; i++) {
for (int j = i + 2; j < n; j++) {
if (h[j - 1] >= h[j]) {
sum[i]++;
} else {
break;
}
}
}
// REP(i,n) cout << i << ": " << sum[i] << endl;
int result = sum[0];
for (int i = 1; i < n; i++) {
result = max(sum[i], result);
}
cout << result << endl;
return 0;
} | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define ALL(v) ((v).begin(), (v).end())
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
REP(i, n) cin >> h[i];
int result = 0;
int val = 0;
for (int i = n - 1; i >= 0; i--) {
if (h[i] <= h[i - 1])
val++;
else
val = 0;
result = max(result, val);
}
cout << result << endl;
return 0;
} | replace | 13 | 28 | 13 | 21 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n, count = 0, tmp = 0;
vector<int> h;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
h.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
if (h[i] >= h[i + 1]) {
for (int j = i;; j++) {
if (h[j] >= h[j + 1] && j + 1 != n) {
tmp++;
} else {
if (count < tmp)
count = tmp;
tmp = 0;
break;
}
}
}
}
cout << count << endl;
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n, count = 0, tmp = 0;
vector<int> h;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
h.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
if (h[i] >= h[i + 1] && n - i >= count) {
for (int j = i;; j++) {
if (h[j] >= h[j + 1] && j + 1 != n) {
tmp++;
} else {
if (count < tmp)
count = tmp;
tmp = 0;
break;
}
}
}
}
cout << count << endl;
return 0;
} | replace | 19 | 20 | 19 | 20 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> data(N);
for (int i = 0; i < N; i++) {
cin >> data[i];
}
int ans = 0;
for (int i = 0; i < N - 1; i++) {
if (data[i] < data[i + 1]) {
continue;
}
int tmp_i = i;
int count = 0;
for (int j = i + 1; j < N; j++) {
if (data[tmp_i] >= data[j]) {
count++;
tmp_i++;
} else
break;
}
ans = max(count, ans);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> data(N);
for (int i = 0; i < N; i++) {
cin >> data[i];
}
int ans = 0;
for (int i = 0; i < N - 1; i++) {
if (data[i] < data[i + 1]) {
continue;
}
int tmp_i = i;
int count = 0;
for (int j = i + 1; j < N; j++) {
if (data[tmp_i] >= data[j]) {
count++;
tmp_i++;
} else
break;
}
ans = max(count, ans);
if (ans >= (N / 2))
break;
}
cout << ans << endl;
return 0;
} | insert | 27 | 27 | 27 | 29 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
int main() {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int max = 0;
int count = 0;
rep(i, n) {
count = 0;
for (int j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1])
count++;
else
break;
}
if (max < count)
max = count;
}
cout << max;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
int main() {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int max = 0;
int count = 0;
rep(i, n) {
if (n - i < max)
break;
count = 0;
for (int j = i; j < n - 1; j++) {
if (h[j] >= h[j + 1])
count++;
else
break;
}
if (max < count)
max = count;
}
cout << max;
return 0;
} | insert | 15 | 15 | 15 | 18 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long
#define ld long double
struct XX {
int a;
int i;
int d;
};
class xxGreater {
public:
bool operator()(const XX &riLeft, const XX &riRight) const {
// 第2条件
// if((riLeft.a) == (riRight.a)){
// return riLeft.s <
// riRight.s;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
// //プライオリティキューの場合は >
// で、top()すると値の小さいものがとれる
// }
// 第1条件
return (riLeft.a) < (riRight.a);
}
};
// map<long long,long long> prime_f(long long n){
// map<long long,long long>res;
// for(int i=2;i*i<=n;i++){
// while(n%i==0){
// ++res[i];
// n/=i;
// }
// }
// if(n!=1)res[n]=1;
// return res;
// }
// int n;
////int dat[2*10000000];
////int dat2[2*10000000];
// int dat[10];
// int dat2[10];
//
// void init(int n_){
// n=1;
// while(n<n_)n*=2;
// for(int i=0;i<2*n-1;i++){
// dat[i]=0;
// dat2[i]=0;
// }
// }
//
// void initset(int k,int a){
// k+=n-1;
// dat[k]=a;
// while(k>0){
// k=(k-1)/2;
// dat[k]=dat[k*2+1]+dat[k*2+2];
// }
// }
//
////[a,b)の間を[l,r]区間で比較しアップデート
////引数のindexに注意
////nは固定。initで計算すみ
////update2(L[i],R[i]+1,0,0,n,D[i]);
// void update2(int a,int b,int k,int l,int r,int v){//v更新値、区間は0-index
// if(r<=a || b<=l)return;
// if(a<=l && r<=b){
// dat[k]+=dat2[k];
// if(r-l>1){
// dat2[k*2+1]+=dat2[k]/2;
// dat2[k*2+1]+=dat2[k]/2;
// }
// dat2[k]=v*(r-l);
// return;
// }else{
// update2(a,b,k*2+1,l,(l+r)/2,v);
// update2(a,b,k*2+2,(l+r)/2,r,v);
// return;
// }
// }
//
// int query(int a,int b,int k,int l,int r){
// if(r<=a || b<=l)return 0;
// if(a<=l && r<=b){
// dat[k]+=dat2[k];
// if(r-l>1){
// dat2[k*2+1]+=dat2[k]/2;
// dat2[k*2+1]+=dat2[k]/2;
// }
// dat2[k]=0;
// return dat[k];
// }
// else{
// int vl=query(a,b,k*2+1,l,(l+r)/2);
// int vr=query(a,b,k*2+2,(l+r)/2,r);
// return vl+vr;
// }
// }
// void printb(unsigned int v) {
// unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
// do putchar(mask & v ? '1' : '0');
// while (mask >>= 1);
// }
int main(int argc, const char *argv[]) {
// scanf("%s",S);
// scanf("%d",&N);
// scanf("%lld %lld",&target1,&target2);
// sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
// getline(cin, target);
// ifstream ifs("a.txt");//テスト用
// ifs >> a;
// ここから
// 入力高速化
ios::sync_with_stdio(false);
cin.tie(0);
ll N;
cin >> N;
int a[100000];
for (int i = 0; i < N; i++) {
cin >> a[i];
}
vector<int> point;
point.push_back(0);
for (int i = 1; i < N - 1; i++) {
if (a[i - 1] <= a[i] && a[i] >= a[i + 1]) {
point.push_back(i);
}
}
int ans = 0;
for (int i = 0; i < point.size(); i++) {
int ind = point[i];
int tmp = 0;
while (a[ind] >= a[ind + 1] && ind < N - 1) {
tmp++;
ind++;
}
ans = max(ans, tmp);
}
cout << ans << endl;
// ここまで
// cout << "ans" << endl;
// printf("%.0f\n",ans);//小数点以下表示なし
// printf("%.7f\n",p);
return 0;
}
| #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long
#define ld long double
struct XX {
int a;
int i;
int d;
};
class xxGreater {
public:
bool operator()(const XX &riLeft, const XX &riRight) const {
// 第2条件
// if((riLeft.a) == (riRight.a)){
// return riLeft.s <
// riRight.s;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
// //プライオリティキューの場合は >
// で、top()すると値の小さいものがとれる
// }
// 第1条件
return (riLeft.a) < (riRight.a);
}
};
// map<long long,long long> prime_f(long long n){
// map<long long,long long>res;
// for(int i=2;i*i<=n;i++){
// while(n%i==0){
// ++res[i];
// n/=i;
// }
// }
// if(n!=1)res[n]=1;
// return res;
// }
// int n;
////int dat[2*10000000];
////int dat2[2*10000000];
// int dat[10];
// int dat2[10];
//
// void init(int n_){
// n=1;
// while(n<n_)n*=2;
// for(int i=0;i<2*n-1;i++){
// dat[i]=0;
// dat2[i]=0;
// }
// }
//
// void initset(int k,int a){
// k+=n-1;
// dat[k]=a;
// while(k>0){
// k=(k-1)/2;
// dat[k]=dat[k*2+1]+dat[k*2+2];
// }
// }
//
////[a,b)の間を[l,r]区間で比較しアップデート
////引数のindexに注意
////nは固定。initで計算すみ
////update2(L[i],R[i]+1,0,0,n,D[i]);
// void update2(int a,int b,int k,int l,int r,int v){//v更新値、区間は0-index
// if(r<=a || b<=l)return;
// if(a<=l && r<=b){
// dat[k]+=dat2[k];
// if(r-l>1){
// dat2[k*2+1]+=dat2[k]/2;
// dat2[k*2+1]+=dat2[k]/2;
// }
// dat2[k]=v*(r-l);
// return;
// }else{
// update2(a,b,k*2+1,l,(l+r)/2,v);
// update2(a,b,k*2+2,(l+r)/2,r,v);
// return;
// }
// }
//
// int query(int a,int b,int k,int l,int r){
// if(r<=a || b<=l)return 0;
// if(a<=l && r<=b){
// dat[k]+=dat2[k];
// if(r-l>1){
// dat2[k*2+1]+=dat2[k]/2;
// dat2[k*2+1]+=dat2[k]/2;
// }
// dat2[k]=0;
// return dat[k];
// }
// else{
// int vl=query(a,b,k*2+1,l,(l+r)/2);
// int vr=query(a,b,k*2+2,(l+r)/2,r);
// return vl+vr;
// }
// }
// void printb(unsigned int v) {
// unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
// do putchar(mask & v ? '1' : '0');
// while (mask >>= 1);
// }
int main(int argc, const char *argv[]) {
// scanf("%s",S);
// scanf("%d",&N);
// scanf("%lld %lld",&target1,&target2);
// sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
// getline(cin, target);
// ifstream ifs("a.txt");//テスト用
// ifs >> a;
// ここから
// 入力高速化
ios::sync_with_stdio(false);
cin.tie(0);
ll N;
cin >> N;
int a[100000];
for (int i = 0; i < N; i++) {
cin >> a[i];
}
vector<int> point;
point.push_back(0);
for (int i = 1; i < N - 1; i++) {
if (a[i - 1] < a[i] && a[i] >= a[i + 1]) {
point.push_back(i);
}
}
int ans = 0;
for (int i = 0; i < point.size(); i++) {
int ind = point[i];
int tmp = 0;
while (a[ind] >= a[ind + 1] && ind < N - 1) {
tmp++;
ind++;
}
ans = max(ans, tmp);
}
cout << ans << endl;
// ここまで
// cout << "ans" << endl;
// printf("%.0f\n",ans);//小数点以下表示なし
// printf("%.7f\n",p);
return 0;
}
| replace | 149 | 150 | 149 | 150 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[10005];
cin >> n;
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long sum = 0, m = 0;
for (long long i = 0; i < n - 1; i++) {
if (a[i] < a[i + 1] || i == n - 2) {
if (a[i] >= a[i + 1])
sum++;
if (m < sum) {
m = sum;
}
sum = 0;
} else {
sum++;
}
}
cout << m << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[100005];
cin >> n;
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long sum = 0, m = 0;
for (long long i = 0; i < n - 1; i++) {
if (a[i] < a[i + 1] || i == n - 2) {
if (a[i] >= a[i + 1])
sum++;
if (m < sum) {
m = sum;
}
sum = 0;
} else {
sum++;
}
}
cout << m << endl;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
priority_queue<int> A;
vector<ll> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
int count = 0;
for (int i = 0; i < N - 1; i++) {
if (H[i] >= H[i + 1]) {
count++;
} else {
A.push(count);
count = 0;
}
}
cout << A.top() << endl;
} | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
priority_queue<int> A;
vector<ll> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
int count = 0;
for (int i = 0; i < N - 1; i++) {
if (H[i] >= H[i + 1]) {
count++;
} else {
A.push(count);
count = 0;
}
}
A.push(count);
cout << A.top() << endl;
}
| insert | 22 | 22 | 22 | 23 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
vector<int> s(n);
for (int i = 0; i < n; i++)
cin >> s.at(i);
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
for (int j = i; j + 1 < n; j++) {
if (s.at(j) >= s.at(j + 1))
cnt++;
else
break;
}
ans = max(ans, cnt);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
vector<int> s(n);
for (int i = 0; i < n; i++)
cin >> s.at(i);
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
for (int j = i; j + 1 < n; j++) {
if (s.at(j) >= s.at(j + 1))
cnt++;
else
break;
}
i += cnt;
ans = max(ans, cnt);
}
cout << ans << endl;
} | insert | 16 | 16 | 16 | 17 | TLE | |
p02923 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <vector>
int main(void) {
int n;
std::cin >> n;
std::vector<int> h(n);
for (int i = 0; i < n; i++) {
std::cin >> h.at(i);
}
std::reverse(h.begin(), h.end());
int ans = 0;
int cnt = 0;
for (int i = 0; i < n; i++) {
if (h.at(i) <= h.at(i + 1)) {
cnt++;
} else {
cnt = 0;
}
ans = std::max(ans, cnt);
}
std::printf("%d\n", ans);
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
int main(void) {
int n;
std::cin >> n;
std::vector<int> h(n);
for (int i = 0; i < n; i++) {
std::cin >> h.at(i);
}
std::reverse(h.begin(), h.end());
int ans = 0;
int cnt = 0;
for (int i = 0; i < n - 1; i++) {
if (h.at(i) <= h.at(i + 1)) {
cnt++;
} else {
cnt = 0;
}
ans = std::max(ans, cnt);
}
std::printf("%d\n", ans);
return 0;
} | replace | 17 | 18 | 17 | 18 | -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 <bits/stdc++.h>
using namespace std;
int n, h[123456], c;
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = 0; i < n; i++) {
int j = i, k = i + 1, a = 0;
while (h[j] >= h[k] && h[k] != 0) {
j++;
k++;
a++;
}
if (c < a)
c = a;
}
cout << c;
}
| #include <bits/stdc++.h>
using namespace std;
int n, h[123456], c;
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = 0; i < n; i++) {
int j = i, k = i + 1, a = 0;
while (h[j] >= h[k] && h[k] != 0) {
j++;
k++;
a++;
}
if (c < a)
c = a;
i = j++;
}
cout << c;
}
| insert | 16 | 16 | 16 | 17 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <stdio.h>
#include <stdlib.h>
/*ABC 139 C*/
int main(void) {
int N;
int *heap;
int count = 0;
int max = 0;
scanf("%d", &N);
heap = (int *)malloc(sizeof(int) * N);
if (heap == NULL) {
exit(0);
}
for (size_t i = 0; i < N; i++) {
scanf("%d", &heap[i]);
}
for (size_t i = 0; i < N; i++) {
for (size_t j = i; j < N - 1; j++) {
if (heap[j] >= heap[j + 1]) {
count++;
} else
break;
}
if (max < count) {
max = count;
}
count = 0;
}
free(heap);
printf("%d\n", max);
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
/*ABC 139 C*/
int main(void) {
int N;
int *heap;
int count = 0;
int max = 0;
scanf("%d", &N);
heap = (int *)malloc(sizeof(int) * N);
if (heap == NULL) {
exit(0);
}
for (size_t i = 0; i < N; i++) {
scanf("%d", &heap[i]);
}
for (size_t i = 0; i < N; i++) {
for (size_t j = i; j < N - 1; j++) {
if (heap[j] >= heap[j + 1]) {
count++;
} else
break;
}
if (max < count) {
max = count;
}
if (max == N - 1) {
printf("%d", N - 1);
return 0;
}
count = 0;
}
free(heap);
printf("%d\n", max);
return 0;
}
| insert | 30 | 30 | 30 | 34 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
int N;
int Hs[10005];
int main() {
cin >> N;
rep(i, N) { cin >> Hs[i]; }
int st = Hs[0];
int mx = 0;
int now = 0;
for (int i = 1; i < N; i++) {
if (Hs[i] <= Hs[i - 1]) {
now++;
} else {
mx = max(mx, now);
now = 0;
}
}
mx = max(mx, now);
cout << mx << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
using namespace std;
int N;
int Hs[100005];
int main() {
cin >> N;
rep(i, N) { cin >> Hs[i]; }
int st = Hs[0];
int mx = 0;
int now = 0;
for (int i = 1; i < N; i++) {
if (Hs[i] <= Hs[i - 1]) {
now++;
} else {
mx = max(mx, now);
now = 0;
}
}
mx = max(mx, now);
cout << mx << endl;
return 0;
}
| replace | 5 | 6 | 5 | 6 | 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);
}
int count = 0;
int countt = -1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N - i - 1; j++) {
if (H.at(i + j) >= H.at(i + j + 1)) {
count++;
} else {
break;
}
}
if (count > countt) {
countt = count;
}
i -= count;
count = 0;
}
cout << countt << 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 count = 0;
int countt = -1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N - i - 1; j++) {
if (H.at(i + j) >= H.at(i + j + 1)) {
count++;
} else {
break;
}
}
if (count > countt) {
countt = count;
}
i += count;
count = 0;
}
cout << countt << endl;
} | replace | 28 | 29 | 28 | 29 | TLE | |
p02923 | C++ | Runtime Error | #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 count = 0;
vector<int> v;
for (int i = 1; i < n; i++) {
if (h[i - 1] >= h[i]) {
++count;
v.push_back(count);
} else {
count = 0;
}
}
sort(v.begin(), v.end());
cout << v.back();
}
| #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 count = 0;
vector<int> v(1);
for (int i = 1; i < n; i++) {
if (h[i - 1] >= h[i]) {
++count;
v.push_back(count);
} else {
count = 0;
}
}
sort(v.begin(), v.end());
cout << v.back();
}
| replace | 10 | 11 | 10 | 11 | 0 | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
int low = 0, high = 1, ans = 0, cnt = 0;
while (high < n) {
if (v[low] >= v[high]) {
cnt++;
ans = max(ans, cnt);
low++;
high++;
} else {
low = high;
high++;
cnt = 0;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
int low = 0, high = 1, ans = 0, cnt = 0;
while (high < n) {
if (v[low] >= v[high]) {
cnt++;
ans = max(ans, cnt);
low++;
high++;
} else {
low = high;
high++;
cnt = 0;
}
}
cout << ans << endl;
} | delete | 5 | 9 | 5 | 5 | -6 | terminate called after throwing an instance of 'std::length_error'
what(): cannot create std::vector larger than max_size()
|
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h.at(i);
vector<int> count(n);
for (int i = 0; i < n; i++) {
for (int j = i; j < n - 1; j++) {
if (h.at(j) >= h.at(j + 1))
count.at(i)++;
else
break;
}
}
sort(count.begin(), count.end());
cout << count.at(n - 1) << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h.at(i);
vector<int> count(n, 0);
int p = 0;
for (int i = 0; i < n - 1; i++) {
if (h.at(i) >= h.at(i + 1))
count.at(p)++;
else
p++;
}
sort(count.begin(), count.end());
cout << count.at(n - 1) << endl;
return 0;
} | replace | 14 | 22 | 14 | 21 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, max = 0;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N - 1; i++) {
int count = 0;
for (int j = i; j < N - 1; j++) {
if (H[j] >= H[j + 1]) {
count++;
} else {
break;
}
}
if (max < count) {
max = count;
}
}
cout << max << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, max = 0;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N - 1; i++) {
if (max > N - i - 2) {
break;
}
int count = 0;
for (int j = i; j < N - 1; j++) {
if (H[j] >= H[j + 1]) {
count++;
} else {
break;
}
}
if (max < count) {
max = count;
}
}
cout << max << endl;
return 0;
} | insert | 15 | 15 | 15 | 18 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int a[10000];
int n, m, ans;
int main() {
int i, ans = 0, anss = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &a[i]);
if (i != 1) {
if (a[i] <= a[i - 1])
ans++, anss = max(anss, ans);
else
anss = max(anss, ans), ans = 0;
}
}
printf("%d\n", anss);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int a[100010];
int n, m, ans;
int main() {
int i, ans = 0, anss = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &a[i]);
if (i != 1) {
if (a[i] <= a[i - 1])
ans++, anss = max(anss, ans);
else
anss = max(anss, ans), ans = 0;
}
}
printf("%d\n", anss);
return 0;
} | replace | 2 | 3 | 2 | 3 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
long long count = 0;
long long max = 0;
long long N;
cin >> N;
vector<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N; i++) {
count = 0;
for (int j = 1; j < N - i; j++) {
if (H[i + j - 1] >= H[i + j]) {
count++;
} else {
break;
}
}
if (count > max) {
max = count;
}
}
cout << max << endl;
return 0;
} | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
long long count = 0;
long long max = 0;
long long N;
cin >> N;
vector<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N; i++) {
count = 0;
for (int j = 1; j < N - i; j++) {
if (H[i + j - 1] >= H[i + j]) {
count++;
} else {
break;
}
}
if (count > max) {
max = count;
}
if (N - i < max) {
break;
}
}
cout << max << endl;
return 0;
} | insert | 33 | 33 | 33 | 36 | 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];
int ans = 0;
for (int i = 0; i < n; i++) {
int res = 0;
for (int j = i + 1; j < n; j++) {
if (h[j - 1] >= h[j])
res = j - i;
else {
i = j - 1;
break;
}
}
ans = max(ans, res);
}
cout << ans << endl;
return 0;
} | #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];
int ans = 0;
int res = 0;
for (int i = 1; i < n; i++) {
if (h[i] <= h[i - 1])
res++;
else
res = 0;
ans = max(ans, res);
}
cout << ans << endl;
return 0;
} | replace | 9 | 19 | 9 | 15 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
long long h[110000];
for (int i = 0; i < n; i++)
cin >> h[i];
int ans[110000] = {0};
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
int j = i;
while (h[j] >= h[j + 1] && j + 1 < n) {
cnt++;
j++;
}
ans[i] = cnt;
}
int mx = 0;
for (int i = 0; i < n; i++)
if (mx < ans[i])
mx = ans[i];
cout << mx << endl;
}
| #include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
long long h[110000];
for (int i = 0; i < n; i++)
cin >> h[i];
int ans[110000] = {0};
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
int j = i;
while (h[j] >= h[j + 1] && j + 1 < n) {
cnt++;
j++;
}
ans[i] = cnt;
i = j;
}
int mx = 0;
for (int i = 0; i < n; i++)
if (mx < ans[i])
mx = ans[i];
cout << mx << endl;
}
| insert | 29 | 29 | 29 | 30 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
int count = 0;
int N;
cin >> N;
vector<int> H(N + 1);
H[N] = 1000000001;
vector<int> Hc(N);
rep(i, N) { cin >> H[i]; }
rep(i, N) {
int c = 0;
for (int j = i; j < N; j++) {
if (H[j] >= H[j + 1]) {
c++;
} else {
Hc[i] = c;
break;
}
}
}
cout << *max_element(Hc.begin(), Hc.end());
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
int count = 0;
int N;
cin >> N;
vector<int> H(N + 1);
H[N] = 1000000001;
vector<int> Hc(N);
rep(i, N) { cin >> H[i]; }
rep(i, N) {
int c = 0;
for (int j = i; j < N; j++) {
if (H[j] >= H[j + 1]) {
c++;
} else {
Hc[i] = c;
break;
}
}
i += c;
}
cout << *max_element(Hc.begin(), Hc.end());
}
| insert | 22 | 22 | 22 | 23 | TLE | |
p02923 | C++ | Runtime Error | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define INF 2147483647
int dp[100];
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
cin >> a[0];
int cnt = 0;
int max = 0;
for (int i = 1; i < n; i++) {
cin >> a[i];
if (a[i] > a[i - 1]) {
dp[i] = dp[i - 1];
cnt = 0;
} else if (a[i] <= a[i - 1]) {
cnt += 1;
if (max < cnt) {
max = cnt;
}
dp[i] = max;
}
}
cout << max << "\n";
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define INF 2147483647
int dp[100001];
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
cin >> a[0];
int cnt = 0;
int max = 0;
for (int i = 1; i < n; i++) {
cin >> a[i];
if (a[i] > a[i - 1]) {
dp[i] = dp[i - 1];
cnt = 0;
} else if (a[i] <= a[i - 1]) {
cnt += 1;
if (max < cnt) {
max = cnt;
}
dp[i] = max;
}
}
cout << max << "\n";
}
| replace | 14 | 15 | 14 | 15 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int a = 0, N;
cin >> N;
vector<int> H(N), X(N, 0);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
if (N > 1) {
for (int i = 0; i < N - 1; i++) {
if (H.at(i) >= H.at(i + 1)) {
int j = i;
while (j < N - 1 && H.at(j) >= H.at(j + 1)) {
X.at(i)++;
j++;
}
}
}
}
sort(X.begin(), X.end());
cout << X.at(N - 1) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a = 0, N;
cin >> N;
vector<int> H(N), X(N, 0);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
if (N > 1) {
for (int i = 0; i < N - 1; i++) {
if (i == 0 ||
(i > 0 && H.at(i) >= H.at(i + 1) && H.at(i - 1) < H.at(i))) {
int j = i;
while (j < N - 1 && H.at(j) >= H.at(j + 1)) {
X.at(i)++;
j++;
}
}
}
}
sort(X.begin(), X.end());
cout << X.at(N - 1) << endl;
} | replace | 12 | 13 | 12 | 14 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h;
for (int i = 0; i < n; ++i) {
int height;
cin >> height;
h.push_back(height);
}
int max_ = 0;
for (int i = 0; i < n; ++i) {
int current = 0;
for (int j = i; j < n - 1; ++j) {
if (h[j + 1] <= h[j]) {
current++;
max_ = max(max_, current);
} else {
current = 0;
}
}
}
cout << max_ << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h;
for (int i = 0; i < n; ++i) {
int height;
cin >> height;
h.push_back(height);
}
int max_ = 0, curr = 0;
for (int i = 0; i < n - 1; ++i) {
if (h[i + 1] <= h[i]) {
curr++;
max_ = max(max_, curr);
} else {
curr = 0;
}
}
cout << max_ << endl;
}
| replace | 13 | 23 | 13 | 20 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define INF (1ll << 40)
#define mod 1000000007
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
ll n;
cin >> n;
vector<ll> h(n + 1);
rep(i, n) cin >> h[i];
h[n] = INF; // sentinel
ll dp[10010] = {0}; // i番目のマスまでで移動してくるときの最大移動回数
ll ans = 0;
rep(i, n) {
if (h[i + 1] <= h[i]) {
dp[i + 1] = dp[i] + 1; // 右の方が小さいとき(もしくは同じ)
} else {
ans = max(ans, dp[i]);
dp[i + 1] = 0;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define INF (1ll << 40)
#define mod 1000000007
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
ll n;
cin >> n;
vector<ll> h(n + 1);
rep(i, n) cin >> h[i];
h[n] = INF; // sentinel
ll dp[100100] = {0}; // i番目のマスまでで移動してくるときの最大移動回数
ll ans = 0;
rep(i, n) {
if (h[i + 1] <= h[i]) {
dp[i + 1] = dp[i] + 1; // 右の方が小さいとき(もしくは同じ)
} else {
ans = max(ans, dp[i]);
dp[i + 1] = 0;
}
}
cout << ans << endl;
return 0;
} | replace | 30 | 31 | 30 | 31 | 0 | |
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.at(i);
}
int answer = 0;
for (int i = 0; i < N - 1; i++) {
int j, count;
for (j = i, count = 0; j < N - 1 && H.at(j + 1) <= H.at(j); j++, count++) {
}
if (answer < count)
answer = count;
}
cout << answer << 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 answer = 0;
for (int i = 0; i < N - 1; i++) {
int j, count;
for (j = i, count = 0; j < N - 1 && H.at(j + 1) <= H.at(j); j++, count++) {
i++;
}
if (answer < count)
answer = count;
}
cout << answer << endl;
} | insert | 14 | 14 | 14 | 15 | TLE | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int N;
cin >> N;
vector<ll> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
int ans = 0;
for (int i = 0; i < N; i++) {
ll currentHeight = H[i];
int step = 0;
for (int j = i + 1; H[j] <= currentHeight && j < N; j++) {
step++;
currentHeight = H[j];
}
ans = max(ans, step);
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int N;
cin >> N;
vector<ll> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
int ans = 0;
for (int i = 0; i < N; i++) {
ll currentHeight = H[i];
int step = 0;
for (int j = i + 1; H[j] <= currentHeight && j < N; j++) {
step++;
currentHeight = H[j];
}
i += step;
ans = max(ans, step);
}
cout << ans << endl;
return 0;
}
| insert | 23 | 23 | 23 | 24 | TLE | |
p02923 | C++ | Runtime Error | /////////////////////////////////////////////////
///// Give me AC!!!! /////
/////////////////////////////////////////////////
// ↑これじゃ気合いが足りない!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////
///お願いしますACをくださいそうじゃないと僕泣きますお願いしますACをくださいJudge様....
////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, N) for (int i = 0; i < (N); i++)
#define erep(i, N) for (int i = N - 1; i >= 0; i--)
const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef pair<int, int> P;
typedef pair<ll, ll> PLL;
ld rad(ld a) { return a * 180 / PI; }
const int dx[4] = {1, 0, -1, 0}; // 2次元グリッド上のx軸方向
const int dy[4] = {0, 1, 0, -1}; // 2次元グリッド上のy軸方向
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
struct UnionFind {
vector<int> par;
UnionFind(int n) : par(n, -1) {}
int root(int x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool same(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
int size(int x) { return -par[root(x)]; }
};
vector<pair<ll, ll>> prime_factorize(ll N) {
vector<pair<ll, ll>> res;
for (ll a = 2; a * a <= N; ++a) {
if (N % a != 0)
continue;
ll ex = 0; // 指数
// 割れる限り割り続ける
while (N % a == 0) {
++ex;
N /= a;
}
// その結果を push
res.push_back({a, ex});
}
// 最後に残った数について
if (N != 1)
res.push_back({N, 1});
return res;
}
// dpTable
// int dp[200050];
int main() {
int N;
cin >> N;
vector<ll> H(N);
rep(i, N) cin >> H.at(i);
int hoge = 0, ans = 0;
for (int i = 0; i < N - 1; i++) {
if (H.at(i) >= H.at(i + 1))
hoge++;
else {
ans = max(ans, hoge);
hoge = 0;
}
}
if (H.at(N - 2) >= H.at(N - 1)) {
ans = max(ans, hoge);
}
cout << ans << endl;
return 0;
} | /////////////////////////////////////////////////
///// Give me AC!!!! /////
/////////////////////////////////////////////////
// ↑これじゃ気合いが足りない!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////
///お願いしますACをくださいそうじゃないと僕泣きますお願いしますACをくださいJudge様....
////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, N) for (int i = 0; i < (N); i++)
#define erep(i, N) for (int i = N - 1; i >= 0; i--)
const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef pair<int, int> P;
typedef pair<ll, ll> PLL;
ld rad(ld a) { return a * 180 / PI; }
const int dx[4] = {1, 0, -1, 0}; // 2次元グリッド上のx軸方向
const int dy[4] = {0, 1, 0, -1}; // 2次元グリッド上のy軸方向
template <int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0)
val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
constexpr Fp &operator+=(const Fp &r) noexcept {
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept {
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept {
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
};
using mint = Fp<MOD>;
struct UnionFind {
vector<int> par;
UnionFind(int n) : par(n, -1) {}
int root(int x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool same(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
int size(int x) { return -par[root(x)]; }
};
vector<pair<ll, ll>> prime_factorize(ll N) {
vector<pair<ll, ll>> res;
for (ll a = 2; a * a <= N; ++a) {
if (N % a != 0)
continue;
ll ex = 0; // 指数
// 割れる限り割り続ける
while (N % a == 0) {
++ex;
N /= a;
}
// その結果を push
res.push_back({a, ex});
}
// 最後に残った数について
if (N != 1)
res.push_back({N, 1});
return res;
}
// dpTable
// int dp[200050];
int main() {
int N;
cin >> N;
vector<ll> H(N);
rep(i, N) cin >> H.at(i);
if (N == 1) {
cout << 0 << endl;
return 0;
}
int hoge = 0, ans = 0;
for (int i = 0; i < N - 1; i++) {
if (H.at(i) >= H.at(i + 1))
hoge++;
else {
ans = max(ans, hoge);
hoge = 0;
}
}
if (H.at(N - 2) >= H.at(N - 1)) {
ans = max(ans, hoge);
}
cout << ans << endl;
return 0;
} | insert | 160 | 160 | 160 | 164 | 0 | |
p02923 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> height(n);
for (int i = 0; i < n; i++) {
cin >> height.at(i);
}
int max = 0;
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
int j = i;
while (j < n - 1 && height.at(j) >= height.at(j + 1)) {
j++;
cnt++;
}
if (cnt >= max)
max = cnt;
}
cout << max << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> height(n);
for (int i = 0; i < n; i++) {
cin >> height.at(i);
}
int max = 0;
for (int i = 0; i < n - 1; i++) {
int cnt = 0;
int j = i;
while (j < n - 1 && height.at(j) >= height.at(j + 1)) {
j++;
cnt++;
}
if (cnt >= max)
max = cnt;
if (max > n / 2)
break;
}
cout << max << endl;
} | insert | 20 | 20 | 20 | 22 | 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];
int res = 0;
for (int i = 0; i < N; ++i) {
int cnt = 0;
for (int k = i + 1; k < N; ++k) {
if (H[k - 1] >= H[k]) {
cnt++;
} else {
break;
}
}
if (res < cnt) {
res = cnt;
}
}
cout << res << 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];
int res = 0;
int cnt = 0;
for (int i = 1; i < N; ++i) {
if (H[i - 1] >= H[i]) {
cnt++;
} else {
cnt = 0;
}
if (res < cnt) {
res = cnt;
}
}
cout << res << endl;
} | replace | 11 | 19 | 11 | 17 | TLE | |
p02923 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
typedef long long int ll;
using namespace std;
int main() {
int N;
vector<int> H;
cin >> N;
rep(i, N) {
int val;
cin >> val;
H.push_back(val);
}
int count[10000] = {0};
REP(i, 1, N) count[i] = H[i] <= H[i - 1] ? count[i - 1] + 1 : 0;
cout << *max_element(count, count + N) << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
typedef long long int ll;
using namespace std;
int main() {
int N;
vector<int> H;
cin >> N;
rep(i, N) {
int val;
cin >> val;
H.push_back(val);
}
int count[100000] = {0};
REP(i, 1, N) count[i] = H[i] <= H[i - 1] ? count[i - 1] + 1 : 0;
cout << *max_element(count, count + N) << endl;
return 0;
} | replace | 18 | 19 | 18 | 19 | 0 | |
p02924 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define forsn(i, s, n) for (int i = s; i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define NACHO \
ios_base::sync_with_stdio(0); \
cin.tie(NULL);
typedef long long tint;
int main() {
int n;
cin >> n;
vector<tint> a(n), b(n);
forn(i, n) {
a[i] = i + 1;
b[i] = i + 2;
}
b[0] = n;
b[n - 1] = 1;
tint sum = 0;
forn(i, n) { sum += (a[i] % b[i]); }
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define forsn(i, s, n) for (int i = s; i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define NACHO \
ios_base::sync_with_stdio(0); \
cin.tie(NULL);
typedef long long tint;
int main() {
int n;
cin >> n;
tint s = (1LL * (n - 1) * n) / 2;
cout << 1LL * s << endl;
}
| replace | 16 | 26 | 16 | 18 | 0 | |
p02924 | Python | Time Limit Exceeded | N = int(input())
ans = 0
for i in range(1, N):
ans += i
print(ans)
| N = int(input())
print((N - 1) * N // 2)
| replace | 1 | 7 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
c = 0
for i in range(1, N):
c += i
print(c)
| N = int(input())
print(N * (N - 1) // 2)
| replace | 1 | 7 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | n = int(input())
sum = 0
for i in range(n):
sum += i
print(sum)
| n = int(input())
print((n * (n - 1)) // 2)
| replace | 2 | 7 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | import sys
sys.setrecursionlimit(int(1e6))
N = int(input())
M_sum = 0
M_sum = sum(range(1, N))
M_sum += N % 1
print(M_sum)
| import sys
sys.setrecursionlimit(int(1e6))
N = int(input())
n = N - 1
if bool(n % 2):
ans = (n // 2) * (n) + n
else:
ans = (n // 2) * (n + 1)
print(ans)
| replace | 6 | 10 | 6 | 13 | TLE | |
p02924 | Python | Runtime Error | N = int(input())
print(sum(list(range(N))))
| N = int(input())
print((N - 1) * N // 2)
| replace | 1 | 2 | 1 | 2 | 0 | |
p02924 | Python | Runtime Error | N = int(input())
print(sum(list(range(N))[1:]))
| N = int(input())
print((N - 1) * (N) // 2)
| replace | 1 | 2 | 1 | 2 | 0 | |
p02924 | Python | Time Limit Exceeded | n = int(input())
ans = 0
for i in range(1, n):
ans += i
print(ans)
| n = int(input()) - 1
print(n * (n + 1) // 2)
| replace | 0 | 7 | 0 | 2 | TLE | |
p02924 | Python | Runtime Error | n = int(input())
a = list(range(1, n))
print(sum(a))
| n = int(input())
ans = (n - 1) * (1 + n - 1) // 2
print(ans)
| replace | 1 | 3 | 1 | 3 | 0 | |
p02924 | Python | Time Limit Exceeded | def main():
n = int(input())
sum = 0
for i in range(n):
sum += i
print(sum)
if __name__ == "__main__":
main()
| def main():
n = int(input())
print(n * (n - 1) // 2)
if __name__ == "__main__":
main()
| replace | 2 | 6 | 2 | 3 | TLE | |
p02924 | Python | Runtime Error | n = int(input())
a = list(range(1, n))
print(sum(a))
| n = int(input())
a = (1 + n - 1) * (n - 1) // 2
print(a)
| replace | 3 | 6 | 3 | 5 | 0 | |
p02924 | Python | Time Limit Exceeded | n = int(input())
ans = 0
for i in range(n):
ans += i
print(ans)
| n = int(input())
ans = n * (n - 1) // 2
print(ans)
| replace | 2 | 5 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
print(sum(range(1, N)))
| N = int(input())
print((N - 1) * N // 2)
| replace | 1 | 2 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
print(sum([i for i in range(N)]))
| N = int(input())
print(N * (N - 1) // 2)
| replace | 1 | 2 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | n = int(input())
print(sum(range(1, n)))
| n = int(input())
ans = n * (n - 1) // 2
print(ans)
| replace | 1 | 2 | 1 | 4 | TLE | |
p02924 | Python | Time Limit Exceeded | n = int(input())
ans = 0
for i in range(1, n):
ans += i
print(ans)
| n = int(input())
print((n * (n - 1)) // 2)
| replace | 2 | 8 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | import sys
N = int(sys.stdin.readline())
print(sum(n + 1 for n in range(N - 1)))
| import sys
N = int(sys.stdin.readline())
print(int((N - 1) * N // 2))
| replace | 3 | 4 | 3 | 4 | TLE | |
p02924 | Python | Time Limit Exceeded | n = int(input())
ans = 0
for i in range(1, n):
ans += i
print(ans)
| n = int(input())
print(n * (n - 1) // 2)
| replace | 1 | 5 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
result = 0
for i in range(N):
result += i
print(result)
| N = int(input())
print(N * (N - 1) // 2)
| replace | 2 | 6 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | a = int(input())
sum = 0
for i in range(a):
sum += i
print(sum)
| a = int(input())
sum = 0
sum = (a - 1) * a // 2
print(sum)
| replace | 2 | 4 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | n = int(input())
ans = 0
for i in range(n):
ans += i
print(ans)
| n = int(input())
print(n * (n - 1) // 2)
| replace | 2 | 7 | 2 | 3 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
// int l[n+1];
int main() {
int n;
cin >> n;
long long res = 0;
for (int i = 1; i < n; i++) {
res += i % (i + 1);
}
cout << res;
}
| #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
// int l[n+1];
int main() {
int n;
cin >> n;
long long res = 0;
for (int i = 1; i < n; i++) {
res += i;
}
cout << res;
}
| replace | 9 | 10 | 9 | 10 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, sol;
int main() {
cin >> n;
for (int i = 1; i < n; ++i)
sol += i % (i + 1);
cout << sol;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, sol;
int main() {
cin >> n;
cout << n * (n - 1) / 2;
return 0;
}
| replace | 10 | 14 | 10 | 11 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long N;
cin >> N;
long ans = 0;
rep(i, N) {
if (i != N - 1)
ans += (i + 1) % (i + 2);
}
cout << ans << endl;
return 0;
} | #include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long N;
cin >> N;
long ans = ((N - 1) * N) / 2;
cout << ans << endl;
return 0;
} | replace | 14 | 19 | 14 | 15 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
long long int N;
cin >> N;
long long int sum;
sum = 0;
for (long long int i = 0; i < N - 1; i++) {
sum = sum + ((N - 1 - i) % (N - i));
}
cout << sum << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
long long int N;
cin >> N;
cout << N * (N - 1) / 2 << endl;
return 0;
} | replace | 7 | 15 | 7 | 8 | TLE | |
p02924 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG
signed main() {
int N;
cin >> N;
vector<int> vec(N);
int ans = 0;
cout << N * (N - 1) / 2 << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG
signed main() {
int N;
cin >> N;
// vector<int> vec(N);
int ans = 0;
cout << N * (N - 1) / 2 << endl;
} | replace | 10 | 11 | 10 | 11 | 0 | |
p02924 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
int power(ll x, unsigned int y) {
ll p = mod;
ll res = 1;
x = x % p;
if (x == 0)
return 0;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
ll gcdExtended(ll a, ll b, ll *x, ll *y) {
// Base Case
if (a == 0) {
*x = 0;
*y = 1;
return b;
}
ll x1, y1; // To store results of recursive call
ll gcd = gcdExtended(b % a, a, &x1, &y1);
// Update x and y using results of
// recursive call
*x = y1 - (b / a) * x1;
*y = x1;
return gcd;
}
int main() {
ll n;
cin >> n;
ll ans = 0;
for (int i = 1; i <= n; i++) {
if (i == n)
continue;
ans += i % (i + 1);
}
cout << ans;
// cout<<"djlk";
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
int power(ll x, unsigned int y) {
ll p = mod;
ll res = 1;
x = x % p;
if (x == 0)
return 0;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
ll gcdExtended(ll a, ll b, ll *x, ll *y) {
// Base Case
if (a == 0) {
*x = 0;
*y = 1;
return b;
}
ll x1, y1; // To store results of recursive call
ll gcd = gcdExtended(b % a, a, &x1, &y1);
// Update x and y using results of
// recursive call
*x = y1 - (b / a) * x1;
*y = x1;
return gcd;
}
int main() {
ll n;
cin >> n;
ll ans = 0;
n--;
ans = (n * (n + 1)) / 2;
cout << ans;
// cout<<"djlk";
}
| replace | 67 | 73 | 67 | 69 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
for (int i = 1; i <= n; i++) {
ans += i % (n + i - i);
}
cout << ans << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << (long long)(n - 1) * n / 2 << endl;
return 0;
}
| replace | 8 | 14 | 8 | 9 | TLE | |
p02924 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
typedef long long ll;
const ll mod = 1000000007;
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
int main() {
ll n;
cin >> n;
ll out = 0;
for (ll i = n - 1; i >= 1; --i) {
out += i % (i + 1);
}
cout << out << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
typedef long long ll;
const ll mod = 1000000007;
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
int main() {
ll n;
cin >> n;
cout << n * (n - 1LL) / 2LL << endl;
return 0;
}
| replace | 10 | 15 | 10 | 11 | TLE | |
p02924 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <vector>
#define int long long
#include <string>
#define float long double
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, s = 0;
cin >> n;
int a[n];
for (int i = 0; i < n - 1; i++) {
a[i] = i + 2;
}
a[n - 1] = 1;
for (int i = 0; i < n; i++)
s = s + ((i + 1) % a[i]);
cout << s;
}
| #include <bits/stdc++.h>
#include <vector>
#define int long long
#include <string>
#define float long double
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, s = 0;
cin >> n;
for (int i = 1; i < n; i++)
s = s + i;
cout << s;
}
| replace | 11 | 18 | 11 | 13 | 0 | |
p02924 | Python | Time Limit Exceeded | def calc(n):
r = 0
for i in range(1, n):
r += i
return r
n = int(input())
r = calc(n)
print(r)
| def calc(n):
return (1 + n - 1) * (n - 1) // 2
n = int(input())
r = calc(n)
print(r)
| replace | 1 | 5 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
print(sum(i % (i + 1) for i in range(1, N)))
| N = int(input())
print(int(N * (N - 1) // 2))
| replace | 2 | 3 | 2 | 3 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
print(sum(v for v in range(N)))
| N = int(input())
print(N * (N - 1) // 2)
| replace | 1 | 2 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | print(sum(range(int(input()))))
| n = int(input())
print(n * (n - 1) // 2)
| replace | 0 | 1 | 0 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
ret = 0
for i in range(1, N):
ret += i
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 2 3 4 5 6 7 8 9 10 11 12 13 1
print(ret)
| N = int(input())
ret = (1 + N) * N // 2 - N
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 2 3 4 5 6 7 8 9 10 11 12 13 1
print(ret)
| replace | 1 | 4 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
if N == 1:
print(0)
else:
print(sum([i for i in range(1, N)]))
| N = int(input())
print(N * (N - 1) // 2)
| replace | 1 | 6 | 1 | 2 | TLE | |
p02924 | Python | Time Limit Exceeded | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# import scipy as scp
# 入力の受け取り
n = int(input())
ans = sum(range(n))
print(ans)
# print("{:.10f}".format(ans))
| # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# import scipy as scp
# 入力の受け取り
n = int(input())
n = n - 1
ans = (1 + n) * n // 2
print(ans)
# print("{:.10f}".format(ans))
| replace | 14 | 15 | 14 | 17 | TLE | |
p02924 | Python | Time Limit Exceeded | N = int(input())
ans = 0
for i in range(N):
ans += i
print(ans)
| N = int(input())
print(N * (N - 1) // 2)
| replace | 1 | 6 | 1 | 2 | TLE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.