Submission #1271361

#TimeUsernameProblemLanguageResultExecution timeMemory
1271361ryyypaiNizin (COCI16_nizin)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define pb push_back #define bismillah ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0); bool bom[200005]; ll sumbom[200005]; int main(){ bismillah ll n; cin >> n; vector<ll> a(n+1); for (ll i = 1 ; i <= n ; i++){ cin >> a[i]; } ll ans = 0; ll l = 1, r = n; while (l < r){ if (a[l] != a[r]){ if (a[l] + a[l+1] == a[r]){ a[l+1] += a[l]; l++; ans++; } else if (a[r] + a[r-1] == a[l]){ a[r-1]+=a[r]; r--; ans++; } else{ a[r-1]+=a[r]; r--; ans++;x a[l+1] += a[l]; l++; ans++; } } if (l >= r){ break; } if (a[l] == a[r]){ l++; r--; } } cout << ans << endl; }

Compilation message (stderr)

nizin.cpp: In function 'int main()':
nizin.cpp:39:39: error: 'x' was not declared in this scope
   39 |                                 ans++;x
      |                                       ^