| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1330436 | ilovewaguri | Global Warming (CEOI18_glo) | C++20 | 14 ms | 972 KiB |
#include<bits/stdc++.h>
using namespace std;
#define NAME "TEST"
#define nl '\n'
#define allofa(x,sz) x+1,x+sz+1
#define allof(x) x.begin(),x.end()
#define mset(x,val) memset(x,val,sizeof(x))
template<typename T> T Max(T x, T y){return(x>y)?x:y;};
template<typename T> T Min(T x, T y){return(x<y)?x:y;};
template<class X,class Y> bool minimize(X &a, Y b){if(a>b){a=b;return true;}return false;};
template<class X,class Y> bool maximize(X &a, Y b){if(a<b){a=b;return true;}return false;};
typedef long long ll;
const ll mod = (long long)1e9+7;
const ll LINF = (long long)1e18;
const int INF = (int)1e9;
const int MAXN = (int)2e5+5;
int a[MAXN];
int n,x;
void ccps() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
if(fopen(NAME".inp","r")) {
freopen(NAME".inp","r",stdin);
freopen(NAME".out","w",stdout);
}
}
namespace sub2 {
bool check() {
return n<=50 and x<=50;
}
void sol() {
int b[n+5],dp[n+5];
int res = 1;
for (int d = -x; d<=x; d++) {
bool isTH = false;
mset(dp,0);
for (int l = 1; l<=n; l++) {
for (int r = l+1; r<=n; r++) {
for (int i = 1; i<=n; i++) b[i] = a[i];
if(d==-5 and l==2 and r==3) isTH = true;
for (int i = l; i<=n; i++) {
b[i]+=d;
}
}
}
int curLIS = 1;
for (int i = 1; i<=n; i++) {
dp[i] = 1;
for (int j = 0; j<i; j++) {
if(b[i]>b[j]) maximize(dp[i],dp[j]+1);
}
maximize(curLIS,dp[i]);
}
maximize(res,curLIS);
}
cout << res;
}
}
signed main() {
ccps();
cin >> n >> x;
for (int i = 1; i<=n; i++) {
cin >> a[i];
}
if(sub2::check()) return sub2::sol(),0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
