Submission #954252

# Submission time Handle Problem Language Result Execution time Memory
954252 2024-03-27T14:11:07 Z Trisanu_Das Sequence (APIO23_sequence) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "sequence.h"
using namespace std;

int sequence(int n, vector<int> n){
  int ans = 0;
  for(int i = 0; i < n; i++){
    int s = 0, c = 0;
    for(int j = i; j > -1; j--){
      if(a[i] == a[j]) c++;
      if(a[i] > a[j]) s--;
      if(a[i] < a[j]) s++;
      if(abs(s) <= c) ans = max(ans, c);
    }
  }
  return ans;
}

Compilation message

sequence.cpp:5:33: error: conflicting declaration 'std::vector<int> n'
    5 | int sequence(int n, vector<int> n){
      |                     ~~~~~~~~~~~~^
sequence.cpp:5:18: note: previous declaration as 'int n'
    5 | int sequence(int n, vector<int> n){
      |              ~~~~^
sequence.cpp: In function 'int sequence(int)':
sequence.cpp:10:10: error: 'a' was not declared in this scope
   10 |       if(a[i] == a[j]) c++;
      |          ^
sequence.cpp:11:10: error: 'a' was not declared in this scope
   11 |       if(a[i] > a[j]) s--;
      |          ^
sequence.cpp:12:10: error: 'a' was not declared in this scope
   12 |       if(a[i] < a[j]) s++;
      |          ^