QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#680273#5435. Clamped Sequencezhuge0Compile Error//C++141004b2024-10-26 20:28:092024-10-26 20:28:10

Judging History

你现在查看的是最新测评结果

  • [2024-10-26 20:28:10]
  • 评测
  • [2024-10-26 20:28:09]
  • 提交

answer

#include<bits/stdc++.h>  
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N = 5e6 + 5;
ll n, b, k, m,d;
ll mod = 1e9 + 9;
ll d[10000005]{},cnt=0;
bool vis[10000005]{};
vector<int> prime;
void pre()
{
    cin >> n>>d;
    vector<ll> arr(n);
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll l = arr[i], r = arr[i];
        for (int i = 1; i < n; i++)
        {
            auto turn = [&](int x, int l, int r)
            {
                    if (x > r) return r;
                    else if (x < l) return l;
                    else return x;
            };
            ans = max({ ans,(ll)abs(turn(arr[i],l,l + d) - turn(arr[i - 1],l,l + d)),(ll)abs(turn(arr[i],r,r - d) - turn(arr[i - 1],r,r - d)) });
        }
    }
    cout << ans << endl;
}
void solve() {
  
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
   // pre();
    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }
}

Details

answer.code:8:4: error: conflicting declaration ‘ll d [10000005]’
    8 | ll d[10000005]{},cnt=0;
      |    ^
answer.code:6:15: note: previous declaration as ‘ll d’
    6 | ll n, b, k, m,d;
      |               ^