QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#939430#4929. Longest Unfriendly Subsequencejustin271828Compile Error//C++20414b2025-03-17 13:32:502025-03-17 13:32:53

Judging History

This is the latest submission verdict.

  • [2025-03-17 13:32:53]
  • Judged
  • [2025-03-17 13:32:50]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    for (int qwerty = 0; qwerty < t; qwerty++) {
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; i++) cin >> a[i];
        int ans = 1;
        for (int i = 1; i < n; i++) {
            if (arr[i] != arr[i-1]) ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:14:17: error: ‘arr’ was not declared in this scope
   14 |             if (arr[i] != arr[i-1]) ans++;
      |                 ^~~