제출 #954252

#제출 시각아이디문제언어결과실행 시간메모리
954252Trisanu_Das서열 (APIO23_sequence)C++17
컴파일 에러
0 ms0 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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++;
      |          ^